Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Is there a 'simple' way of approximate all these math functions? I'm interested in $\tanh$, $\cos$, $\sin$, $\arccos$ and much more :) Im searching for a way to implement these functions by my own (need it for fast calculation).

Do I need to learn one method (i.e., Taylor?) to do this ? Or is there a simple collection which I could take and program.

Could someone help me?

Greetings

share|improve this question
1  
A Taylor series centered about the origin works, but this is best only for arguments near zero. However, three of your four functions satisfy nice double-argument identities, which you can exploit for argument reduction purposes. –  J. M. Apr 12 '13 at 16:06
    
Take a look at the entry for it in Wikipedia, it mentions several algorithms to compute the values. Modern CPUs do it efficiently in hardware, the need to compute them "by hand" is long gone. –  vonbrand Apr 12 '13 at 16:39
    
It really depends on how close you want to be from the function. You can always try to fit a polynomial to a portion of the function and then use their periodic nature and the identities proposed by J.M. ;) –  Dolma Apr 12 '13 at 16:40
    
Most programs that attempt to approximate these functions will first reduce the angle as much as possible (i.e. using θ mod π/2 instead of θ), and then using the first 2-3 terms of the respective Taylor series expansion; note that this only gives an approximation, however, and in some cases it can be very off. –  Sim Apr 12 '13 at 16:42
    
@vonbrand i need these functions in SSE intrinsics - and there are no function..... for the most funcs... –  Roby Apr 12 '13 at 18:34
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.