// Numbas version: exam_results_page_options {"name": "number of time periods - ordinary annuity", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"preamble": {"css": "", "js": ""}, "advice": "

You are asked to find the number of time periods of an ordinary annuit (since the payments are at the end of each period) and we are given the present value of the annuity. Therefore we will use the present value of an ordinary annuity formula

\n

$\\displaystyle P=\\frac{C}{i}\\left(1-\\frac{1}{(1+i)^n}\\right)$

\n

where $P$ is the present value, $C$ is the cash flow per period, $i$ is the interest rate per period, and $n$ is the number of periods.

\n

In our situation we have,

\n

$P=\\var{P}$,

\n

$C=\\var{C}$,

\n

$i=\\frac{\\var{ipa}\\%}{\\var{period}}=\\frac{\\var{ipadec}}{\\var{period}}$,

\n

and therefore we have

\n

$\\displaystyle \\var{P}=\\frac{\\var{C}}{\\left(\\simplify[unitDenominator]{{ipadec}/{period}}\\right)}\\left(1-\\frac{1}{\\left(1+\\simplify[unitDenominator]{{ipadec}/{period}}\\right)^n}\\right)$

\n

which we need to rearrange to solve for $n$. Note there are various methods that could be used, the following is one approach that uses the most basic operations and logs. Alternatively, you could use a faster, more sophisticated approach using negative powers or reciprocals.

\n

\n

We want to get $n$ by itself. We start by multiplying both sides by $\\left(\\simplify[unitDenominator]{{ipadec}/{period}}\\right)$ (to remove the division by it on the right hand side)

\n

$\\displaystyle \\var{P}\\left(\\simplify[unitDenominator]{{ipadec}/{period}}\\right)=\\var{C}\\left(1-\\frac{1}{\\left(1+\\simplify[unitDenominator]{{ipadec}/{period}}\\right)^n}\\right)$

\n

Now we will divide both sides by $\\var{C}$ (to remove the multiplication by it on the right hand side)

\n

$\\displaystyle \\frac{\\var{P}}{\\var{C}}\\left(\\simplify[unitDenominator]{{ipadec}/{period}}\\right)=\\left(1-\\frac{1}{\\left(1+\\simplify[unitDenominator]{{ipadec}/{period}}\\right)^n}\\right)$

\n

\n

Tidying this up a bit (including using a calculator) we have

\n

$\\displaystyle \\frac{\\var{nnum}}{\\var{nden}}=1-\\frac{1}{\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n}$

\n

We add $\\displaystyle\\frac{1}{\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n}$ to both sides

\n

$\\displaystyle \\frac{\\var{nnum}}{\\var{nden}}+\\frac{1}{\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n}=1$

\n

Then subtract $\\displaystyle \\frac{\\var{nnum}}{\\var{nden}}$ from both sides

\n

$\\displaystyle \\frac{1}{\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n}=1-\\frac{\\var{nnum}}{\\var{nden}}$

\n

Tidying this up we get

\n

$\\displaystyle \\frac{1}{\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n}=\\frac{\\var{compnum}}{\\var{nden}}$

\n

We multiply both sides by $\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n$ so that the $n$ is not on the bottom of the fraction

\n

$\\displaystyle 1=\\frac{\\var{compnum}}{\\var{nden}}{\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n}$

\n

Now multiply both sides by $\\var{nden}$ to remove the division by it

\n

$\\displaystyle \\var{nden}=\\var{compnum}\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n$

\n

Now divide both sides by $\\var{compnum}$ to remove the multiplication by it

\n

$\\displaystyle \\frac{\\var{nden}}{\\var{compnum}}=\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n$

\n

Now we take the log of both sides

\n

$\\displaystyle \\log\\left(\\frac{\\var{nden}}{\\var{compnum}}\\right)=\\log\\left(\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)^n\\right)$

\n

In order to apply the log law that allows us to bring the power, $n$, down (that is, $\\log(x^n)=n\\log(x)$)

\n

$\\displaystyle \\log\\left(\\frac{\\var{nden}}{\\var{compnum}}\\right)=n\\log\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)$

\n

Finally, we divide both sides by $\\log\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)$ to get $n$ by itself

\n

$\\displaystyle \\frac{\\log\\left(\\frac{\\var{nden}}{\\var{compnum}}\\right)}{\\log\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)}=n$

\n

\n

Calculating this we find

\n

$n\\approx \\var{n}$

\n

but we don't round this in the traditional sense since if we rounded down we wouldn't have paid off the entire loan, therefore we always round up to the nearest whole number.

\n

That is, we need to wait $\\var{nrounded}$ time periods.

", "name": "number of time periods - ordinary annuity", "rulesets": {}, "parts": [{"prompt": "

Suppose you borrow $\\$\\var{P}$to buy a house and you make {period} repayments of$\\$\\var{C}$ at the end of each {period}. Interest is $\\var{ipa}\\%$ per annum compounding {period}. Calculate how many {period+'s'} it will take to pay off the loan.

\n

\n

[] {period+'s'}

", "sortAnswers": false, "unitTests": [], "type": "gapfill", "useCustomName": false, "scripts": {}, "extendBaseMarkingAlgorithm": true, "gaps": [{"showFractionHint": true, "maxValue": "nrounded", "allowFractions": false, "correctAnswerFraction": false, "unitTests": [], "type": "numberentry", "useCustomName": false, "mustBeReducedPC": 0, "minValue": "nrounded", "scripts": {}, "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacements": [], "correctAnswerStyle": "plain", "mustBeReduced": false, "showCorrectAnswer": true, "customName": "", "marks": 1}], "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacements": [], "showCorrectAnswer": true, "customName": "", "marks": 0}], "ungrouped_variables": ["period", "ipadec", "ipa", "P", "nseed", "C", "Rnum", "Rden", "Rcf", "nRnum", "nRden", "num", "den", "cf", "nnum", "nden", "compnum", "n", "nrounded"], "tags": [], "extensions": [], "variable_groups": [], "variables": {"nRnum": {"description": "", "templateType": "anything", "name": "nRnum", "definition": "Rnum/Rcf", "group": "Ungrouped variables"}, "nRden": {"description": "", "templateType": "anything", "name": "nRden", "definition": "Rden/Rcf", "group": "Ungrouped variables"}, "Rnum": {"description": "", "templateType": "anything", "name": "Rnum", "definition": "10000*period+ipa*100", "group": "Ungrouped variables"}, "den": {"description": "", "templateType": "anything", "name": "den", "definition": "precround(C*10000*period,0)", "group": "Ungrouped variables"}, "Rden": {"description": "", "templateType": "anything", "name": "Rden", "definition": "10000*period", "group": "Ungrouped variables"}, "Rcf": {"description": "", "templateType": "anything", "name": "Rcf", "definition": "gcd(Rnum,Rden)", "group": "Ungrouped variables"}, "cf": {"description": "", "templateType": "anything", "name": "cf", "definition": "gcd(num,den)", "group": "Ungrouped variables"}, "C": {"description": "", "templateType": "anything", "name": "C", "definition": "tonearest(P*(ipadec/period)/(1-1/(1+ipadec/period)^nseed),25)", "group": "Ungrouped variables"}, "num": {"description": "", "templateType": "anything", "name": "num", "definition": "precround(P*ipa*100,0)", "group": "Ungrouped variables"}, "n": {"description": "

\\frac{\\log\\left(\\frac{\\var{nden}}{\\var{compnum}}\\right)}{\\log\\left(\\frac{\\var{nRnum}}{\\var{nRden}}\\right)

\n