// 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": [{"parts": [{"showCorrectAnswer": true, "scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "showCorrectAnswer": true, "minValue": "{angle}", "maxValue": "{angle}", "precision": "precision", "precisionMessage": "You have not given your answer to the correct precision.", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": true, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "variableReplacements": [], "marks": 1}], "type": "gapfill", "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]]

", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0}], "variables": {"s1": {"templateType": "anything", "group": "Initial vectors", "definition": "random(1,-1)", "description": "", "name": "s1"}, "w": {"templateType": "anything", "group": "Initial vectors", "definition": "direction_w[0]*s3 + direction_w[1]*s4", "description": "", "name": "w"}, "v": {"templateType": "anything", "group": "Initial vectors", "definition": "direction_v[0]*s1 + direction_v[1]*s2", "description": "", "name": "v"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=3,2,3)", "description": "", "name": "b"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(u=1,2,1)", "description": "", "name": "c"}, "s4": {"templateType": "anything", "group": "Initial vectors", "definition": "if(s1=s3 ,-s2,random(-1,1))", "description": "", "name": "s4"}, "direction_v": {"templateType": "anything", "group": "Initial vectors", "definition": "map(units[j],j,shuffle(0..2))", "description": "", "name": "direction_v"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,2,3)", "description": "", "name": "t"}, "direction_w": {"templateType": "anything", "group": "Initial vectors", "definition": "map(units[j],j,shuffle(0..2))", "description": "", "name": "direction_w"}, "tb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(u=3,0,s4)", "description": "", "name": "tb"}, "fa": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=1,0,s1)", "description": "", "name": "fa"}, "u": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,2,3)", "description": "", "name": "u"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=1,2,1)", "description": "", "name": "a"}, "g": {"templateType": "anything", "group": "Ungrouped variables", "definition": "{fa*fb+sa*sb+ta*tb}", "description": "", "name": "g"}, "fb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(u=1,0,s3)", "description": "", "name": "fb"}, "d": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(u=3,2,3)", "description": "", "name": "d"}, "units": {"templateType": "anything", "group": "Initial vectors", "definition": "map(vector(x),x,list(id(3)))", "description": "", "name": "units"}, "sb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(u=2,0,if(u=1,s3,s4))", "description": "", "name": "sb"}, "precision": {"templateType": "anything", "group": "Result", "definition": "3", "description": "", "name": "precision"}, "ta": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=3,0,s2)", "description": "", "name": "ta"}, "s3": {"templateType": "anything", "group": "Initial vectors", "definition": "random(1,-1)", "description": "", "name": "s3"}, "angle": {"templateType": "anything", "group": "Result", "definition": "arccos(dot(v,w)/(len(v)*len(w)))", "description": "", "name": "angle"}, "sa": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=2,0,if(t=1,s1,s2))", "description": "", "name": "sa"}, "s2": {"templateType": "anything", "group": "Initial vectors", "definition": "random(1,-1)", "description": "", "name": "s2"}}, "ungrouped_variables": ["t", "u", "a", "b", "c", "d", "fa", "fb", "g", "sa", "sb", "ta", "tb"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "name": "Angle between vectors", "functions": {}, "variable_groups": [{"variables": ["s1", "s2", "s3", "s4", "units", "direction_v", "direction_w", "v", "w"], "name": "Initial vectors"}, {"variables": ["angle", "precision"], "name": "Result"}], "showQuestionGroupNames": false, "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

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

", "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"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"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

 

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

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

"}, "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}

", "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/"}]}