// Numbas version: exam_results_page_options {"name": "Budget minimization for a given Stone-Geary utility function", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Budget minimization for a given Stone-Geary utility function", "tags": [], "metadata": {"description": "You need to minimize the budget spent on two products for a given Stone-Geary utitility value.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "

An individual has as utility function
\\[ U(q_1,q_2)={\\var{c1}} \\cdot(q_1-{\\var{a1}})^{{1}/{\\var{n1}}} \\cdot   (q_2-{\\var{a2}})^   {{\\var{n1min1}}/{\\var{n1}}}\\]

\n

where $q_1$ and $q_2$ denote the quantities consumed of respectively the products  1 and 2.
The unit prices for this products are respectively  $p_1 = \\var{p1}$ and $p_2 = \\var{p2}$.
Minimize the budget which is completely spent by this individual on these products when the utility level equals {u}.

", "advice": "

Step 1: Formulate the corresponding minimum problem using the utility restriction.
\\begin{eqnarray}
\\min_{q_1,q_2} \\var{p1} \\cdot q_1 + \\var{p2} \\cdot q_2  \\\\
\\mbox{ if    } \\quad U(q_1,q_2) &=& {\\var{u}} \\\\
\\mbox{i.e. if   } \\quad {\\var{u}}&=& {\\var{c1}} \\cdot (q_1-{\\var{a1}})^{1 / {\\var{n1}}}  \\cdot (q_2-{\\var{a2}})^{{\\var{n1min1}} / {\\var{n1}}}
\\end{eqnarray}
which is equivaltent with
\\begin{eqnarray}
\\min_{q_1,q_2} \\var{p1} \\cdot q_1 + \\var{p2} \\cdot q_2  \\\\
\\mbox{ if } \\quad \\ln \\, U(q_1,q_2) &=& \\ln {\\var{u}}\\\\
\\mbox{i.e. if } \\quad {\\ln {\\var{u}}} &=& \\ln {\\var{c1}} + {\\frac{1}{\\var{n1}}} \\cdot \\ln {(q_1-{\\var{a1}})} + {\\frac{\\var{n1min1}}{\\var{n1}}} \\cdot \\ln {(q_2-{\\var{a2}})}
\\end{eqnarray}

\n


Step 2: Write down the corresponding Lagrange function for this constrained minimum problem.
\\begin{eqnarray}
L(q_1, q_2, \\lambda) &=& \\var{p1} \\cdot q_1 + \\var{p2} \\cdot q_2  + \\lambda \\cdot \\left( {\\ln {\\var{u}}} - \\ln U(q_1,q_2)\\right)    \\\\
&=& \\var{p1} \\cdot q_1 + \\var{p2} \\cdot q_2  + \\lambda \\cdot \\left( {\\ln {\\var{u}}} - \\ln {\\var{c1}} - {\\frac{1}{\\var{n1}}} \\cdot \\ln {(q_1-{\\var{a1}})} - {\\frac{\\var{n1min1}}{\\var{n1}}} \\cdot \\ln {(q_2-{\\var{a2}})}   \\right) 
\\end{eqnarray}

\n

Step 3: Determine the first order conditions in order to calculate critical points of the Lagrangian.
\\begin{eqnarray}
\\mbox{(1) } \\quad \\frac{\\partial {L}}{\\partial q_1} & = & \\var{p1} - \\lambda \\cdot {\\frac{1}{\\var{n1}}} \\cdot  {\\frac {1} {q_1-{\\var{a1}}} }  = 0 \\\\
\\mbox{(2) } \\quad \\frac{\\partial {L}}{\\partial q_2} & = & \\var{p2}   -  \\lambda \\cdot {\\frac{\\var{n1min1}}{\\var{n1}}} \\cdot {\\frac {1} {q_2-{\\var{a2}}}} = 0 \\\\
\\mbox{(3) } \\quad \\frac{\\partial {L}}{\\partial \\lambda} & = & {\\ln {\\var{u}}} - \\ln {\\var{c1}} - {\\frac{1}{\\var{n1}}} \\cdot \\ln {(q_1-{\\var{a1}})} - {\\frac{\\var{n1min1}}{\\var{n1}}} \\cdot \\ln {(q_2-{\\var{a2}})} = 0
\\end{eqnarray}

