// 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": [{"metadata": {"notes": "
15/7/2015
\nAdded tags
\n
\n16/07/2012:
\nAdded tags.
\nQuestion appears to be working correctly.
\nMoved the \\rightarrow to the correct place in the solution.
\n
\n
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given vectors $\\boldsymbol{v,\\;w}$, find the angle between them.
"}, "type": "question", "preamble": {"css": "", "js": ""}, "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.
\nHere
\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}
\nSo
\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}
", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "question_groups": [{"pickingStrategy": "all-ordered", "name": "", "pickQuestions": 0, "questions": []}], "functions": {}, "ungrouped_variables": ["t", "u", "a", "b", "c", "d", "fa", "fb", "g", "sa", "sb", "ta", "tb"], "showQuestionGroupNames": false, "name": "Angle between vectors", "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"], "variablesTest": {"condition": "", "maxRuns": 100}, "variable_groups": [{"name": "Initial vectors", "variables": ["s1", "s2", "s3", "s4", "units", "direction_v", "direction_w", "v", "w"]}, {"name": "Result", "variables": ["angle", "precision"]}], "variables": {"fa": {"name": "fa", "definition": "if(t=1,0,s1)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "precision": {"name": "precision", "definition": "3", "group": "Result", "description": "", "templateType": "anything"}, "tb": {"name": "tb", "definition": "if(u=3,0,s4)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "d": {"name": "d", "definition": "if(u=3,2,3)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "direction_w": {"name": "direction_w", "definition": "map(units[j],j,shuffle(0..2))", "group": "Initial vectors", "description": "", "templateType": "anything"}, "sb": {"name": "sb", "definition": "if(u=2,0,if(u=1,s3,s4))", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "c": {"name": "c", "definition": "if(u=1,2,1)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "s1": {"name": "s1", "definition": "random(1,-1)", "group": "Initial vectors", "description": "", "templateType": "anything"}, "angle": {"name": "angle", "definition": "arccos(dot(v,w)/(len(v)*len(w)))", "group": "Result", "description": "", "templateType": "anything"}, "s2": {"name": "s2", "definition": "random(1,-1)", "group": "Initial vectors", "description": "", "templateType": "anything"}, "t": {"name": "t", "definition": "random(1,2,3)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "v": {"name": "v", "definition": "direction_v[0]*s1 + direction_v[1]*s2", "group": "Initial vectors", "description": "", "templateType": "anything"}, "s3": {"name": "s3", "definition": "random(1,-1)", "group": "Initial vectors", "description": "", "templateType": "anything"}, "s4": {"name": "s4", "definition": "if(s1=s3 ,-s2,random(-1,1))", "group": "Initial vectors", "description": "", "templateType": "anything"}, "direction_v": {"name": "direction_v", "definition": "map(units[j],j,shuffle(0..2))", "group": "Initial vectors", "description": "", "templateType": "anything"}, "u": {"name": "u", "definition": "random(1,2,3)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "a": {"name": "a", "definition": "if(t=1,2,1)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "g": {"name": "g", "definition": "{fa*fb+sa*sb+ta*tb}", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "sa": {"name": "sa", "definition": "if(t=2,0,if(t=1,s1,s2))", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "ta": {"name": "ta", "definition": "if(t=3,0,s2)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "w": {"name": "w", "definition": "direction_w[0]*s3 + direction_w[1]*s4", "group": "Initial vectors", "description": "", "templateType": "anything"}, "units": {"name": "units", "definition": "map(vector(x),x,list(id(3)))", "group": "Initial vectors", "description": "", "templateType": "anything"}, "b": {"name": "b", "definition": "if(t=3,2,3)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "fb": {"name": "fb", "definition": "if(u=1,0,s3)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}}, "statement": "You are given the vectors $\\boldsymbol{v} = \\var{v}$, $\\boldsymbol{w} = \\var{w}$ in $\\mathbb{R}^3$.
", "parts": [{"type": "gapfill", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 0, "prompt": "Find the angle between $\\boldsymbol{v}$ and $\\boldsymbol{w}$, in radians.
\nNote the angle must be in the range $0$ to $\\pi$.
\nGive your answer to {precision} decimal places.
\nAngle in radians = [[0]]
", "showCorrectAnswer": true, "gaps": [{"precision": "precision", "type": "numberentry", "showPrecisionHint": false, "maxValue": "{angle}", "strictPrecision": true, "marks": 1, "precisionPartialCredit": 0, "precisionType": "dp", "precisionMessage": "You have not given your answer to the correct precision.", "variableReplacementStrategy": "originalfirst", "scripts": {}, "minValue": "{angle}", "showCorrectAnswer": true, "correctAnswerFraction": false, "variableReplacements": [], "allowFractions": false}], "variableReplacements": []}], "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/"}]}