// Numbas version: finer_feedback_settings {"name": "number of time periods - compound interest (annual only)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": [], "parts": [{"showCorrectAnswer": true, "customMarkingAlgorithm": "", "gaps": [{"correctAnswerFraction": false, "maxValue": "nrounded", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "minValue": "nrounded", "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "showFractionHint": true, "variableReplacements": [], "showFeedbackIcon": true, "unitTests": [], "mustBeReducedPC": 0, "customName": "", "scripts": {}, "extendBaseMarkingAlgorithm": true, "useCustomName": false, "marks": 1, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "allowFractions": false}], "type": "gapfill", "variableReplacements": [], "showFeedbackIcon": true, "unitTests": [], "customName": "", "prompt": "

You deposit $\\$\\var{P}$ into a bank account with an interest rate of $\\var{ipa}\\%$ per annum compounded {period[0]}. How many years will it take for the balance to be at least $\\$\\var{S}$? 

\n

\n

[[0]] years

", "scripts": {}, "extendBaseMarkingAlgorithm": true, "useCustomName": false, "marks": 0, "variableReplacementStrategy": "originalfirst", "sortAnswers": false}], "extensions": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"n": {"description": "", "name": "n", "templateType": "anything", "group": "Ungrouped variables", "definition": "log(S/P)/log(1+ippdec)"}, "S": {"description": "", "name": "S", "templateType": "anything", "group": "Ungrouped variables", "definition": "ceil(P+random(0.3..1#0.05)*P)"}, "ipadec": {"description": "", "name": "ipadec", "templateType": "anything", "group": "Ungrouped variables", "definition": "ipa/100"}, "nrounded": {"description": "", "name": "nrounded", "templateType": "anything", "group": "Ungrouped variables", "definition": "ceil(n)"}, "P": {"description": "

present value

", "name": "P", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(1000..100000#1000)"}, "test": {"description": "", "name": "test", "templateType": "anything", "group": "Ungrouped variables", "definition": "P*(1+ipadec/period[1])^(n)"}, "years": {"description": "", "name": "years", "templateType": "anything", "group": "Ungrouped variables", "definition": "n/period[1]"}, "period": {"description": "", "name": "period", "templateType": "anything", "group": "Ungrouped variables", "definition": "[random('yearly','annually'),1]"}, "ipa": {"description": "

\\var{period[2]}\\left(\\left(\\frac{\\var{S}}{\\var{P}}\\right)^{\\frac{1}{\\var{n}}}-1\\right)

", "name": "ipa", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..7#0.1)"}, "ippdec": {"description": "", "name": "ippdec", "templateType": "anything", "group": "Ungrouped variables", "definition": "ipadec/period[1]"}}, "variable_groups": [], "functions": {}, "metadata": {"description": "Using interest compounded yearly determine the interest rate", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "ungrouped_variables": ["P", "S", "years", "period", "ipa", "ipadec", "ippdec", "test", "n", "nrounded"], "statement": "

If you are unsure of how to do a question, click on Reveal answers to see the full working. Then, once you understand how to do the question, click on Try another question like this one to start again. Do each question repeatedly to ensure you have mastered it.

", "rulesets": {}, "advice": "

We are asked to find the number of time periods using compound interest. Therefore we will use the compound interest equation

\n

$S=P(1+i)^n$,

\n

where $S$ is the future value, $P$ is the present value, $i$ is the interest rate per time period and $n$ is the number of time periods.

\n

In our situation we have, 

\n

$S=\\var{S}$

\n

$P=\\var{P}$,

\n

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

\n

and therefore we have

\n

$\\var{S}=\\var{P}\\left(1+\\var{ipadec}\\right)^n$,

\n

which we need to rearrange to solve for $n$.

\n

\n

We want to get $n$ by itself. We start by dividing both sides by $\\var{P}$ (to remove the multiplication by $\\var{P}$)

\n

$\\displaystyle \\frac{\\var{S}}{\\var{P}}=\\left(1+\\var{ipadec}\\right)^n$.

\n

Now, notice that $n$ is a power. To work out what $n$ is we will need to bring it down, in order to do this we apply $\\log$ to both sides

\n

$\\displaystyle \\log\\left(\\frac{\\var{S}}{\\var{P}}\\right)=\\log\\left(\\left(1+\\var{ipadec}\\right)^n\\right)$.

\n

We do this in order to apply the log law $\\log(x^n)=n\\log(x)$ which allows us to bring the power down

\n

$\\displaystyle \\log\\left(\\frac{\\var{S}}{\\var{P}}\\right)=n\\log\\left(1+\\var{ipadec}\\right)$.

\n

Notice that on the right hand side, $n$ is now multiplied by $\\log\\left(1+\\var{ipadec}\\right)$. Since we want $n$ by itself, we divide both sides by $\\log\\left(1+\\var{ipadec}\\right)$

\n

$\\displaystyle \\frac{\\log\\left(\\frac{\\var{S}}{\\var{P}}\\right)}{\\log\\left(1+\\var{ipadec}\\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 we require an entire time period to elapse for the interest to be paid, therefore we always round up to the nearest whole number.

\n

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

", "preamble": {"js": "", "css": ""}, "name": "number of time periods - compound interest (annual only)", "type": "question", "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}]}