\n

Step 4: Find the solution of this system of equations in $q_1$, $q_2$ and $\\lambda$.
Solving $\\lambda$ from the equations (1) and (2) leads to
\\begin{eqnarray}
\\frac{\\var{p1}}{{\\frac{1}{\\var{n1}}} \\cdot  {\\frac {1} {q_1-{\\var{a1}}} } } & = & \\frac{\\var{p2}}{{\\frac{\\var{n1min1}}{\\var{n1}}} \\cdot {\\frac {1} {q_2-\\var{a2}}}} \\\\
\\var{p1} \\cdot \\var{n1min1} \\cdot {(q_1-{\\var{a1}})} &=& \\var{p2} \\cdot {(q_2-{\\var{a2}})} \\\\
\\mbox{(4)} \\quad \\quad \\quad \\quad \\quad \\quad  \\quad \\quad \\quad   q_2-\\var{a2} &=&  q_1-\\var{a1}
\\end{eqnarray}
i.e.
\\[ \\simplify{q_2 =  q_1 + {a2-a1}} \\]
Since (3) is equivalent to
\\[ {\\var{u}} = {\\var{c1}} \\cdot (q_1-{\\var{a1}})^{1 / {\\var{n1}}}  \\cdot (q_2-{\\var{a2}})^{{\\var{n1min1}} / {\\var{n1}}} \\]
we can substitute equation (4) in the given utility restricion:
\\begin{eqnarray}
\\var{u} &=& \\var{c1} \\cdot (q_1-\\var{a1}) \\\\
q^*_1 &=& \\var{a1+v}
\\end{eqnarray}
Substitution of this $q_1-$ value in (4) gives us the optimal value of $q_2$ :
\\begin{eqnarray}
{q^*_2} & = & \\var{q2}
\\end{eqnarray}

Answer.

\n

For
\\begin{eqnarray}
 q^*_1&=&\\var{q1} \\\\
 q^*_2&=&\\var{q2}
\\end{eqnarray}
we find the minimal value of the budget:
\\[ \\var{p1} \\cdot q^*_1 + \\var{p2} \\cdot q^*_2 = \\var{ybud}. \\]

\n

\n

{toonfig()}

", "rulesets": {}, "extensions": ["jsxgraph"], "variables": {"n1": {"name": "n1", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "templateType": "anything"}, "u": {"name": "u", "group": "Ungrouped variables", "definition": "v*c1", "description": "", "templateType": "anything"}, "t1": {"name": "t1", "group": "Ungrouped variables", "definition": "1", "description": "", "templateType": "anything"}, "cu": {"name": "cu", "group": "Ungrouped variables", "definition": "u^(n1/t2)*((c1)^(-n1/t2))", "description": "", "templateType": "anything"}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "templateType": "anything"}, "c1": {"name": "c1", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "

c1

