MASTERSHEET 
Copy/Paste Formulae for Core 2

>Copy the formula you need
>Paste it into the other workbook you are using
>NOTE: Do NOT alter the formulae in this workbook, these are your templates only.

MATHEMATICA COMMANDS FOR CORE 2 Recursion and financial modelling

1. Generating a TABLE of a sequence.

f[x_]:="Common Ratio" x+"Common Difference"
NestList[f, "First term",( "How many more terms")]//FullForm

Example Use a calculator to generate the first five terms of the sequence with a starting value of 5 and the rule 'double and then subtract 3'.

f[x_]:=2 x+-3
NestList[f, 5,( 4)]//FullForm

2. Calculating effective interest rates

effectiverate[r_,n_]:=((((1+((r/n)/100)))^n)-1.)*100
NSolve[effectiverate["nominal rate (% p.a.)","Number of payment per year"]=="effective interest rate",Reals]//FullForm

Example Marissa has $10000 to invest.She chooses an account that will earn compounding interest at the rate of 4.5 % per annum, compounding monthly.Use a CAS calculator to find the effective rate for this investment, correct to three decimal places.

effectiverate[r_,n_]:=((((1+((r/n)/100)))^n)-1.)*100
NSolve[effectiverate[4.5,12]=="effective interest rate",Reals]//FullForm

The effective rate is 4.594 %

3. Financial Solver for Future Value and Regular Payment

a. Repayment for Interest Only Loan or Perpetuity. Recurrence Relation: (Subscript[V, 0])="Principal", (Subscript[V, n+1])="Common Ratio" *(Subscript[V, n]) - "Interest in dollars (Common Difference)"

repayment[prin_,r_,n_]:=((((r/n)))/100)prin
NSolve[repayment["Principal","Rate per annum","Number of payment per year"]=="Payment",Reals]//FullForm

b. Reduced Balance Loan or Annuity.  Recurrence Relation: (Subscript[V, 0])="Principal", (Subscript[V, n+1])="Common Ratio" *(Subscript[V, n]) - "Interest in dollars (Common Difference)"

futurevalue[prin_,r_,n_,t_,payt_]:=prin(((1+((((r/n)))/100)))^((n*t)))- payt*(((((((1+((((r/n)))/100)))^((n*t)))-1))/((((((r/n)))/100)))))
NSolve[futurevalue["Principal","Rate per annum","Number of payment per year","Time in YEARS","Payment"]==Future Value,Reals]//FullForm

c. Compound interest investments with regular additions to the principal (annuity investment).  Recurrence Relation: (Subscript[V, 0])="Principal", (Subscript[V, n+1])="Common Ratio" *(Subscript[V, n]) +  "Interest in dollars (Common Difference)"

futurevalue[prin_,r_,n_,t_,payt_]:=prin(((1+((((r/n)))/100)))^((n*t)))+ payt*(((((((1+((((r/n)))/100)))^((n*t)))-1))/((((((r/n)))/100)))))
NSolve[futurevalue["Principal","Rate per annum","Number of payment per year","Time in YEARS","Payment"]==Future Value,Reals]//FullForm

d. The final payment for Reduced Balance Loan or Annuity

finalpayment[prin_,r_,n_,t_,payt_]:=(prin(((1+((((r/n)))/100)))^((n*t)))- payt*(((((((1+((((r/n)))/100)))^((n*t)))-1))/((((((r/n)))/100))))))+(prin(((1+((((r/n)))/100)))^((n*t)))- payt*(((((((1+((((r/n)))/100)))^((n*t)))-1))/((((((r/n)))/100))))))*(((((r/n)))/100))
NSolve[finalpayment["Principal","Rate per annum","Number of payment per year","Time in years minus one payment","Payment"]=="The Final Payment",Reals]//FullForm

4. Amortisation Tables

a.To find Payment for Reduced Balance Loan or Annuity

