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

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

  1. 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

    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 ?

    Skybuck Flying, May 1, 2011
    1. Advertisements

  2. 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

    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...


    2. With arctan and what not...

    Skybuck Flying, May 1, 2011
    1. Advertisements

  3. 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...

    Skybuck Flying, May 1, 2011
  4. 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
    of the discussion from your reply will give a lousy reply.
    William Elliot, May 1, 2011
  5. Skybuck Flying

    Joe Pfeiffer Guest

    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. Skybuck Flying

    Jasen Betts Guest

    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. Skybuck Flying

    EricP Guest

    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'


    EricP, May 1, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.