Brief
A loan advertised at 5% with a fee is not a 5% loan. To know the true rate you have to solve for it. A cash flow at time is worth today. The internal rate of return is the where all of them cancel:
There is no formula for , so you solve numerically. Newton's method uses the derivative. At the current guess, replace NPV by its tangent line and jump to where the tangent hits zero: . Near the answer the error gets squared each step.
The same idea finds minimums. The second-order Taylor expansion is a parabola. Jump to its bottom: . With many variables, becomes the Hessian , the matrix of second partial derivatives, and the step solves . Curvature tells Newton how far to go. Gradient descent only knows the direction, so it needs a hand-tuned learning rate and many more steps.
DATA · your own cash-flow examples
Objectives
Read-only. Log in to update progress.
VICTORY CONDITIONS
- Your Newton IRR matches `scipy.optimize.newton` to 1e-10 on every example, in fewer iterations than gradient descent. Record the loan example with `python tools/mlarena.py record BM-18 "<Newton iters> vs <GD iters>"`.
- The README has a per-step error table showing the correct digits roughly doubling near the answer.
- Newton with the Hessian reaches the Rosenbrock minimum in fewer steps than your BM-15 optimizers.
Side quests
Terms in plain words
- Net present value (NPV)
- The sum of all cash flows, each discounted to today: Σ C_t / (1 + r)^t.
- Internal rate of return (IRR)
- The rate r that makes NPV zero. For a loan, it is the true interest rate once fees are counted.
- Newton's method
- Replace the function by its tangent line (or, when minimising, by the parabola from its Taylor expansion) and jump to where that model says the answer is. Repeat.
- Hessian
- The matrix of second partial derivatives. It measures curvature. With one variable it is just f″.
- Quadratic convergence
- Near the answer the error is roughly squared each step, so the number of correct digits about doubles.