Derivative function funcd in Newton-Raphson


maleger
04-10-2003, 09:28 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

kibitzer
04-11-2003, 08:12 AM
Hi,

The idea in Newton's method (rtsafe) is to use analytic derivatives. While computing the derivative numerically as you are doing sometimes works, it's not a good idea. If you can only compute function values, then zbrent works well. If your function is choppy (which it sounds like it might be if it's based on financial data), then
use rtbis.

Good luck.