inverse SIN

Questions about the BASICtools and MakeItC
Post Reply
YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

inverse SIN

Post by YahooArchive »

There is a series solution but you'll have to test to make sure the result
is the primary value.



Asin(x) = x + x^3/(2*3) + (1*3)x^5/(2*4*5) + (1*3*5)x^7/ (2*4*6*7) + . and
so on



Chip



armBasic doesn't directly support inverse SIN. anyone know how to
derive it through some manual math? I am trying to convert
acceleromter output to degrees.

Thanks!
-Jon



YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: inverse SIN

Post by YahooArchive »

> Apologies if this is rudimentary...
> In past projects, what I've done when needing speed and having no FP
> hardware is:
> Use Excel or a program/script to compute the trig function for n
> points in a quadrant.


I'd agree most people attack this type problem with a table, its quick
and really doesn't take that much space. Its a little unfortunate
that BASIC doesn't have a good construct for doing initialization.
Strings can be used but even they are a bit limited. DATA works, but
is a bit klunky.

One thing I should have done for the fractional expansion would be to
scale by 1024 or some multiple of 2. While the ARM does multiplies in
1 cycle, divides take a bit. Shift by 10 bits is another single cycle
operation.

YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: inverse SIN

Post by YahooArchive »

THANKS ALL.
A lookup table seemed to do a fair job.

apparently there is another option that worked out well too.
Sins I had a 3-axis accelerometer I was able to take 2 of them and average them
because they were out of phase. That straightened out the sine curve info. the
angles ended up to be pretty accurate.

It's funny.....I never thought I would need trig. in my adult life. Since I
thought I was cheating by using a calculator back in school, it's funny to
realize that there is no real practical way to do Inverse SIN functions with
pencil and paper alone.

-Jon

Post Reply