l[0]="Principal";
rate="Annual interest rate"/100;
loanpayment="payment amount";
l[t_]:=l[t-1]*(1+(rate/"number of compounding periods per year"))-loanpayment;Grid[Partition[Flatten[Prepend[Table[{t,loanpayment,DecimalForm[(l[t-1]*(rate/"number of compounding periods per year".)),{∞,2}],DecimalForm[loanpayment-(l[t-1]*(rate/"number of compounding periods per year".)),{∞,2}],DecimalForm[l[t],{∞,2}]},{t,1,"number of payments"}],{"Payment\nnumber","Payment\namount","Interest\npaid","Principal\nreduction","Loan\nBalance"}]],5], Background -> {None,{{Yellow, None,None,None,None,None}}},Frame->True]

b.To find Payment for Compound interest investments with regular additions to the principal (annuity investment)

l[0]="Principal";
rate="Annual interest rate"/100;
loanpayment="payment amount";
l[t_]:=l[t-1]*(1+(rate/"number of compounding periods per year"))+loanpayment;Grid[Partition[Flatten[Prepend[Table[{t,loanpayment,DecimalForm[(l[t-1]*(rate/"number of compounding periods per year".)),{∞,2}],DecimalForm[loanpayment-(l[t-1]*(rate/"number of compounding periods per year".)),{∞,2}],DecimalForm[l[t],{∞,2}]},{t,1,"number of payments"}],{"Payment\nnumber","Payment\namount","Interest\npaid","Principal\nreduction","Loan\nBalance"}]],5], Background -> {None,{{Yellow, None,None,None,None,None}}},Frame->True]

l[0]=1000;
rate=5/100;
loanpayment=257.85;
l[t_]:=l[t-1]*(1+(rate/4))-loanpayment;Grid[Partition[Flatten[Prepend[Table[{t,loanpayment,DecimalForm[(l[t-1]*(rate/4.)),{∞,2}],DecimalForm[loanpayment-(l[t-1]*(rate/4.)),{∞,2}],DecimalForm[l[t],{∞,2}]},{t,1,4}],{"Payment\nnumber","Payment\namount","Interest\npaid","Principal\nreduction","Loan\nBalance"}]],5], Background -> {None,{{Yellow, None,None,None,None,None}}},Frame->True]

5. Finding the common ratio (R) given the percentage reduction

ratio[R_,r_]:=(1-(r/100))//N
NSolve[ratio["common ratio (R)","Rate"]=="common ratio (R)",Reals]

ratio[R_,r_]:=(1-(r/100))//N
NSolve[ratio[x,4]==x,Reals]

6. Finding the common ratio (R) given the percentage increase

ratio[R_,r_,p_]:=(1+(r/(100p)))//N
NSolve[ratio["common ratio (R)","Rate per annum","Number of payment per year"]=="common ratio (R)",Reals]

ratio[R_,r_,p_]:=(1+(r/(100p)))//N
NSolve[ratio["common ratio (R)",4,1]=="common ratio (R)",Reals]

7. Simple Interest

a. Finding interest in dollars ( Common difference) for  Simple Interest

difference[V0_,r_,p_,D_]:=(r/(100p))*V0//N
NSolve[difference["Principal","Rate per annum","Number of payment per year","Interest in dollars (Common Difference)"]=="Interest in dollars (Common Difference)",Reals]

b. Generate a table and graph of Simple Interest--Recurrence Relation (Subscript[V, 0])="Principal", (Subscript[V, n+1])= (Subscript[V, n])+ "Interest in dollars (Common Difference)". 
Explicit Rule: (Subscript[V, n])= "Principal"+ n *"Interest in dollars (Common Difference)"

f[x_]:=x+"Interest in dollars (Common Difference)"
NestList[f, "Principal",( "Number of payment per year"*"Time in YEARS")]
ListLinePlot[NestList[f, "Principal", ("Number of payment per year"*"Time in YEARS")]]

c. Explicit Rule Calculation for Simple Interest

nthvalue[V0_,r_,p_,n_]:=V0+n*p*(r/(100p))*V0
NSolve[nthvalue["Principal","Rate per annum","Number of payment per year","Time in YEARS"]==Future Value,Reals]

8. Compound Interest

a. Finding Common Ratio for  Compound Interest

