// Numbas version: exam_results_page_options {"name": "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": [{"variable_groups": [], "extensions": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "name": "Dot product and angle between two vectors", "parts": [{"gaps": [{"unitTests": [], "mustBeReducedPC": 0, "type": "numberentry", "scripts": {}, "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "mustBeReduced": false, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "minValue": "ans1-0.005", "maxValue": "ans1+0.005", "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "marks": 1, "variableReplacements": []}, {"unitTests": [], "mustBeReducedPC": 0, "type": "numberentry", "scripts": {}, "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "mustBeReduced": false, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "minValue": "ansrad-0.05", "maxValue": "ansrad+0.05", "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "marks": 1, "variableReplacements": []}, {"unitTests": [], "mustBeReducedPC": 0, "type": "numberentry", "scripts": {}, "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "mustBeReduced": false, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "minValue": "dot_of_ab-0.001", "maxValue": "dot_of_ab+0.001", "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "marks": 1, "variableReplacements": []}], "unitTests": [], "type": "gapfill", "sortAnswers": false, "scripts": {}, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "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 )

", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "marks": 0, "variableReplacements": []}, {"gaps": [{"unitTests": [], "mustBeReducedPC": 0, "type": "numberentry", "scripts": {}, "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "mustBeReduced": false, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "minValue": "ans2-0.005", "maxValue": "ans2+0.005", "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "marks": 1, "variableReplacements": []}, {"unitTests": [], "mustBeReducedPC": 0, "type": "numberentry", "scripts": {}, "correctAnswerFraction": false, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "mustBeReduced": false, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "minValue": "ansrad2-0.05", "maxValue": "ansrad2+0.05", "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "marks": 1, "variableReplacements": []}, {"answer": "{dot_of_cd}", "unitTests": [], "type": "jme", "scripts": {}, "vsetRange": [0, 1], "failureRate": 1, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "vsetRangePoints": 5, "variableReplacementStrategy": "originalfirst", "showPreview": true, "checkingAccuracy": 0.001, "checkingType": "absdiff", "checkVariableNames": false, "customMarkingAlgorithm": "", "showCorrectAnswer": true, "marks": 1, "expectedVariableNames": [], "variableReplacements": []}], "unitTests": [], "type": "gapfill", "sortAnswers": false, "scripts": {}, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "prompt": "

 $ \\mathbf{c}=\\var{c[0]}i  + \\var{c[1]}j + \\var{c[2]}k$ and $\\mathbf{d}= \\var{d[0]}i+ \\var{d[1]}j+\\var{d[2]}k$

\n

$\\mathbf{c} \\cdot \\mathbf{d}=$ [[2]]

\n

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

\n

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

", "customMarkingAlgorithm": "", "showCorrectAnswer": true, "marks": 0, "variableReplacements": []}], "functions": {}, "variables": {"ans1": {"name": "ans1", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "precround(dot(a,b)/(lena*lenb),2)"}, "a": {"name": "a", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))"}, "d": {"name": "d", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))"}, "ansrad2": {"name": "ansrad2", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "precround(arccos(ans2),1)"}, "dot_of_cd": {"name": "dot_of_cd", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "dot(c,d)"}, "dot_of_ab": {"name": "dot_of_ab", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "dot(a,b)"}, "ansrad": {"name": "ansrad", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "precround(arccos(ans1),1)"}, "lena": {"name": "lena", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "abs(a)"}, "lenb": {"name": "lenb", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "abs(b)"}, "lend": {"name": "lend", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "abs(d)"}, "c": {"name": "c", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))"}, "b": {"name": "b", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))"}, "ans2": {"name": "ans2", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "precround(dot(c,d)/(lenc*lend),2)"}, "lenc": {"name": "lenc", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "abs(c)"}}, "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

In part a) therefore, 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.

", "metadata": {"description": "

Find the dot product and the angle between two vectors

", "licence": "Creative Commons Attribution 4.0 International"}, "preamble": {"css": "", "js": ""}, "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "tags": [], "statement": "

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

", "ungrouped_variables": ["a", "lenb", "c", "b", "lenc", "d", "lend", "ans1", "ans2", "lena", "ansrad", "ansrad2", "dot_of_ab", "dot_of_cd"], "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/"}]}]}], "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/"}]}