Unfortunately, Taylor series are just about the worst choice possible for implementing transcendental math functions, due to the highly non-uniform error distribution. You end up doing far to much work to get good accuracy near the edges of the domain of interest. Much better choices of polynomial approximations for almost any such situation are (in increasing order of goodness and difficulty to work with): Chebyshev…
Implementing Advanced Math Functions
11–20 of 24 posts
Re: Implementing Advanced Math Functions
#12Unfortunately, Taylor series are just about the worst choice possible for implementing transcendental math functions, due to the highly non-uniform error distribution. You end up doing far to much work to get good accuracy near the edges of the domain of interest. Much better choices of polynomial approximations for almost any such situation are (in increasing order of goodness and difficulty to work with): Chebyshev…
http://code.google.com/p/mpmath/source/browse/trunk/mpmath/l...
Re: Implementing Advanced Math Functions
#13Unfortunately, Taylor series are just about the worst choice possible for implementing transcendental math functions, due to the highly non-uniform error distribution. You end up doing far to much work to get good accuracy near the edges of the domain of interest. Much better choices of polynomial approximations for almost any such situation are (in increasing order of goodness and difficulty to work with): Chebyshev…
How do you define "minimax" such that it's not a Chebyshev series?
Re: Implementing Advanced Math Functions
#14Unfortunately, Taylor series are just about the worst choice possible for implementing transcendental math functions, due to the highly non-uniform error distribution. You end up doing far to much work to get good accuracy near the edges of the domain of interest. Much better choices of polynomial approximations for almost any such situation are (in increasing order of goodness and difficulty to work with): Chebyshev…
Taylor series is fine for implementing arbitrary precision transcendental functions though. I found this Python implementation enlightening. http://code.google.com/p/mpmath/source/browse/trunk/mpmath/l...
Re: Implementing Advanced Math Functions
#15Earlier quoted context omitted.
How do you define "minimax" such that it's not a Chebyshev series?
The minimax polynomial minimizes the maximum error (the L-inf norm). The truncated Chebyshev series of an arbitrary function does not have that property (though it often comes close).
Let's try this: Tell me how you would construct a minimax approximation according to your definition?
Re: Implementing Advanced Math Functions
#16Earlier quoted context omitted.
The minimax polynomial minimizes the maximum error (the L-inf norm). The truncated Chebyshev series of an arbitrary function does not have that property (though it often comes close).
I thought the truncated Chebyshev series of an arbitrary function minimizes the L-inf error among all polynomials of the same degree, because Chebyshev polynomials have minimum L-inf norm among all monic polynomials of the same degree. Let's try this: Tell me how you would construct a minimax approximation according to your definition?
Re: Implementing Advanced Math Functions
#17Earlier quoted context omitted.
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.
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.
Re: Implementing Advanced Math Functions
#18Earlier quoted context omitted.
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.
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.
Re: Implementing Advanced Math Functions
#19Earlier quoted context omitted.
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.