// Numbas version: finer_feedback_settings
{"name": "Stone-Geary utility maximization for a given budget", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Stone-Geary utility maximization for a given budget", "tags": [], "metadata": {"description": "You need to maximize a Stone-Geary utility function when given the prices for two products and the available budget.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "
Step 1: Formulate the corresponding maximum problem using the budget restriction.
\\begin{eqnarray}
\\max_{q_1,q_2} U(q_1,q_2) &=& {\\var{c1}} \\cdot (q_1-{\\var{a1}})^{1 / {\\var{n1}}} \\cdot (q_2-{\\var{a2}})^{{\\var{n1min1}} / {\\var{n1}}}
\\mbox{ if } && \\var{p1} \\cdot q_1 + \\var{p2} \\cdot q_2 = \\var{y}
\\end{eqnarray}
or equivalently
\\begin{eqnarray}
\\max_{q_1,q_2} ln U(q_1,q_2) &=& ln({\\var{c1}}) + {\\frac{1}{\\var{n1}}} \\cdot ln(q_1-{\\var{a1}}) + {\\frac{\\var{n1min1}}{\\var{n1}}} \\cdot ln(q_2-{\\var{a2}}) \\\\
\\mbox{ if } && \\var{p1} \\cdot q_1 + \\var{p2} \\cdot q_2 = \\var{y}
\\end{eqnarray}
Step 2: Write down the corresponding Lagrange function for this constrained maximum problem.
\\begin{eqnarray}
L(q_1, q_2, \\lambda) &=& ln U(q_1,q_2) + \\lambda \\cdot (y - p_1 \\cdot q_1 - p_2 \\cdot q_2) \\\\
&=& ln({\\var{c1}}) + {\\frac{1}{\\var{n1}}} \\cdot ln(q_1-{\\var{a1}}) + {\\frac{\\var{n1min1}}{\\var{n1}}} \\cdot ln(q_2-{\\var{a2}}) + \\lambda \\cdot ( \\var{y} - \\var{p1} \\cdot q_1 - \\var{p2}\\cdot q_2 )
\\end{eqnarray}
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} & = & {\\frac{1}{\\var{n1}}} \\cdot {\\frac {1} {q_1-{\\var{a1}}} } - \\lambda \\cdot \\var{p1} = 0 \\\\
\\mbox{(2) } \\quad \\frac{\\partial {L}}{\\partial q_2} & = & {\\frac{\\var{n1min1}}{\\var{n1}}} \\cdot {\\frac {1} {q_2-{\\var{a2}}}} - \\lambda \\cdot \\var{p2} = 0 \\\\
\\mbox{(3) } \\quad \\frac{\\partial {L}}{\\partial \\lambda} & = & \\var{y} - \\var{p1} \\cdot q_1 - \\var{p2} \\cdot q_2 = 0
\\end{eqnarray}
Step 4: Find the solution of this system of equations in $q_1$, $q_2$ and $\\lambda$.
Calculating $\\lambda$ in both equations (1) and (2) leads to
\\begin{eqnarray}
{\\frac{1}{\\var{n1}}}\\cdot{\\frac {1} {\\var{p1}} \\cdot (q_1-{\\var{a1}}) }& = & {\\frac{\\var{n1min1}}{\\var{n1}}}\\cdot{\\frac {1} {\\var{p2} \\cdot(q_2-{\\var{a2}})}}\\\\
{\\var{p2}} \\cdot {(q_2-{\\var{a2}})} & = & {\\var{n1min1}} \\cdot {\\var{p1}} \\cdot {(q_1-{\\var{a1}})} \\\\
{\\var{p2}} \\cdot {q_2} & = & {\\var{a2}} \\cdot {\\var{p2}} + {\\var{n1min1}} \\cdot {\\var{p1}} \\cdot {(q_1-{\\var{a1}})} = {\\var{a2*p2}} + {\\var{n1min1*p1}} \\cdot {(q_1-{\\var{a1}})}
\\end{eqnarray}
i.e.
\\begin{eqnarray}
\\mbox{(4)} \\quad \\quad \\quad \\quad \\quad \\quad \\quad \\quad{q_2} & = & {\\var{a2-n1min1*s*a1}} + {\\var{n1min1*s}} \\cdot {q_1}
\\end{eqnarray}
Substitute(4) in the budget restriction (3):
\\begin{eqnarray}
{\\var{p1}} \\cdot {q_1} + {\\var{(a2-n1min1*s*a1)*p2}} + {\\var{n1min1*s*p2}} \\cdot {q_1} & = & \\var{y}\\\\
{q_1} + {\\var{a2-n1min1*a1}} + {\\var{n1min1}} \\cdot {q_1} & = & \\var{n1*v+a1+a2}\\\\
{\\var{n1}} \\cdot {q_1} + {\\var{a2-n1min1*a1}} & = & \\var{n1*v+a1+a2}\\\\
q^*_1 &=& \\var{q1}
\\end{eqnarray}
Substituting this last formula in equation (4), we can calculate $q_2$:
\\begin{eqnarray}
{q^*_2} & = & \\var{q2}
\\end{eqnarray}
Answer.
For
\\begin{eqnarray}
q^*_1&=&\\var{q1} \\\\
q^*_2&=&\\var{q2}
\\end{eqnarray}
the maximal utility value is
\\[ U (q^*_1,q^*_2) \\approx \\var{nutfinaal} \\]
{toonfiguur()}
", "rulesets": {}, "extensions": ["jsxgraph"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"u": {"name": "u", "group": "Ungrouped variables", "definition": "nutfinaal", "description": "", "templateType": "anything", "can_override": false}, "ybudget": {"name": "ybudget", "group": "Ungrouped variables", "definition": "gegy", "description": "", "templateType": "anything", "can_override": false}, "q1": {"name": "q1", "group": "Ungrouped variables", "definition": "a1+v", "description": "", "templateType": "anything", "can_override": false}, "gegp2": {"name": "gegp2", "group": "Ungrouped variables", "definition": "random(2..15)", "description": "", "templateType": "anything", "can_override": false}, "theta": {"name": "theta", "group": "Ungrouped variables", "definition": "random(2..10)", "description": "", "templateType": "anything", "can_override": false}, "cu": {"name": "cu", "group": "Ungrouped variables", "definition": "u^(n1/t2)*((c1)^(-n1/t2))", "description": "", "templateType": "anything", "can_override": false}, "ydeelp1": {"name": "ydeelp1", "group": "Ungrouped variables", "definition": "y/p1", "description": "", "templateType": "anything", "can_override": false}, "cumax": {"name": "cumax", "group": "Ungrouped variables", "definition": "(umax)^(n1/t2)*((c1)^(-n1/t2))", "description": "", "templateType": "anything", "can_override": false}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "gegp1", "description": "", "templateType": "anything", "can_override": false}, "q2": {"name": "q2", "group": "Ungrouped variables", "definition": "a2+s*(n1-1)*v", "description": "", "templateType": "anything", "can_override": false}, "c1": {"name": "c1", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "c1
", "templateType": "anything", "can_override": false}, "t1": {"name": "t1", "group": "Ungrouped variables", "definition": "1", "description": "", "templateType": "anything", "can_override": false}, "n1": {"name": "n1", "group": "Ungrouped variables", "definition": "random(2..10)", "description": "", "templateType": "anything", "can_override": false}, "cumin": {"name": "cumin", "group": "Ungrouped variables", "definition": "(umin)^(n1/t2)*((c1)^(-n1/t2))", "description": "", "templateType": "anything", "can_override": false}, "ydeelp2": {"name": "ydeelp2", "group": "Ungrouped variables", "definition": "y/p2", "description": "", "templateType": "anything", "can_override": false}, "eta": {"name": "eta", "group": "Ungrouped variables", "definition": "theta*(s+n1-1)", "description": "", "templateType": "anything", "can_override": false}, "umin": {"name": "umin", "group": "Ungrouped variables", "definition": "1/3*u", "description": "", "templateType": "anything", "can_override": false}, "n2": {"name": "n2", "group": "Ungrouped variables", "definition": "n1", "description": "", "templateType": "anything", "can_override": false}, "a1maalt2": {"name": "a1maalt2", "group": "Ungrouped variables", "definition": "a1*t2", "description": "", "templateType": "anything", "can_override": false}, "p2": {"name": "p2", "group": "Ungrouped variables", "definition": "gegp2", "description": "", "templateType": "anything", "can_override": false}, "umax": {"name": "umax", "group": "Ungrouped variables", "definition": "5/3*u", "description": "", "templateType": "anything", "can_override": false}, "gegy": {"name": "gegy", "group": "Ungrouped variables", "definition": "gegp2*(n1*v*s+s*a1+a2)", "description": "", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "theta*s+1", "description": "", "templateType": "anything", "can_override": false}, "s": {"name": "s", "group": "Ungrouped variables", "definition": "random(2..10)", "description": "", "templateType": "anything", "can_override": false}, "n1min1maala1": {"name": "n1min1maala1", "group": "Ungrouped variables", "definition": "n1min1*a1", "description": "", "templateType": "anything", "can_override": false}, "nutfinaal": {"name": "nutfinaal", "group": "Ungrouped variables", "definition": "c1*(q1-a1)^((t1)/(n1))*(q2-a2)^((t2)/(n2))", "description": "", "templateType": "anything", "can_override": false}, "y": {"name": "y", "group": "Ungrouped variables", "definition": "ybudget", "description": "", "templateType": "anything", "can_override": false}, "gegp1": {"name": "gegp1", "group": "Ungrouped variables", "definition": "s*gegp2", "description": "", "templateType": "anything", "can_override": false}, "t2": {"name": "t2", "group": "Ungrouped variables", "definition": "n1-1", "description": "", "templateType": "anything", "can_override": false}, "a2": {"name": "a2", "group": "Ungrouped variables", "definition": "eta*n1*s", "description": "", "templateType": "anything", "can_override": false}, "n1min1": {"name": "n1min1", "group": "Ungrouped variables", "definition": "n1-1", "description": "", "templateType": "anything", "can_override": false}, "a1": {"name": "a1", "group": "Ungrouped variables", "definition": "theta*n1", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["n1", "theta", "c1", "s", "gegp2", "t1", "v", "eta", "n1min1", "a1", "a2", "t2", "n2", "n1min1maala1", "a1maalt2", "gegp1", "gegy", "q1", "q2", "ybudget", "p1", "p2", "y", "nutfinaal", "u", "umin", "umax", "cu", "cumax", "cumin", "ydeelp2", "ydeelp1"], "variable_groups": [], "functions": {"toonfiguur": {"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 nutfinaal = Numbas.jme.unwrapValue(scope.variables.nutfinaal);\nvar a1 = Numbas.jme.unwrapValue(scope.variables.a1);\nvar a2 = Numbas.jme.unwrapValue(scope.variables.a2);\nvar umin = Numbas.jme.unwrapValue(scope.variables.umin);\nvar u = Numbas.jme.unwrapValue(scope.variables.nutfinaal);\nvar umax = Numbas.jme.unwrapValue(scope.variables.umax);\nvar cumin = Numbas.jme.unwrapValue(scope.variables.cumin);\nvar cu = Numbas.jme.unwrapValue(scope.variables.cu);\nvar cumax = Numbas.jme.unwrapValue(scope.variables.cumax);\nvar s = Numbas.jme.unwrapValue(scope.variables.s);\nvar ydeelp2 = Numbas.jme.unwrapValue(scope.variables.ydeelp2);\nvar ydeelp1 = Numbas.jme.unwrapValue(scope.variables.ydeelp1);\nvar y = Numbas.jme.unwrapValue(scope.variables.y);\nvar p1 = Numbas.jme.unwrapValue(scope.variables.p1);\nvar p2 = Numbas.jme.unwrapValue(scope.variables.p2);\n//make board\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n{boundingBox:[-q1,2*q2,4*q1,-q2],grid: false,axis:false,keepaspectratio:false});\n// boundingbox:[left, top, right, bottom]\nvar board = div.board;\n\n\txaxis = 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});\n\n\t\nvar grafiek = board.create('functiongraph',\n [function(x){ return a2+cu*Math.pow(x-a1,-1/t2)},a1,4*q1],\n{strokeColor:\"green\",setLabelText:'niveau',visible: true, strokeWidth: 4, highlightStrokeColor: 'green'} \n ); \nvar grafiek2 = board.create('functiongraph',\n [function(x){ return y/p2-s*x},0,y/p1],\n{strokeColor:\"red\",setLabelText:'budget',visible: true, strokeWidth: 4, highlightStrokeColor: 'red'} \n ); \nvar grafiek3 = board.create('functiongraph',\n [function(x){ return a2+cumin*Math.pow(x-a1,-1/t2)},a1,4*q1],\n{strokeColor:\"green\",setLabelText:'niveau',visible: true, dash:2, highlightStrokeColor: 'green'} \n ); \nvar grafiek4 = board.create('functiongraph',\n [function(x){ return a2+cumax*Math.pow(x-a1,-1/t2)},a1,4*q1],\n{strokeColor:\"black\",setLabelText:'niveau',visible: true, dash:2, highlightStrokeColor: 'black'} \n ); \nvar punt = board.create('point', [q1, q2],{name:''});\nreturn div;"}}, "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": "