Re:Implementing Advanced Math Functions
by jvranish on Wednesday April 25, 2012 @10:29AM
(#3889237)
If your goal is accuracy, you are absolutely correct. But in the instances where I've wanted to implement my own versions of transcendental math functions, accuracy was actually pretty low on my list of priorities. Often just a couple terms of a taylor series was accurate enough, fast, and easy to implement.
[ Parent
| on HN ]
Re:Implementing Advanced Math Functions
by stephencanon on Wednesday April 25, 2012 @10:33AM
(#3889260)
It's true regardless of what your goal is (unless your goal is to play with Taylor series approximations). Even if you're going purely for speed, you can often replace a third-order Taylor series with a second-order minimax polynomial, and deliver the same or better accuracy with significantly fewer operations.
Do you know of good resource for how to compute minimax polynomials that approximate transcendental functions? My Google foo appears to be failing me.
Re:Implementing Advanced Math Functions
by stephencanon on Wednesday April 25, 2012 @01:31PM
(#3890083)
The standard approach to minimax approximations is called the "Remez Exchange Algorithm" (or Remez algorithm, or Remes algorithm). It can be fussy, however, and often requires a knowledgeable user to product good results, which is why Chebyshev and Cathedory-Fejer approximants are often used instead -- they are very nearly as good, and much easier to compute.