// Numbas version: finer_feedback_settings {"name": "Find a unit normal vector to a surface given in Cartesian form", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"n2hat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sign(n2[0])*vector(precround(n2[0]/lenn2,4),precround(n2[1]/lenn2,4),precround(n2[2]/lenn2,4))", "description": "", "name": "n2hat"}, "p4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0", "description": "", "name": "p4"}, "p13": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..2)", "description": "", "name": "p13"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..3)", "description": "", "name": "p1"}, "p12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0", "description": "", "name": "p12"}, "p9": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..3)", "description": "", "name": "p9"}, "p3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..3)", "description": "", "name": "p3"}, "a1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "a1"}, "n2andmultiply": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(n2[0]<0,\", and multiply by $-1$,\",\",\")", "description": "", "name": "n2andmultiply"}, "n1hat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sign(n1[0])*vector(precround(n1[0]/lenn1,3),precround(n1[1]/lenn1,3),precround(n1[2]/lenn1,3))", "description": "", "name": "n1hat"}, "n1andmultiply": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(n1[0]<0,\", and multiply by $-1$,\",\",\")", "description": "", "name": "n1andmultiply"}, "n2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "vector(-p10*a2*q[0]^(p10-1)*q[1]^p11-p12*b2*q[0]^(p12-1)*q[1]^p13,-p11*a2*q[0]^p10*q[1]^(p11-1)-p13*b2*q[0]^p12*q[1]^(p13-1),1)", "description": "", "name": "n2"}, "p11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..2)", "description": "", "name": "p11"}, "q": {"templateType": "anything", "group": "Ungrouped variables", "definition": "vector(random(1..9)*sign(random(-1,1)),random(1..9)*sign(random(-1,1)),random(1..9)*sign(random(-1,1)))", "description": "", "name": "q"}, "lenn2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "abs(n2)", "description": "", "name": "lenn2"}, "b1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "b1"}, "a2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "a2"}, "p8": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..3)", "description": "", "name": "p8"}, "p7": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0", "description": "", "name": "p7"}, "b2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9 except a2)*sign(random(-1,1))", "description": "", "name": "b2"}, "p5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..3)", "description": "", "name": "p5"}, "p2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..3)", "description": "", "name": "p2"}, "lenn1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "abs(n1)", "description": "", "name": "lenn1"}, "r": {"templateType": "anything", "group": "Ungrouped variables", "definition": "vector(random(1..9)*sign(random(-1,1)),random(1..9)*sign(random(-1,1)),random(1..9)*sign(random(-1,1)))", "description": "", "name": "r"}, "n1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "vector(p1*a1*r[0]^(p1-1)*r[1]^p2*r[2]^p3+p4*b1*r[0]^(p4-1)*r[1]^p5*r[2]^p6+p7*c1*r[0]^(p7-1)*r[1]^p8*r[2]^p9,p2*a1*r[0]^p1*r[1]^(p2-1)*r[2]^p3+p5*b1*r[0]^p4*r[1]^(p5-1)*r[2]^p6+p8*c1*r[0]^p7*r[1]^(p8-1)*r[2]^p9,p3*a1*r[0]^p1*r[1]^p2*r[2]^(p3-1)+p6*b1*r[0]^p4*r[1]^p5*r[2]^(p6-1)+p9*c1*r[0]^p7*r[1]^p8*r[2]^(p9-1))", "description": "", "name": "n1"}, "c1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..9)*sign(random(-1,1))", "description": "", "name": "c1"}, "p6": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..3)", "description": "", "name": "p6"}, "p10": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..2)", "description": "", "name": "p10"}}, "ungrouped_variables": ["n1hat", "n2hat", "n1andmultiply", "b1", "b2", "lenn2", "lenn1", "r", "p10", "a1", "p11", "p12", "p13", "c1", "p2", "p3", "p1", "p6", "p7", "p4", "p5", "p8", "p9", "q", "a2", "n1", "n2", "n2andmultiply"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Find a unit normal vector to a surface given in Cartesian form", "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "n1hat[0]+0.001", "minValue": "n1hat[0]-0.001", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "n1hat[1]+0.001", "minValue": "n1hat[1]-0.001", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "n1hat[2]+0.001", "minValue": "n1hat[2]-0.001", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

$\\simplify{{a1}*x^{p1}*y^{p2}*z^{p3}+{b1}*x^{p4}*y^{p5}*z^{p6}+{c1}*x^{p7}*y^{p8}*z^{p9}}=0$ at $\\pmatrix{\\var{r[0]},\\var{r[1]},\\var{r[2]}}$.

\n

$\\boldsymbol{\\hat{n}}=($[[0]]$,$[[1]]$,$[[2]]$)$.  (Enter your answers to 3d.p.)

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "n2hat[0]+0.0001", "minValue": "n2hat[0]-0.0001", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "n2hat[1]+0.0001", "minValue": "n2hat[1]-0.0001", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "n2hat[2]+0.0001", "minValue": "n2hat[2]-0.0001", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

$z=\\simplify{{a2}*x^{p10}*y^{p11}+{b2}*x^{p12}*y^{p13}}$ at $\\pmatrix{\\var{q[0]},\\var{q[1]},\\var{q[2]}}$.

\n

$\\boldsymbol{\\hat{n}}=($[[0]]$,$[[1]]$,$[[2]]$)$.  (Enter your answers to 4d.p.)

", "showCorrectAnswer": true, "marks": 0}], "statement": "

