// Numbas version: exam_results_page_options {"name": "Simon's copy of Dot product and angle between two vectors", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "

Find the angle  $\\theta$  between the following pair of vectors.

", "tags": [], "name": "Simon's copy of Dot product and angle between two vectors", "variablesTest": {"condition": "", "maxRuns": 100}, "functions": {}, "parts": [{"showFeedbackIcon": true, "scripts": {}, "sortAnswers": false, "showCorrectAnswer": true, "prompt": "

$\\mathbf{a}=\\pmatrix{\\var{a[0]},\\var{a[1]},\\var{a[2]}}$ and $\\mathbf{ b}=\\pmatrix{\\var{b[0]},\\var{b[1]},\\var{b[2]}}$

\n

$\\mathbf{a} \\cdot \\mathbf{b}=$ [[2]]

\n

$\\cos({\\theta})=$ [[0]]  (Give your answer to two decimal places)

\n

$\\theta=$ [[1]] (Give your answer, in radians to one decimal place )

", "gaps": [{"showFeedbackIcon": true, "allowFractions": false, "scripts": {}, "showCorrectAnswer": true, "maxValue": "ans1+0.005", "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "customMarkingAlgorithm": "", "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "type": "numberentry", "minValue": "ans1-0.005", "correctAnswerFraction": false, "correctAnswerStyle": "plain", "variableReplacements": []}, {"showFeedbackIcon": true, "allowFractions": false, "scripts": {}, "showCorrectAnswer": true, "maxValue": "ansrad+0.05", "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "customMarkingAlgorithm": "", "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "type": "numberentry", "minValue": "ansrad-0.05", "correctAnswerFraction": false, "correctAnswerStyle": "plain", "variableReplacements": []}, {"showFeedbackIcon": true, "allowFractions": false, "scripts": {}, "showCorrectAnswer": true, "maxValue": "dot_of_ab+0.001", "extendBaseMarkingAlgorithm": true, "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "customMarkingAlgorithm": "", "mustBeReducedPC": 0, "variableReplacementStrategy": "originalfirst", "marks": 1, "unitTests": [], "type": "numberentry", "minValue": "dot_of_ab-0.001", "correctAnswerFraction": false, "correctAnswerStyle": "plain", "variableReplacements": []}], "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "marks": 0, "unitTests": [], "type": "gapfill", "variableReplacements": []}], "variable_groups": [], "variables": {"ansrad2": {"templateType": "anything", "definition": "precround(arccos(ans2),1)", "name": "ansrad2", "description": "", "group": "Ungrouped variables"}, "lenc": {"templateType": "anything", "definition": "abs(c)", "name": "lenc", "description": "", "group": "Ungrouped variables"}, "dot_of_cd": {"templateType": "anything", "definition": "dot(c,d)", "name": "dot_of_cd", "description": "", "group": "Ungrouped variables"}, "lenb": {"templateType": "anything", "definition": "abs(b)", "name": "lenb", "description": "", "group": "Ungrouped variables"}, "ans1": {"templateType": "anything", "definition": "precround(dot(a,b)/(lena*lenb),2)", "name": "ans1", "description": "", "group": "Ungrouped variables"}, "c": {"templateType": "anything", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "name": "c", "description": "", "group": "Ungrouped variables"}, "a": {"templateType": "anything", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "name": "a", "description": "", "group": "Ungrouped variables"}, "ans2": {"templateType": "anything", "definition": "precround(dot(c,d)/(lenc*lend),2)", "name": "ans2", "description": "", "group": "Ungrouped variables"}, "b": {"templateType": "anything", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "name": "b", "description": "", "group": "Ungrouped variables"}, "lend": {"templateType": "anything", "definition": "abs(d)", "name": "lend", "description": "", "group": "Ungrouped variables"}, "ansrad": {"templateType": "anything", "definition": "precround(arccos(ans1),1)", "name": "ansrad", "description": "", "group": "Ungrouped variables"}, "dot_of_ab": {"templateType": "anything", "definition": "dot(a,b)", "name": "dot_of_ab", "description": "", "group": "Ungrouped variables"}, "lena": {"templateType": "anything", "definition": "abs(a)", "name": "lena", "description": "", "group": "Ungrouped variables"}, "d": {"templateType": "anything", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "name": "d", "description": "", "group": "Ungrouped variables"}}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Find the dot product and the angle between two vectors

"}, "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "extensions": [], "preamble": {"js": "", "css": ""}, "ungrouped_variables": ["a", "lenb", "c", "b", "lenc", "d", "lend", "ans1", "ans2", "lena", "ansrad", "ansrad2", "dot_of_ab", "dot_of_cd"], "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

The dot product of two vectors $\\boldsymbol{a}=\\pmatrix{a_1,a_2,a_3}$ and $\\boldsymbol{b}=\\pmatrix{b_1,b_2,b_3}$ is given by

\n

\\[\\boldsymbol{a\\cdot b}=a_1b_1+a_2b_2+a_3b_3\\]

\n

\n

$\\lvert\\boldsymbol{a}\\rvert=\\sqrt{a_1^2+a_2^2+a_3^2}$ ,$\\lvert\\boldsymbol{b}\\rvert=\\sqrt{b_1^2+b_2^2+b_3^2}$ are the lengths of the vectors $\\boldsymbol{a}$ and $\\boldsymbol{b}$.

\n

\n

and so

\n

\\[\\cos(\\theta)=\\frac{\\boldsymbol{a\\cdot b}}{\\lvert\\boldsymbol{a}\\rvert \\lvert\\boldsymbol{b}\\rvert}=\\frac{a_1b_1+a_2b_2+a_3b_3}{\\lvert\\boldsymbol{a}\\rvert \\lvert\\boldsymbol{b}\\rvert}.\\]

\n

\n

Therefore, for our question, we have

\n

\\[\\cos(\\theta)=\\frac{\\var{dot(a,b)}}{\\var{precround(lena,2)}\\times\\var{precround(lenb,2)}}=\\frac{\\var{dot(a,b)}}{\\var{precround(lena*lenb,2)}}=\\var{ans1} \\; \\text{to 2d.p.,}\\]

\n

Which gives an angle $\\theta =\\var{ansrad}$ radians to 1 d.p.

", "type": "question", "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}, {"name": "Violeta CIT", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1030/"}, {"name": "Marie Nicholson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1799/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}, {"name": "Violeta CIT", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1030/"}, {"name": "Marie Nicholson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1799/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}