ratio[R_,r_,p_]:=(1+(r/(100p)))//N
NSolve[ratio["common ratio (R)","Rate per annum","Number of payment per year"]=="common ratio (R)",Reals]

b. Generate a table and graph of Compound Interest--Recurrence Relation: (Subscript[V, 0])="Principal", (Subscript[V, n+1])="Common Ratio" *(Subscript[V, n]). 
Explicit Rule: (Subscript[V, n])= "Principal"* (("Common Ratio")^n)

f[x_]:="Common Ratio" x
NestList[f, "Principal",( "Number of payment per year"*"Time in YEARS")]
ListLinePlot[NestList[f, "Principal",( "Number of payment per year"*"Time in YEARS")]]

c. Explicit Rule Calculation for Compound Interest

nthvalue[V0_,r_,p_,n_]:=V0*(1+(r/(100p)))^(n*p)
NSolve[nthvalue["Principal","Rate per annum","Number of payment per year","Time in YEARS"]==Future Value,Reals]//FullForm

9. Flat Rate Depreciation

a. Finding depreciation value in dollars ( Common difference) for  Flat Rate Depreciation

difference[V0_,r_,p_,D_]:=(r/(100p))*V0//N
NSolve[difference["Initial Value","Rate per annum","Number of payment per year","Depreciation value (Common Difference)"]=="Depreciation value (Common Difference)",Reals]

b. Generate a table and graph of Flat Rate Depreciation--Recurrence Relation: (Subscript[V, 0])="Initial Value", (Subscript[V, n+1])=(Subscript[V, n]) - "Depreciation value (Common Difference)". 
Explicit Rule: (Subscript[V, n])= "Initial Value" - n x "Depreciation value (Common Difference)"

f[x_]:=x-"Depreciation value (Common Difference)"
NestList[f, "Initial Value",( "Number of payment per year"*"Time in YEARS")]
ListLinePlot[NestList[f, "Initial Value", ("Number of payment per year"*"Time in YEARS")]]

c. Explicit Rule Calculation for Flat Rate Depreciation

nthvalue[V0_,p_,n_,D_]:=V0-n*p*D
NSolve[nthvalue["Initial Value","Number of payment per year","Time in YEARS","Depreciation value (Common Difference)"]==Future Value,Reals]

10. Unit Cost Depreciation

a. Generate a table and graph of Unit Cost Depreciation--Recurrence Relation: (Subscript[V, 0])= "Initial Value", (Subscript[V, n+1])=(Subscript[V, n]) - "Depreciation Cost per unit in Dollars". 
Explicit Rule: (Subscript[V, n])= "Initial Value"  - n x "Depreciation Cost per unit in Dollars"

f[x_]:=x-"Depreciation Cost per unit in Dollars"
NestList[f, "Initial Value",( "Total units ( kilometres, pages, per thousand km etc)")]
ListLinePlot[NestList[f, "Initial Value", ("Total units ( kilometres, pages, per thousand km etc)")]]

b. Explicit Rule Calculation for Unit Cost Depreciation

nthvalue[V0_,n_,D_]:=V0-n*D
NSolve[nthvalue["Initial Value","Total units ( kilometres, pages, per thousand km etc)","Depreciation Cost per unit in Dollars"]==Future Value,Reals]

nthvalue[V0_,n_,D_]:=V0-n*D
NSolve[nthvalue[60000,"Total units ( kilometres, pages, per thousand km etc)",0.35]==15000,Reals]

11. Reduced Balance Depreciation

a. Finding Common Ratio for  Reduced Balance Depreciation

ratio[R_,r_,p_]:=(1-(r/(100p)))//N
NSolve[ratio["common ratio (R)","Rate per annum","Number of payment per year"]=="common ratio (R)",Reals]

b. Generate a table and graph of Reduced balance Depreciation--Recurrence Relation: (Subscript[V, 0])="Initial Value", (Subscript[V, n+1])="Common Ratio" *(Subscript[V, n]). 
Explicit Rule: (Subscript[V, n])= "Initial Value"* (("Common Ratio")^n)

