[Nottingham] Trigonometry!

John Cremona john.cremona at gmail.com
Sat Jan 27 16:54:29 GMT 2007


At last a question I can answer, being a mathematician.  The link in
the previous post is fairly helpful, but you should note that the
funtion you need is atan2() (with two arguments, x and y) rather than
just atan().   See "man atan2".

atan2(x,y) is valid for all real x,y except 0,0 and gives the angle in
radians from the origin (0,0) to (x,y), correctly whatever quadrant
(x,y) is in.  To convert to degrees just multiply by 180.0/PI and that
will give an answer between -180 and +180.

The convention is that the angle is measured up  from the positive x
axis so atan2(1,0)=0 etc.

Now I should stop lecturing (except to the subscriber who admittied to
being a 1st year mathematics student at the U of N, who will be seeing
me regularly starting at 9a,m. next Tuesday!

John Cremona



More information about the Nottingham mailing list