// Numbas version: exam_results_page_options {"name": "NPV test", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"test": {"templateType": "anything", "definition": "map([cashflows[x][0],separateThousands(cashflows[x][1],\",\")],x,0..holding_time)", "description": "", "group": "Ungrouped variables", "name": "test"}, "summation_str": {"templateType": "anything", "definition": "latex(join(map(dpformat(Cashflow_X_PV[x],0,\"en\"),x,0..holding_time),\" + \")+\" = \"+dpformat(sum(cashflow_X_PV),2,'en'))", "description": "", "group": "Ungrouped variables", "name": "summation_str"}, "cashflows_table_PV_CPV": {"templateType": "anything", "definition": "table(map([cashflows[x][0],dpformat(cashflows[x][1],0,\"en\"),'$'+latex('\\\\frac{ 1 }{ {(1 +' + sigformat(req_return_rate,2,\"en\") +')}\\^{'+x+'}}')+'$',precround(PV_facts[x],3),dpformat(Cashflow_X_PV[x],0,\"en\")],x,0..holding_time),[\"Year\",\"Projected Cashflow in \u00a3\",\"PV Calculation\",\"PV Factor\",\"Cashflow * PV factor\"])", "description": "", "group": "Ungrouped variables", "name": "cashflows_table_PV_CPV"}, "req_return_rate": {"templateType": "anything", "definition": "random(0.04..0.1#0.005)", "description": "", "group": "Ungrouped variables", "name": "req_return_rate"}, "answer": {"templateType": "anything", "definition": "sum(map(cashflows[x][1]/((1+req_return_rate)^cashflows[x][0]),x,0..holding_time))", "description": "

Main formula code