Find a unit normal vector $\\boldsymbol{\\hat{n}}$, with positive $x$-component, to the following surfaces, at the given point.

", "tags": ["checked2015", "MAS2104"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

19/11/2013

\n

Set p1/=0, p4=p7=0, so that the x-derivative in part a) is never zero.  This avoids division by zero when calculating n1hat.

\n

q[1]->q[0] in definition of n2.

\n

Set p12=0, so that the x-derivative in part b) is never zero.  This avoids division by zero when calculating n2hat.

\n

12/11/2013

\n

Set a2 not equal to b2, to avoid any degenerate surfaces in part b).

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Unit normal vector to a surface, given in Cartesian form.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

Note that in this advice, the full calculator display is used in the calculation of each step; any rounding is purely for display clarity.

\n

a)

\n

The surface is given in the form $f(x,y,z)=0$, and so a normal vector to this surface is given by

\n

\\[\\begin{align}\\boldsymbol{n}=\\boldsymbol{\\nabla}f&=\\pmatrix{\\frac{\\partial f}{\\partial x},\\frac{\\partial f}{\\partial y},\\frac{\\partial f}{\\partial z}}\\\\&=\\pmatrix{\\simplify{{p1*a1}*x^{p1-1}*y^{p2}*z^{p3}+{p4*b1}*x^{p4-1}*y^{p5}*z^{p6}+{p7*c1}*x^{p7-1}*y^{p8}*z^{p9}},\\simplify{{p2*a1}*x^{p1}*y^{p2-1}*z^{p3}+{p5*b1}*x^{p4}*y^{p5-1}*z^{p6}+{p8*c1}*x^{p7}*y^{p8-1}*z^{p9}},\\simplify{{p3*a1}*x^{p1}*y^{p2}*z^{p3-1}+{p6*b1}*x^{p4}*y^{p5}*z^{p6-1}+{p9*c1}*x^{p7}*y^{p8}*z^{p9-1}}}.\\end{align}\\]

\n

Then

\n

\\[\\boldsymbol{n}\\vert_{\\pmatrix{\\var{r[0]},\\var{r[1]},\\var{r[2]}}}=\\pmatrix{\\var{n1[0]},\\var{n1[1]},\\var{n1[2]}}\\]

\n

is one such normal to the surface at the given point, by straight forward substitution of the components of the point into the components of the normal.

\n

The unit normal vector to the surface at the given point is given by $\\boldsymbol{\\hat{n}}=\\frac{\\boldsymbol{n}}{\\lvert\\boldsymbol{n}\\rvert}$, where

\n

\\[\\lvert\\boldsymbol{n}\\rvert=\\sqrt{n_1^2+n_2^2+n_3^2}.\\]

\n

In this case

\n

\\[\\lvert\\boldsymbol{n}\\rvert=\\sqrt{(\\var{n1[0]})^2+(\\var{n1[1]})^2+(\\var{n1[2]})^2}=\\var{precround(lenn1,3)}\\;\\text{to 3d.p.}\\]

\n

Now divide each component of $\\boldsymbol{n}$ by this value{n1andmultiply} so that the normal vector to the surface at the given point, with positive $x$-component is

\n

\\[\\boldsymbol{\\hat{n}}=\\pmatrix{\\var{n1hat[0]},\\var{n1hat[1]},\\var{n1hat[2]}}\\;\\text{to 3d.p.}\\]

\n

 

\n

b)

\n

The surface is given in the form $z=g(x,y)$.  This expression can either be rearranged into the form $f(x,y,z)=0$, and then adopt the same method of solution as in part a) or, alternatively, a normal vector to this surface is given by

\n

\\[\\boldsymbol{n}=\\pmatrix{-\\frac{\\partial g}{\\partial x},-\\frac{\\partial g}{\\partial y},1}=\\pmatrix{\\simplify{{-p10*a2}*x^{p10-1}*y^{p11}-{p12*b2}*x^{p12-1}*y^{p13}},\\simplify{{-p11*a2}*x^{p10}*y^{p11-1}-{p13*b2}*x^{p12}*y^{p13-1}},1}.\\]

\n

Then

\n

\\[\\boldsymbol{n}\\vert_{\\pmatrix{\\var{q[0]},\\var{q[1]},\\var{q[2]}}}=\\pmatrix{\\var{n2[0]},\\var{n2[1]},\\var{n2[2]}}\\]

\n

is one such normal to the surface at the given point, by straight forward substitution of the components of the point into the components of the normal.

\n

The unit normal vector to the surface at the given point is given by $\\boldsymbol{\\hat{n}}=\\frac{\\boldsymbol{n}}{\\lvert\\boldsymbol{n}\\rvert}$, where

\n

\\[\\lvert\\boldsymbol{n}\\rvert=\\sqrt{n_1^2+n_2^2+n_3^2}.\\]

\n

In this case

\n

\\[\\lvert\\boldsymbol{n}\\rvert=\\sqrt{(\\var{n2[0]})^2+(\\var{n2[1]})^2+(\\var{n2[2]})^2}=\\var{precround(lenn2,4)}\\;\\text{to 4d.p.}\\]

\n

Now divide each component of $\\boldsymbol{n}$ by this value{n2andmultiply} so that the normal vector to the surface at the given point, with positive $x$-component is

\n

\\[\\boldsymbol{\\hat{n}}=\\pmatrix{\\var{n2hat[0]},\\var{n2hat[1]},\\var{n2hat[2]}}\\;\\text{to 4d.p.}.\\]

", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}