1 / 9

Mortgage Calculation

Mortgage Calculation. Using z-transforms. Setup the Original Equation. Let k=month number: 0,1,2,3 etc. Let y(k)=loan balance in month k Let u(k)=payment during month k Let i=interest rate as a proportion Let m=monthly payment and P=amount of loan

roden
Download Presentation

Mortgage Calculation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mortgage Calculation Using z-transforms

  2. Setup the Original Equation • Let k=month number: 0,1,2,3 etc. • Let y(k)=loan balance in month k • Let u(k)=payment during month k • Let i=interest rate as a proportion • Let m=monthly payment and P=amount of loan • The loan balance then at month k+1 is: Y(k+1)=y(k)*(1+i/12) – u(k) If a=(1+i/12) then Y(k+1)=a*y(k) – u(k) (no z transforms yet!!)

  3. Z-transform Each Term… • Z(y(k+1))=a*Yz – Uz but u(k) was a steady unit amount each month, so to find Uz look it up in the table: Uz=m*z/(z-1)=Z(u(k)) • And using the shift theorem: Z(y(k+1))=z*Yz – z*y(0) Note initial values like y(0) are in most cases ignored but can’t be in this example (my bad). • ========================== Final z-transformed equation: • z*Yz – z*y(0) = a*Yz -m*z/(z-1)

  4. Next: Solve for Yz Algebraically • z*Yz – z*y(0) = a*Yz -m*z/(z-1) • z*Yz - a*Yz = + z*y(0) -m*z/(z-1) • Yz*(z – a) = + z*y(0) -m*z/(z-1) • Yz= + z*y(0) /(z – a) -m*z/((z-1) *(z – a) )

  5. Begin the inverse z-transform • Yz= + z*y(0) /(z – a) - m*z/((z-1) *(z – a) ) The term z*y(0) /(z – a) can be looked up in the table but the second half must be expanded using partial fractions: ==============Notice a trick, multiplying by z======== K1*z/(z-1) +k2*z/(z-a)=-m*z/((z-1) *(z – a) ) Or K1/(z-1) +k2/(z-a)=-m/((z-1) *(z – a) ) Solving gives: K1=-m/(1-a)=m/(a-1) k2=-m/(a-1) ==============Substituting back gives============= Yz=z*y(0)/(z – a) + m/(a-1) *(z/(z-1)) -m/(a-1) *(z/(z – a) ) Ready, get set, magic happens………

  6. Solving for Y(k) Yz=z*y(0)/(z – a) + m/(a-1) *(z/(z-1)) -m/(a-1) *(z/(z – a) ) • Y(k)=y(0)*ak +m/(a-1) –m/(a-1 )*ak Or factoring: • Y(k)=y(0)*ak +m(1- ak )/(a-1) If at end of k months the loan is paid off, Y(k)=0 then solve for needed monthly payment m: • 0=y(0)*ak +m(1- ak )/(a-1) • +m(1- ak )/(a-1)= -y(0)* ak but if P=y(0) then: • m= -y(0)* ak *(a-1)/(1- ak )=-P*(a-1)/(a-k – 1) or:

  7. Final answer: • Final Answer (fanfare: “do to do to do to do” ) m=P*(1-a)/(a-k – 1) but recall: a=1+i/12 m=P*(-i/12)/((1+i/12)-k – 1) or m=P*(i/12)/(1 - (1+i/12)-k) or m=P*(i/12)*(1+i/12)k/((1+i/12)k - 1) In C++ and assuming J=i/12 you could write: • M = P *J*( (pow(1.0+ J,n))/(pow(1.0+J,n) - 1.0));

  8. Example: • 20 year mortgage, 11% interest, $30000 house: m=P*(-i/12)/((1+i/12)-k – 1) m=30000*(-.11/12)/((1+.11/12)-240 – 1) m=30000*(-.0091666)/(-.88808)=$309.65 Rent it for 600$/month + utilities and begin the joys of landlord/lady ownership……….

  9. Banking Mania 2008 This formula was used in the mortgage program that is included here. However, the reason for using this formula was never obvious to me. I had simply copied it from a book and I was amazed, when I started to learn about z-transforms, at their power to do this calculation. I had found other non transform methods on the internet for accomplishing this but they too were complex.

More Related