Shop OBEX P1 Docs P2 Docs Learn Events
Is there a command for arccosine? — Parallax Forums

Is there a command for arccosine?

stevenoostevenoo Posts: 4
edited 2006-09-12 00:24 in BASIC Stamp
hi,
··· Anyone know how to convert·an argument to an angle? for instant 'arccosin·x'. ·

Comments

  • Kirk FraserKirk Fraser Posts: 364
    edited 2006-09-11 19:43
    Since here we talk Stamps, the math must correspond to the integer math available in the Stamp Editor. Since my Win98SE on a Celeron somehow fails to look up Help when requested, I can't read the details of most commands in the PBASIC Syntax Guide easily but perhaps you can on your computer. I do see ATN is available. So if you need to work with trigonometry, you should find a text which gives the equivalent formulas to derive the function you want from the functions you have.

    On the other hand, a solution to your problem as first stated without "arcosin x" you will have to examine the total picture to find a solution. For example, in my application I use data from 0 to 4095 to give degrees and tenths using a formula given by poster Tracy as x ** 57600 but I changed it to x ** 57615 to closer fit my data to desired results.

    So it depends on exactly what you want in terms of both input values and angles output which requires more details for me to comprehend than you have provided.

    Kirk
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-09-11 20:00
    There is an ATN function that you can read about in the Stamp manual.

    angle = x ATN y

    where x and y are between -127 and +127 (representing +/- 1) and angle will be from 0 to 255 brads.

    But you have x and want arccosine x. You can find y, and then plug it into the above formula.
    On a unit circle, y*y = 1 - x*x. That is for a calculator, but on the Stamp for trig functions,
    y = SQR (16384 - (x*x))
    And
    angle = x ATN (SQR (16384 - (x*x)))

    For example, x=64, then y=111, angle = 42 brads.
    In normal trig, that is x=0.5, y=sqr(3)/2, angle = 60 degrees, pi/3 radians.


    edited: 60 degrees is ~42 brads

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 9/12/2006 5:21:01 AM GMT
  • dandreaedandreae Posts: 1,375
    edited 2006-09-11 21:20
    Kirk Fraser said...
    Since here we talk Stamps, the math must correspond to the integer math available in the Stamp Editor. Since my Win98SE on a Celeron somehow fails to look up Help when requested, I can't read the details of most commands in the PBASIC Syntax Guide easily but perhaps you can on your computer. I do see ATN is available. So if you need to work with trigonometry, you should find a text which gives the equivalent formulas to derive the function you want from the functions you have.

    On the other hand, a solution to your problem as first stated without "arcosin x" you will have to examine the total picture to find a solution. For example, in my application I use data from 0 to 4095 to give degrees and tenths using a formula given by poster Tracy as x ** 57600 but I changed it to x ** 57615 to closer fit my data to desired results.

    So it depends on exactly what you want in terms of both input values and angles output which requires more details for me to comprehend than you have provided.

    Kirk
    Hi Kirk,
    There is a work around for the "Help" file issue that you are experiencing.· If you click on "Start" in Windows and then click on "Programs" and then click on the "Parallax" folder you can open·the "Help" file from there.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com

    ·
  • stevenoostevenoo Posts: 4
    edited 2006-09-12 00:24
    Thanks a lots guy.wink.gif· Have a nice day.
Sign In or Register to comment.