", "templateType": "anything"}, "t2": {"name": "t2", "group": "Ungrouped variables", "definition": "n1-1", "description": "", "templateType": "anything"}, "ydeelp2": {"name": "ydeelp2", "group": "Ungrouped variables", "definition": "ybud/p2", "description": "", "templateType": "anything"}, "a2": {"name": "a2", "group": "Ungrouped variables", "definition": "random(4..10)", "description": "", "templateType": "anything"}, "a1": {"name": "a1", "group": "Ungrouped variables", "definition": "random(4..10)", "description": "", "templateType": "anything"}, "s": {"name": "s", "group": "Ungrouped variables", "definition": "1/(n1-1)", "description": "", "templateType": "anything"}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "gegp1", "description": "", "templateType": "anything"}, "ymindeelp1": {"name": "ymindeelp1", "group": "Ungrouped variables", "definition": "ybmin/p1", "description": "", "templateType": "anything"}, "gegp1": {"name": "gegp1", "group": "Ungrouped variables", "definition": "random(2..15)", "description": "", "templateType": "anything"}, "q1": {"name": "q1", "group": "Ungrouped variables", "definition": "a1+w", "description": "", "templateType": "anything"}, "ybud": {"name": "ybud", "group": "Ungrouped variables", "definition": "gegp1*q1+p2*q2", "description": "", "templateType": "anything"}, "p2": {"name": "p2", "group": "Ungrouped variables", "definition": "(n1-1)*p1", "description": "", "templateType": "anything"}, "w": {"name": "w", "group": "Ungrouped variables", "definition": "v", "description": "", "templateType": "anything"}, "ymaxdeelp2": {"name": "ymaxdeelp2", "group": "Ungrouped variables", "definition": "ybmax/p2", "description": "", "templateType": "anything"}, "q2": {"name": "q2", "group": "Ungrouped variables", "definition": "a2+w", "description": "", "templateType": "anything"}, "ybmin": {"name": "ybmin", "group": "Ungrouped variables", "definition": "1/2*ybud", "description": "", "templateType": "anything"}, "n1min1": {"name": "n1min1", "group": "Ungrouped variables", "definition": "n1-1", "description": "", "templateType": "anything"}, "ymindeelp2": {"name": "ymindeelp2", "group": "Ungrouped variables", "definition": "ybmin/p2", "description": "", "templateType": "anything"}, "ymaxdeelp1": {"name": "ymaxdeelp1", "group": "Ungrouped variables", "definition": "ybmax/p1", "description": "", "templateType": "anything"}, "ydeelp1": {"name": "ydeelp1", "group": "Ungrouped variables", "definition": "ybud/p1", "description": "", "templateType": "anything"}, "nutfinaal": {"name": "nutfinaal", "group": "Ungrouped variables", "definition": "c1*(q1-a1)^((t1)/(n1))*(q2-a2)^((t2)/(n2))", "description": "", "templateType": "anything"}, "n2": {"name": "n2", "group": "Ungrouped variables", "definition": "n1", "description": "", "templateType": "anything"}, "ybmax": {"name": "ybmax", "group": "Ungrouped variables", "definition": "3/2*ybud", "description": "", "templateType": "anything"}, "yb1": {"name": "yb1", "group": "Ungrouped variables", "definition": "ybud/p1", "description": "", "templateType": "anything"}, "yb2": {"name": "yb2", "group": "Ungrouped variables", "definition": "ybud/p2", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["n1", "v", "c1", "u", "a1", "a2", "t1", "t2", "w", "q1", "q2", "gegp1", "ybud", "n1min1", "n2", "p1", "p2", "nutfinaal", "ybmin", "ybmax", "cu", "ydeelp2", "ydeelp1", "s", "ymindeelp2", "ymaxdeelp2", "ymindeelp1", "ymaxdeelp1", "yb1", "yb2"], "variable_groups": [], "functions": {"toonfig": {"parameters": [], "type": "html", "language": "javascript", "definition": "//variables\nvar c1 = Numbas.jme.unwrapValue(scope.variables.c1);\nvar n1 = Numbas.jme.unwrapValue(scope.variables.n1);\nvar t2 = Numbas.jme.unwrapValue(scope.variables.t2);\nvar q1 = Numbas.jme.unwrapValue(scope.variables.q1);\nvar q2 = Numbas.jme.unwrapValue(scope.variables.q2);\nvar u = Numbas.jme.unwrapValue(scope.variables.u);\nvar a1 = Numbas.jme.unwrapValue(scope.variables.a1);\nvar a2 = Numbas.jme.unwrapValue(scope.variables.a2);\nvar ybmin = Numbas.jme.unwrapValue(scope.variables.ybmin);\nvar ybmax = Numbas.jme.unwrapValue(scope.variables.ybmax);\nvar yi = Numbas.jme.unwrapValue(scope.variables.ybmin);\nvar ya = Numbas.jme.unwrapValue(scope.variables.ybmax);\nvar cu = Numbas.jme.unwrapValue(scope.variables.cu);\nvar v = Numbas.jme.unwrapValue(scope.variables.v);\nvar ybud = Numbas.jme.unwrapValue(scope.variables.ybud);\nvar p1 = Numbas.jme.unwrapValue(scope.variables.p1);\nvar p2 = Numbas.jme.unwrapValue(scope.variables.p2);\nvar ydeelp2 = Numbas.jme.unwrapValue(scope.variables.ydeelp2);\nvar ydeelp1 = Numbas.jme.unwrapValue(scope.variables.ydeelp1);\nvar ymindeelp2 = Numbas.jme.unwrapValue(scope.variables.ymindeelp2);\nvar ymindeelp1 = Numbas.jme.unwrapValue(scope.variables.ymindeelp1);\nvar ymaxdeelp2 = Numbas.jme.unwrapValue(scope.variables.ymaxdeelp2);\nvar ymaxdeelp1 = Numbas.jme.unwrapValue(scope.variables.ymaxdeelp1);\nvar s = Numbas.jme.unwrapValue(scope.variables.s);\nvar yb1 = Numbas.jme.unwrapValue(scope.variables.yb1);\nvar yb2 = Numbas.jme.unwrapValue(scope.variables.yb2);\n//make board\nvar result = Numbas.extensions.jsxgraph.makeBoardPromise('400px','400px',\n{boundingBox:[-q1,2*q2,4*q1,-q2],grid: false,axis:false, keepaspectratio:false});\n// boundingbox:[left, top, right, bottom]\n\nresult.promise.then(function(board) {\n xaxis = board.create('axis', [[0, 0], [1,0]], \n\t {name:'q1', \n\t\t\twithLabel: true, \n\t\t\tlabel: {position: 'rt', // possible values are 'lft', 'rt', 'top', 'bot'\n\t\t\t\t\t offset: [0, 20] // (in pixels)\n\t\t\t\t\t }\n\t\t\t});\n yaxis = board.create('axis', [[0, 0], [0, 1]], \n\t\t {name:'q2', \n\t\t\twithLabel: true, \n\t\t\tlabel: {\n\t\t\t position: 'rt', // possible values are 'lft', 'rt', 'top', 'bot'\n\t\t\t offset: [-20, 0] // (in pixels)\n\t\t\t\t}\n\t\t\t});\nxaxis.removeAllTicks();\nyaxis.removeAllTicks(); \n\nvar grafiek2 = board.create('functiongraph', \n [function(x){ return a2+cu*Math.pow(x-a1,-1/t2) ;} ,a1,4*q1],\n {strokeColor:\"red\",setLabelText:'nut',visible: true, strokeWidth: 4, highlightStrokeColor: 'red'} \n );\n \nvar grafiek = board.create('functiongraph', \n [function(x){ return ybud/p2-p1/p2*x; }, 0, ybud/p1],\n {strokeColor:\"green\",setLabelText:'niveau',visible: true, strokeWidth: 4, highlightStrokeColor: 'green'} \n ); \t\n\nvar grafieklager = board.create('functiongraph', \n [function(x){ return (ybud/2)/p2-p1/p2*x; }, 0, (ybud/2)/p1],\n {strokeColor:\"green\",setLabelText:'niveau',visible: true, dash:2, strokeWidth: 2, highlightStrokeColor: 'green'} \n );\n \n var grafiekhoger = board.create('functiongraph', \n [function(x){ return (ybud*3/2)/p2-p1/p2*x; }, 0, (ybud*3/2)/p1],\n {strokeColor:\"green\",setLabelText:'niveau',visible: true, dash:2, strokeWidth: 2, highlightStrokeColor: 'green'} \n );\n\nvar punt = board.create('point', [q1, q2],{name:''});\npunt.setAttribute({fixed:true});\n \n});\n\nreturn result.element;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the optimal value of $q_1$:

", "minValue": "q1", "maxValue": "q1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the optimal value of $q_2$:

", "minValue": "q2", "maxValue": "q2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Paul Verheyen", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3610/"}]}]}], "contributors": [{"name": "Paul Verheyen", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3610/"}]}