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