f[x_]:="Common Ratio" x
NestList[f, "Initial Value",( "Number of payment per year"*"Time in YEARS")]
ListLinePlot[NestList[f, "Initial Value",( "Number of payment per year"*"Time in YEARS")]]

c. Explicit Rule Calculation for Reduced balance Depreciation

nthvalue[V0_,r_,p_,n_]:=V0*(1-(r/(100p)))^(n*p)
NSolve[nthvalue["Initial Value","Rate per annum","Number of payment per year","Time in YEARS"]==Future Value,Reals]//FullForm

12. New Final Payment,  Total payment and Total Interest for Reduced Balance Loan or Annuity

a. New Final payment for Reduced Balance Loan or Annuity.  Recurrence Relation: (Subscript[V, 0])="Principal", (Subscript[V, n+1])="Common Ratio" *(Subscript[V, n]) - "Interest in dollars (Common Difference)"

finalpayment[prin_,r_,n_,t_,payt_]:=(prin(((1+((((r/n)))/100)))^((n*(t-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(t-(1/n)))))-1))/((((((r/n)))/100))))))+(prin(((1+((((r/n)))/100)))^((n*(t-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(t-(1/n)))))-1))/((((((r/n)))/100))))))*(((((r/n)))/100))
NSolve[finalpayment["Principal","Rate per annum","Number of payment per year","Time in YEARS","Payment"]=="The Final Payment",Reals]//FullForm

b. Total payment for Reduced Balance Loan or Annuity.  Recurrence Relation: (Subscript[V, 0])="Principal", (Subscript[V, n+1])="Common Ratio" *(Subscript[V, n]) - "Interest in dollars (Common Difference)"

totalpayment[prin_,r_,n_,t_,payt_]:=payt*(n*t-1)+(prin(((1+((((r/n)))/100)))^((n*(t-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(t-(1/n)))))-1))/((((((r/n)))/100))))))+(prin(((1+((((r/n)))/100)))^((n*(t-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(t-(1/n)))))-1))/((((((r/n)))/100))))))*(((((r/n)))/100))
NSolve[totalpayment["Principal","Rate per annum","Number of payment per year","Time in YEARS","Payment"]=="The Total Payment",Reals]//FullForm

c. Total Interest  for Reduced Balance Loan or Annuity.  Recurrence Relation: (Subscript[V, 0])="Principal", (Subscript[V, n+1])="Common Ratio" *(Subscript[V, n]) - "Interest in dollars (Common Difference)"

totalinterest[prin_,r_,n_,t_,payt_]:=payt*(n*t-1)+(prin(((1+((((r/n)))/100)))^((n*(t-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(t-(1/n)))))-1))/((((((r/n)))/100))))))+(prin(((1+((((r/n)))/100)))^((n*(t-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(t-(1/n)))))-1))/((((((r/n)))/100))))))*(((((r/n)))/100))-prin
NSolve[totalinterest["Principal","Rate per annum","Number of payment per year","Time in YEARS","Payment"]=="The Total Interest in dollars",Reals]//FullForm

13. Total Interest for Partial time period of Reduced Balance Loan or Annuity

totalinterest[prin_,r_,n_,s_,t_,payt_]:=payt*(n*t-1)+(prin(((1+((((r/n)))/100)))^((n*(t-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(t-(1/n)))))-1))/((((((r/n)))/100))))))+(prin(((1+((((r/n)))/100)))^((n*(t-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(t-(1/n)))))-1))/((((((r/n)))/100))))))*(((((r/n)))/100))-(payt*(n*s-1)+(prin(((1+((((r/n)))/100)))^((n*(s-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(s-(1/n)))))-1))/((((((r/n)))/100))))))+(prin(((1+((((r/n)))/100)))^((n*(s-(1/n)))))- payt*(((((((1+((((r/n)))/100)))^((n*(s-(1/n)))))-1))/((((((r/n)))/100))))))*(((((r/n)))/100)))
NSolve[totalinterest["Principal","Rate per annum","Number of payment per year","Beginning of Time period in Years","Ending of Time period in Years","Payment"]=="The Total Interest in dollars",Reals]//FullForm