Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"11-12-10 - Some notes on function approximation by iteration"

2 Comments -

1 – 2 of 2
Blogger ryg said...

"we could also do r = x_n * (1+e) or r = x_n/(1+e) or whatever. Sometimes these give better iterations (in terms of complexity vs. accuracy)."
For the specific case of reciprocal, square root and reciprocal square root computations, this is called "Goldschmidt's algorithm". Both Newton-Raphson and Goldschmidt actually evaluate the same series expansion in this case, but Goldschmidt is less serial which makes it popular for FP dividers. See this paper for example.

There's some papers on HW implementations and math libraries for newer architectures and they're worth reading, e.g. this one (also Google for the paper and look at the citations etc). Lots of good stuff in there.

"You could use Legendre Polynomials to find the actual best N-term approximation (or any other orthogonal polynomial basis)"
Orthogonal polynomials give you an optimal approximation wrt. weighted L2 norms (int_a^b (f_approx(x) - f_real(x))^2 w(x) dx, where w(x) is a weighting function corresponding to your choice of basis). So it minimizes average error, but to minimize maximum absolute/relative error (which is usually what you want) you need a different approach (minimax approximation). Still, they're usually significantly better than Taylor polynomials, and the coefficients are easy to determine even without a computer algebra system (unlike minimax polynomials).

November 17, 2010 at 4:30 PM

Blogger cbloom said...

Yeah, you're right that it should be minimax/remez polynomials, though if you bring x into a standard power of two range like [1,2) then just use L2 norm instead of ratio, it's not that far off.

(BTW I just noticed Boost now has a Remez resolver :

http://www.cppprog.com/boost_doc/libs/math/doc/sf_and_dist/html/math_toolkit/backgrounders/remez.html

)

November 17, 2010 at 4:49 PM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.