# x = cos(r), y = sin(r), is reverse possible to determine r ?

Discussion in 'General Math' started by Skybuck Flying, May 1, 2011.

1. ### Skybuck FlyingGuest

Hello,

A point on a circle can be described by r in radians.

For example

r = pi
x = cos(r)
y = sin(r)

Now I would like to be able to calculate the reverse as easily as possible.

Is it perhaps somehow possible to determine r by using arccos and arcsin
(the inversie of cos and sin) ?

something like:

r = arccos(x) + arcsin(y) ? (this is wrong though)

I would prefer a solution without divisions and without arctan if
possible...

arctan2 is giving me problems and returning larger than desired angles,
maybe it's because angles suddenly flip from + to -

and then calculating:

AngleDifference = NewAngle - OldAngle gives problems ?

Bye,
Skybuck.

Skybuck Flying, May 1, 2011

2. ### Skybuck FlyingGuest

Ok,

I have plenty of functions now to do just that, so that wasn't the
problem... I figured out what the real problem was... so now I can
continue...

But I am also interested in more methods...

So far I have seen two pretty much:

1. With arccos and normalize and dot product and what not...

and

2. With arctan and what not...

Bye,
Skybuck.

Skybuck Flying, May 1, 2011

3. ### Skybuck FlyingGuest

Though perhaps there was a problem with a third way/function so maybe I
should check that out later... just to see if values are samiliar or not...

Also some checks probably need in case something is 0 or something...

Bye,
Skybuck.

Skybuck Flying, May 1, 2011
4. ### William ElliotGuest

r = arctan y/x, x in (0,1]
r = pi/2, x = 0, y = 1
r = -pi/2, x = 0, y = -1
r = pi - arctan y/x, x in [-1,0)

Warning, removal of problem statement or of important parts

William Elliot, May 1, 2011
5. ### Joe PfeifferGuest

I was afraid somebody would respond to him. The correct answer was, of
course, "please take a middle school trigonometry class".

Joe Pfeiffer, May 1, 2011
6. ### Jasen BettsGuest

replying to the subject. many computer programming languanges provide
an atan2() function that does exactly that.

replying to the newsgroups line: It appears that Delphi doesn't.
C does, if you can link the C runtime math library you can call it.

without atan2 you need to divide the smaller by the larger (this is
the easiest way to avoid egde cases that can cause divide by zero)
take the atan() of that and then figure out which quadrant you're in.

Jasen Betts, May 1, 2011
7. ### EricPGuest

This guy, Sal Khan, does quite good videos on all sorts of topics,
mostly high school but also finance. He has 3 degrees from MIT and a
Harvard MBA, and was a hedge fund manager, but gave it up to make videos.
He has a knack for explaining in an understandable manner.
Scroll down - Trig is under 'T'