", "group": "Ungrouped variables", "name": "answer"}, "cashflows_table_PV_f": {"templateType": "anything", "definition": "table(map([cashflows[x][0],dpformat(cashflows[x][1],0,\"en\"),'$'+latex('\\\\frac{ 1 }{ {(1 +' + sigformat(req_return_rate,2,\"en\") +')}\\^{'+x+'}}')+'$',precround(PV_facts[x],3)],x,0..holding_time),[\"Year\",\"Projected Cashflow in \u00a3\",\"PV Calculation\",\"PV Factor\"])", "description": "

cashflow_table with present value factors and calculations in latex

", "group": "Ungrouped variables", "name": "cashflows_table_PV_f"}, "cashflows_table": {"templateType": "anything", "definition": "table(map([cashflows[x][0],dpformat(cashflows[x][1],0,\"en\")],x,0..holding_time),[\"Year\",\"Projected Cashflow in \u00a3\"])", "description": "", "group": "Ungrouped variables", "name": "cashflows_table"}, "req_return_rate_perc": {"templateType": "anything", "definition": "100*req_return_rate", "description": "", "group": "Ungrouped variables", "name": "req_return_rate_perc"}, "Cashflow_X_PV": {"templateType": "anything", "definition": "map(PV_facts[x]*cashflows[x][1],x,0..holding_time)", "description": "", "group": "Ungrouped variables", "name": "Cashflow_X_PV"}, "holding_time": {"templateType": "anything", "definition": "random(3..5#1)", "description": "

Holding time for asset in years

", "group": "Ungrouped variables", "name": "holding_time"}, "asset_price": {"templateType": "anything", "definition": "random(1000000..30000000#1000000)", "description": "", "group": "Ungrouped variables", "name": "asset_price"}, "cashflows": {"templateType": "anything", "definition": "let(cflows,[[0,-1*asset_price]]+zip(list(1..holding_time#1), repeat(siground(asset_price*random((req_return_rate * (1-r_cashflow_const))..(req_return_rate * (1+r_cashflow_const))#0.01),2),holding_time)), cflows[0..holding_time]+[[cflows[holding_time][0],cflows[holding_time][1]+asset_price]])", "description": "", "group": "Ungrouped variables", "name": "cashflows"}, "r_cashflow_const": {"templateType": "anything", "definition": "random(0.1..0.3#0.01)", "description": "

Determines how variable the randomly generated cashflows are.

", "group": "Ungrouped variables", "name": "r_cashflow_const"}, "PV_facts": {"templateType": "anything", "definition": "map(1/((1+req_return_rate)^x),x,0..holding_time)", "description": "", "group": "Ungrouped variables", "name": "PV_facts"}}, "statement": "

Calculate the NPV (net present value) for the following property asset to 3 significant figures:

", "parts": [{"notationStyles": ["plain", "en", "si-en"], "minValue": "answer", "strictPrecision": true, "type": "numberentry", "precisionPartialCredit": "50", "correctAnswerFraction": false, "prompt": "

Asset price: £{formatnumber(asset_price,\"en\")}

\n

Required Rate of Return: {req_return_rate*100}%

\n

Holding time: {holding_time} years

\n

\n
\n

{cashflows_table}

\n
", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "showFeedbackIcon": true, "scripts": {}, "showCorrectAnswer": true, "precisionType": "sigfig", "precisionMessage": "You have not given your answer to the correct precision.", "mustBeReducedPC": 0, "maxValue": "answer", "precision": "3", "mustBeReduced": false, "correctAnswerStyle": "plain", "marks": 1, "showPrecisionHint": true, "allowFractions": false}], "metadata": {"licence": "All rights reserved", "description": "

Calculate the net present value for the following property assets:

"}, "variablesTest": {"maxRuns": 100, "condition": ""}, "tags": [], "extensions": [], "functions": {}, "preamble": {"css": "table {\n border: 1px solid black;\n\n}\ntr:hover {background-color: rgb(218, 232, 241)}\ntd {border-left: 1px solid black;}\nth{border: 1px solid black;}", "js": ""}, "variable_groups": [], "advice": "

The complete formula for calculating NPV is:

\n

\\[\\textrm{Net Present Value} = \\sum _{ n=0 }^{ N }{ \\frac {{C}_{n}}{{(1+r)}^{n}} } \\]

\n

Where $C_n$ is the cashflow for the current year, $r$ is the required rate of return in decimal form, $n$ is the current year and $N$ is the number of years the asset is to be held for.

\n

\n

Let's break it down...

\n

Convert the required rate of return to a decimal:

\n

\\[\\textrm{Required Return Rate} = \\frac{\\var{req_return_rate_perc}\\%}{100\\%}\\]

\n

\\[=\\var{req_return_rate}\\]

\n

\n

Then, calculate the present value factor for each year:

\n

At the start of the first year, the asset is bought so the cashflow is minus the asset price. In the last year, the asset is sold, resulting in a large increase in cashflow.

\n

\\[{\\textrm{PV factor} = \\frac { 1 }{ { (1+r) }^{ n } } }\\]

\n

\n

{cashflows_table_PV_f}

\n

\n

Next, we must multiply the cashflow for each year by the corresponding PV factor:

\n

\n

\\[\\textrm{Cashflow} \\cdot \\textrm{PV Factor} ={C}_{n} \\cdot \\frac{1}{{(1+r)}^{n}}\\]

\n

\n

{cashflows_table_PV_CPV}

\n

\n

Finally, to finish using the formula, we need to add up all of the $(\\textrm{Cashflow} \\cdot \\textrm{PV Factor})$ values to get the net present value (NPV):

\n

\n

\\[\\textrm{Net Present Value} = \\sum _{ n=0 }^{ N }{ {(\\textrm{Cashflow} \\cdot \\textrm{PV Factor})}_{n} } \\]

\n

\n

\\[\\var{summation_str}\\]

\n

\n

Which is £{sigformat(sum(Cashflow_X_PV),3,\"en\")} to 3 significant figures. 

\n

\n

\n

\n

\n

", "rulesets": {"": []}, "name": "NPV test", "ungrouped_variables": ["asset_price", "req_return_rate", "holding_time", "cashflows", "r_cashflow_const", "answer", "cashflows_table", "test", "cashflows_table_PV_f", "PV_facts", "req_return_rate_perc", "cashflows_table_PV_CPV", "summation_str", "Cashflow_X_PV"], "type": "question", "contributors": [{"name": "Rory Shanahan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1513/"}]}]}], "contributors": [{"name": "Rory Shanahan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1513/"}]}