// Numbas version: finer_feedback_settings {"name": "Angle between vectors", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": ["angle between vectors", "angle beween two vectors", "checked2015", "degrees and radians", "dot product", "finding the angle between vectors", "inner product", "MAS1602", "mas1602", "radians", "scalar product", "vectors"], "statement": "

You are given the vectors $\\boldsymbol{v} = \\var{v}$, $\\boldsymbol{w} = \\var{w}$ in $\\mathbb{R}^3$.

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

Given vectors  $\\boldsymbol{v,\\;w}$, find the angle between them.

", "notes": "

15/7/2015

\n

Added tags

\n

\n

16/07/2012:

\n

Added tags.

\n

Question appears to be working correctly.

\n

Moved the \\rightarrow to the correct place in the solution.

\n

 

\n

 

"}, "showQuestionGroupNames": false, "variable_groups": [{"variables": ["s1", "s2", "s3", "s4", "units", "direction_v", "direction_w", "v", "w"], "name": "Initial vectors"}, {"variables": ["angle", "precision"], "name": "Result"}], "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"variableReplacementStrategy": "originalfirst", "marks": 0, "prompt": "

Find the angle between $\\boldsymbol{v}$ and $\\boldsymbol{w}$, in radians.

\n

Note the angle must be in the range $0$ to $\\pi$.

\n

Give your answer to {precision} decimal places.

\n

Angle in radians = [[0]]

", "type": "gapfill", "gaps": [{"variableReplacementStrategy": "originalfirst", "marks": 1, "precision": "precision", "showPrecisionHint": false, "showCorrectAnswer": true, "correctAnswerFraction": false, "minValue": "{angle}", "strictPrecision": true, "precisionPartialCredit": 0, "type": "numberentry", "maxValue": "{angle}", "precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "scripts": {}}], "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}}], "functions": {}, "preamble": {"css": "", "js": ""}, "variables": {"s4": {"group": "Initial vectors", "description": "", "definition": "if(s1=s3 ,-s2,random(-1,1))", "name": "s4", "templateType": "anything"}, "t": {"group": "Ungrouped variables", "description": "", "definition": "random(1,2,3)", "name": "t", "templateType": "anything"}, "v": {"group": "Initial vectors", "description": "", "definition": "direction_v[0]*s1 + direction_v[1]*s2", "name": "v", "templateType": "anything"}, "u": {"group": "Ungrouped variables", "description": "", "definition": "random(1,2,3)", "name": "u", "templateType": "anything"}, "direction_v": {"group": "Initial vectors", "description": "", "definition": "map(units[j],j,shuffle(0..2))", "name": "direction_v", "templateType": "anything"}, "w": {"group": "Initial vectors", "description": "", "definition": "direction_w[0]*s3 + direction_w[1]*s4", "name": "w", "templateType": "anything"}, "a": {"group": "Ungrouped variables", "description": "", "definition": "if(t=1,2,1)", "name": "a", "templateType": "anything"}, "units": {"group": "Initial vectors", "description": "", "definition": "map(vector(x),x,list(id(3)))", "name": "units", "templateType": "anything"}, "sb": {"group": "Ungrouped variables", "description": "", "definition": "if(u=2,0,if(u=1,s3,s4))", "name": "sb", "templateType": "anything"}, "fa": {"group": "Ungrouped variables", "description": "", "definition": "if(t=1,0,s1)", "name": "fa", "templateType": "anything"}, "angle": {"group": "Result", "description": "", "definition": "arccos(dot(v,w)/(len(v)*len(w)))", "name": "angle", "templateType": "anything"}, "precision": {"group": "Result", "description": "", "definition": "3", "name": "precision", "templateType": "anything"}, "direction_w": {"group": "Initial vectors", "description": "", "definition": "map(units[j],j,shuffle(0..2))", "name": "direction_w", "templateType": "anything"}, "c": {"group": "Ungrouped variables", "description": "", "definition": "if(u=1,2,1)", "name": "c", "templateType": "anything"}, "d": {"group": "Ungrouped variables", "description": "", "definition": "if(u=3,2,3)", "name": "d", "templateType": "anything"}, "fb": {"group": "Ungrouped variables", "description": "", "definition": "if(u=1,0,s3)", "name": "fb", "templateType": "anything"}, "ta": {"group": "Ungrouped variables", "description": "", "definition": "if(t=3,0,s2)", "name": "ta", "templateType": "anything"}, "s3": {"group": "Initial vectors", "description": "", "definition": "random(1,-1)", "name": "s3", "templateType": "anything"}, "sa": {"group": "Ungrouped variables", "description": "", "definition": "if(t=2,0,if(t=1,s1,s2))", "name": "sa", "templateType": "anything"}, "g": {"group": "Ungrouped variables", "description": "", "definition": "{fa*fb+sa*sb+ta*tb}", "name": "g", "templateType": "anything"}, "s1": {"group": "Initial vectors", "description": "", "definition": "random(1,-1)", "name": "s1", "templateType": "anything"}, "tb": {"group": "Ungrouped variables", "description": "", "definition": "if(u=3,0,s4)", "name": "tb", "templateType": "anything"}, "s2": {"group": "Initial vectors", "description": "", "definition": "random(1,-1)", "name": "s2", "templateType": "anything"}, "b": {"group": "Ungrouped variables", "description": "", "definition": "if(t=3,2,3)", "name": "b", "templateType": "anything"}}, "question_groups": [{"pickingStrategy": "all-ordered", "pickQuestions": 0, "name": "", "questions": []}], "type": "question", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "ungrouped_variables": ["t", "u", "a", "b", "c", "d", "fa", "fb", "g", "sa", "sb", "ta", "tb"], "advice": "

Use the formula, $\\boldsymbol{v \\cdot w} = \\lVert \\boldsymbol{v} \\rVert \\lVert \\boldsymbol{w} \\rVert \\cos(\\theta)$m where $\\theta$ is the angle between the vectors.

\n

Here

\n

\\begin{align}
\\lVert \\boldsymbol{v} \\rVert &= \\simplify[]{sqrt({s1}^2 + {s2}^2)} \\\\
&= \\sqrt{2}, \\\\[1em]
\\lVert \\boldsymbol{w} \\rVert &= \\simplify[]{sqrt({s3}^2 + {s4}^2)} \\\\
&= \\sqrt{2}, \\\\[1em]
\\boldsymbol{v \\cdot w} &= \\var{v} \\boldsymbol{\\cdot} \\var{w} \\\\
&= \\var{dot(v,w)}
\\end{align}

\n

So

\n

\\begin{align}
\\cos(\\theta) &= \\frac{\\var{dot(v,w)}}{\\sqrt{2}\\sqrt{2}} = \\simplify[std]{{dot(v,w)}/2} \\\\
\\implies \\theta &= \\arccos\\left(\\simplify[std]{{dot(v,w)}/{2}}\\right) \\\\
&= \\var{precround(angle,precision)} \\text{ radians}
\\end{align}

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