I need to calculate apr in the uk using this formula
http://en.m.wikipedia.org/wiki/Annual_percentage_rate#European_Union
Ive been advised to try the binary chop method but I have no idea how to do this. Ive seen examples on line but they are based on US calculation for apr. I don't really know where to begin. Im not from finance or maths background but I did some maths at uni. I think im more confused by the finance side of things and the unfamiliar terminology.
Please could you give a simple algorithm of how to solve the apr. I have monthly payments, arrangement fee which can be added to first payment and a closing fee which is added to last payment. The overall loan is at a flat rate of interest.
Thanks in advance for any help
See (How to calculate APR using Newton Raphson)
I like single letter variables for formulas, so
The payment plan, as I understand it, has an initial debt or principal $T$, and additionally the fees $F_1$ and $F_n$ are considered as part of the debt. After a month $R+F_1$ are paid, then every month $R$ until the last, where $R+F_n$ is paid, after the n-th payment, the debt is paid in full.
The total balance for the effective interest rate $x$, seen from the start of the debt, and according to the flow of payments, reads as
\begin{align}T+F_1+F_n&=(R+F_1)(1+x)^{-1/12}+R(1+x)^{-2/12}+\dots+R(1+x)^{-(n-1)/12}+(R+F_n)(1+x)^{-n/12}\\ &=F_1(1+x)^{-1/12}+R\frac{1-(1+x)^{-n/12}}{(1+x)^{1/12}-1}+F_n(1+x)^{-n/12} \end{align}
or using $1-y=(1+x)^{-1/12}$
$$T+F_1+F_n=F_1(1-y)+R(1-y)\frac{1-(1-y)^n}{y}+F_n(1-y)^{n}$$
Update: To get a function to solve, use
$$0=f(y)=-F_1 y+R(1-y)\frac{1-(1-y)^n}{y}-T-F_n(1-(1-y)^{n})$$
for $y\in(0,1)$. If the functions are available,
math.hhas them, use for the computation of $1-(1-y)^n$ the code-expm1(n*log1p(-y)), which is more precise for small values of $y$, especially in the middle term with a divisor of $y$.