User:Neil Parker

Neil Parker 16:41, 21 June 2007 (UTC) /Sandbox /Quaternions in Projectile Motion

Experiment with inline formula
Annual Payment Rate:      $$M_a=\lim_{N\to\infty}N\cdot x(N)=\frac{P_0\cdot r}{1 - e^{-rT}}$$

Future Value:      $$F_v(t) = \frac{M_a}{r}(e^{rt}-1)$$ Calculate

Present Value:      $$P_v(t) = \frac{M_a}{r}(1 - e^{-rt})$$

Loan Balance:      $$P(t) = \frac{M_a}{r}(1 - e^{-r(T-t)})$$

Loan Period:             $$T=-\frac{1}{r}\ln\left(1-\frac{P_0.r}{M_a}\right)$$

Half Life of Loan:      $$t_{\frac{1}{2}}=\frac{1}{r}\ln\left(\frac{1+e^{rT}}{2}\right)$$

Interest Rate:             $$r=\frac{1}{T}\left (W(-se^{-s})+s\right )$$ with $$s=\frac{M_at}{P_0}$$

Difference Equation
The conventional difference equation for a mortgage loan is relatively straightforward to derive - balance due in each successive period is the previous balance plus per period interest less the per period fixed payment.

Given an annual interest rate r and a borrower with an annual payment capability MN (divided into N equal payments made at time intervals Δt where Δt = 1/N years), we may write:


 * $$\begin{array}{lcl}

P_{t+\Delta t} & = & P_t+(rP_t-M_N)\Delta t\\ \\ \dfrac{P_{t+\Delta t}-P_t}{\Delta t} & = & rP_t-M_N\\ \end{array}$$

If N is increased indefinitely so that Δt→0, we obtain the continuous time differential equation:


 * $${\operatorname{d}P(t)\over\operatorname{d}t}=rP(t)-M_a $$

Solving the Difference Equation
We begin by re-writing the difference equation in recursive form:


 * $$P_{t+\Delta t}=P_t(1+r\Delta t)-M_N\Delta t\; $$

Using the notation Pn to indicate the mortgage balance after n periods, we may apply the recursion relation iteratively to determine P1 and P2:


 * $$P_1 = P_0(1+r\Delta t)-M_N\Delta t\;$$
 * $$\begin{align}
 * $$\begin{align}

P_2 &= [P_0(1+r\Delta t)-M_N\Delta t](1+r\Delta t)-M_N\Delta t\\ \\ &= P_0(1+r\Delta t)^2 - M_N\Delta t(1+r\Delta t)-M_N\Delta t\\ \end{align}$$

It can already be seen that the terms containing MN form a geometric series with common ratio $$1+r\Delta t$$. This enables us to write a general expression for Pn:


 * $$\begin{align}

P_n&=P_0(1+r\Delta t)^n-\sum_{k=1}^{n} M_N\Delta t(1+r\Delta t)^{n-k}\\ \\ &=P_0(1+r\Delta t)^n-\dfrac{M_N\Delta t[(1+r\Delta t)^n - 1]}{r\Delta t}\\ \end{align}$$ Finally noting that $$r\Delta t=i$$ the per period interest rate and $$M_N\Delta t=x$$ the per period payment, the expression may be written in conventional form:


 * $$P_n=P_0(1+i)^n-\dfrac{x[(1+i)^n - 1]}{i}$$

If the loan timespan is m periods, then Pm=0 and we obtain the standard present value formula:


 * $$P_0=\dfrac{x[1-(1+i)^{-m}]}{i}$$

Minimum Payment Ratio
The minimum payment ratio of a loan is the ratio of minimum possible payment rate to actual payment rate. The minimum possible payment rate is that which just covers the loan interest - a borrower would in theory pay this amount forever because there is never any decrease in loan capital. We will use the letter k to denote minimum payment ratio:


 * $$ k = \frac{M_{min}}{M_a} = \frac{P_0r}{M_a} $$

Now we may consider a small re-arrangement of the equation for loan period T:


 * $$ T = -\frac{1}{r}ln(1-\frac{P_0r}{M_a}) $$
 * $$ rT = s(k) = -ln(1-k) \; $$

Plotting "s"("k") against "k" gives a very graphic demonstration of why it is a good idea to keep the k value well below the asymptote at "k"="1" since in the vicinity thereof, s(k) increases sharply and therefore so does loan cost which is in turn a function of parameter "s" ("rT" product).

Equivalent Simple Interest Cost Factor
For a fixed term loan of t years, we may compare the above loan cost factor against an equivalent simple interest cost factor 1+se where se=ret and re is the equivalent simple interest rate:


 * $$\frac{s}{1-e^{-s}}=1+s_e $$

It is straightforward to determine se in terms of s. Dividing by loan time period t will then give the equivalent simple interest rate. More challenging is the reverse determination of s given se. Submitting the equation to the computational engine at Wolfram Alpha yields the following solution:


 * $$s=W_n(-e^{-s_e-1}(s_e+1))+s_e+1$$

where Wn is the Lambert W or product log function.

For example given a loan period of 3 years we may pose the question what interest rate applied to the continuous repayment model yields the same cost factor as a 25% pa simple interest rate applied over the same period. We set se=0.25x3=0.75 and solve for s. The answer divided by 3 gives the continuous repayment equivalent rate as 41.6% pa.

In his book Problem Solving with True Basic, Dr B.D. Hahn has a short section on certain 'hire purchase' schemes in which ''interest is calculated in advance in one lump sum, which is added to the capital amount, the sum being equally divided over the repayment period. The buyer, however, is often under the impression that the interest is calculated on a reducing balance.''

The above example is adapted from the one given in Dr Hahn's book in which he employs the Newton Rhapson algorithm to solve the same problem albeit for a discrete interval (ie monthly) repayment loan over the same time period (3 years). As with many similar examples the discrete interval problem and its solution is closely approximated by calculations based on the continuous repayment model - Dr Hahn's solution for interest rate is 40.8% as compared to the 41.6% calculated above.