Derivative function funcd in Newton-Raphson


maleger
04-10-2003, 09:31 AM
I'm using the rtsafe algorithm to calculate a financial Internal Return Rate but I don't get the exact same return as an other function, so my problem must be in my Derivation function "funcd"

I'm doing f' (x) = f (x+dx) - f(x) / dx

where dx is the precision, f(x) is the sommation of all my cashflow in time.


With my Newton-Raphson function I get -0.100644 and with an XIRR function in Excel I get -0.100791

Can someone help me, Please :)

Can someone give me a good funcd function ?

Marc-Andre

jaje
01-09-2004, 08:53 AM
Would you happen to have a "nice expression" for computing f'(x)? If so, you may be better off using that instead of using
f' (x) = f (x+dx) - f(x) / dx .

In any case that formula is known to be extremely susceptible to roundoff error (think dividing two nearly zero quantities!), so I wouldn't recommend it. If you are unable to find an analytic expression for f'(x), you may be better off using Brent's method or Ridders' method. Both are discussed in the Numerical Recipes books.

Hope this helps.

Jan M. (^_^)