Re: Programming question : Newton's method

From: Andrew Wilson <atwilson_at_home.com>
Date: Fri Oct 29 1999 - 12:23:12 EDT

> Yeah, computing the first derivative of the function is generally
>more complicated than a lookup table ;)
>
> Actually, for this example, Newton-Raphson approximation wouldn't
>work. Newton-Raphson is generally used to find the roots of a function:
>
> i.e. For which values of x are <insert your nasty, but not too bad
>to differentiate function here> = 0

        Forget the derivative - all the derivative does is help you converge
on the answer faster. Look at this as a binary search problem over the range
of the roots, and the algorithm becomes pretty trivial, although you have to do
a few more iterations. Your binary compare function squares the current guess
and compares it against the target. Since you know your root will be 8-bit,
you can do an 8-bit integer multiply and save some cycles on the 6502.

        Amazing how many ways there are to attack this problem...

                        Drew
Received on Fri Oct 29 11:23:14 1999

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2003 - 00:32:48 EDT