// Numbas version: finer_feedback_settings {"name": "Simon's copy of Find unit vector orthogonal to two others,", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"a": {"definition": "cross(u,v)", "name": "a", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "unitapos": {"definition": "apos/len(a)", "name": "unitapos", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "unita": {"definition": "a/len(a)", "name": "unita", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "u": {"definition": "vector(repeat(random(-9..9 except 0),3))", "name": "u", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "v": {"definition": "vector(repeat(random(-9..9 except 0),3))", "name": "v", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "apos": {"definition": "if(a[0]<0,-a,a)", "name": "apos", "description": "", "templateType": "anything", "group": "Ungrouped variables"}}, "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 vector $\\boldsymbol{a}$, which is orthogonal to both $\\boldsymbol{u}$ and $\\boldsymbol{v}$, is given by the vector product:

\n

\\[ \\boldsymbol{u}\\times\\boldsymbol{v}=\\pmatrix{u_2 v_3 - u_3 v_2, & u_3 v_1 - u_1 v_3, & u_1 v_2 - u_2 v_1} \\]

\n

The magnitude of $\\boldsymbol{a}$ is given by 

\n

\\[ \\lvert\\boldsymbol{a}\\rvert=\\sqrt{a_1^2+a_2^2+a_3^2} \\]

\n

A unit vector $\\boldsymbol{\\hat{a}}$ is obtained by dividing the components of the vector $\\boldsymbol{a}$ by its magnitude, i.e.

\n

\\[ \\boldsymbol{\\hat{a}}=\\frac{\\boldsymbol{a}}{\\lvert\\boldsymbol{a}\\rvert} \\] 

\n

In this question,

\n

\\[ \\boldsymbol{u \\times v} = \\pmatrix{\\simplify[basic]{{u[1]}*{v[2]}-{u[2]}*{v[1]}}, & \\simplify[basic]{{u[2]}*{v[0]}-{u[0]}*{v[2]}}, & \\simplify[basic]{{u[0]}*{v[1]} - {u[1]}*{v[0]}}} = \\var[rowvector]{a} \\]

\n

and

\n

\\[ \\lvert\\boldsymbol{u \\times v}\\rvert = \\sqrt{(\\var{a[0]})^2+(\\var{a[1]})^2+(\\var{a[2]})^2} = \\var{precround(len(a),3)} \\text{ to 3 decimal places.} \\]

\n

A vector orthogonal to both $\\boldsymbol{u}$ and $\\boldsymbol{v}$ is therefore $\\boldsymbol{\\hat{a}}=\\frac{\\boldsymbol{u \\times v}}{\\lvert\\boldsymbol{u \\times v}\\rvert} = \\frac{1}{\\var{precround(len(a),3)}}\\var[rowvector]{a} = \\pmatrix{\\var{precround(unita[0],3)}, & \\var{precround(unita[1],3)}, & \\var{precround(unita[2],3)}}$ to 3d.p.

\n

\n

Remember that we were asked for the orthogonal vector with positive $x$-component. If our $x$-component of $\\hat{a}$ is negative, we can simply take the vector  $-\\hat{a}$, which is the same unit vector but in the opposite direction.

\n

\n

Therefore our final answer is $\\pmatrix{\\var{precround(unitapos[0],3)}, & \\var{precround(unitapos[1],3)}, & \\var{precround(unitapos[2],3)}}$ to 3d.p.

\n

\n

", "metadata": {"description": "

Find a unit vector orthogonal to two others.

\n

Uses $\\wedge$ for the cross product. The interim calculations should all be displayed to enough dps, not 3,  to ensure accuracy to 3 dps. If the cross product has a negative x component then it is not explained that the negative of the cross product is taken for the unit vector.

", "licence": "Creative Commons Attribution 4.0 International"}, "functions": {}, "variablesTest": {"condition": "a[0]<>0", "maxRuns": 100}, "statement": "

Find the unit vector $\\boldsymbol{\\hat{a}}$, with positive $x$-component, which is orthogonal to both $\\boldsymbol{u}=\\pmatrix{\\var{u[0]},\\var{u[1]},\\var{u[2]}}$ and $\\boldsymbol{v}=\\pmatrix{\\var{v[0]},\\var{v[1]},\\var{v[2]}}$.

", "ungrouped_variables": ["u", "v", "a", "apos", "unitapos", "unita"], "name": "Simon's copy of Find unit vector orthogonal to two others,", "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "variable_groups": [], "parts": [{"variableReplacements": [], "unitTests": [], "extendBaseMarkingAlgorithm": true, "sortAnswers": false, "type": "gapfill", "prompt": "

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

", "gaps": [{"unitTests": [], "variableReplacementStrategy": "originalfirst", "tolerance": 0, "precision": "3", "scripts": {}, "marks": "3", "showCorrectAnswer": true, "allowFractions": false, "correctAnswerFractions": false, "showFeedbackIcon": true, "numColumns": "3", "markPerCell": true, "precisionPartialCredit": 0, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "correctAnswer": "matrix([unitapos])", "type": "matrix", "precisionType": "dp", "strictPrecision": false, "numRows": 1, "allowResize": false, "customMarkingAlgorithm": "", "precisionMessage": "You have not given your answer to the correct precision."}], "scripts": {}, "marks": 0, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "customMarkingAlgorithm": ""}], "preamble": {"css": "", "js": ""}, "tags": [], "extensions": [], "type": "question", "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}