Go back to previous page
Forum URL: http://www.cut-the-knot.org/cgi-bin/dcforum/forumctk.cgi
Forum Name: College math
Topic ID: 596
#0, a = sin(f(x) * n); n = ???
Posted by oniwaka on Dec-13-06 at 03:16 PM
I'm being haunted by this problem! My only solution at this point is the dirtiest of programmers tricks(the lookup table), which is workable for the level of precision I need. However, I can't help but think there's a better solution.

a = sin(f(x) * n)
or
a = (exp(complex(0, f(x) * n)) - exp(-complex(0, f(x) * n))) / 2j

a and x are known

Thanks in advance for any help you might offer.


#1, RE: a = sin(f(x) * n); n = ???
Posted by alexb on Dec-13-06 at 03:23 PM
In response to message #0
Even assuming f(x) is a known function, the problem does not have a unique solution. Regardless, it requires a more or less standard application of arcsin:

f(x)*n = arcsin(a) or
f(x)*n = π - arcsin(a).

There may be a question of efficiency of course, in which case a lookup table may be a viable alternative.


#2, RE: a = sin(f(x) * n); n = ???
Posted by oniwaka on Dec-13-06 at 09:19 AM
In response to message #1

Thank you. I'll be able to rest easily now. Maybe I should take a math refresher course...

I compiled a quick benchmark, and the lookup table is indeed faster in C. But since I'm prototyping in python, which has non-negotiable float precision (requiring type conversion for each lookup), arcsin(a)/f(x) is actually faster.

Thanks again.