// Numbas version: finer_feedback_settings {"name": "Vectors 2 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": [{"functions": {}, "metadata": {"description": "

Find the dot product and the angle between two vectors

", "licence": "Creative Commons Attribution 4.0 International"}, "ungrouped_variables": ["a", "lenb", "c", "b", "lenc", "d", "lend", "ans1", "ans2", "lena", "ansrad", "ansrad2", "dot_of_ab", "dot_of_cd"], "statement": "

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

", "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "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.

", "preamble": {"css": "", "js": ""}, "name": "Vectors 2 Dot product and angle between two vectors", "parts": [{"type": "gapfill", "scripts": {}, "variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "unitTests": [], "useCustomName": false, "adaptiveMarkingPenalty": 0, "sortAnswers": false, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "prompt": "

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

\n

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

\n

$\\cos({\\theta})=$ [[0]]  (Give your answer to 2d.p.)

\n

$\\theta=$ [[1]](Give your answer, in radians, to 1d.p.)

", "customMarkingAlgorithm": "", "marks": 0, "gaps": [{"mustBeReducedPC": 0, "minValue": "ans1-0.005", "scripts": {}, "allowFractions": false, "variableReplacements": [], "showFeedbackIcon": true, "correctAnswerStyle": "plain", "maxValue": "ans1+0.005", "adaptiveMarkingPenalty": 0, "correctAnswerFraction": false, "customMarkingAlgorithm": "", "customName": "", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "mustBeReduced": false, "useCustomName": false, "variableReplacementStrategy": "originalfirst", "unitTests": [], "showFractionHint": true, "showCorrectAnswer": true, "marks": 1, "extendBaseMarkingAlgorithm": true}, {"mustBeReducedPC": 0, "minValue": "ansrad-0.05", "scripts": {}, "allowFractions": false, "variableReplacements": [], "showFeedbackIcon": true, "correctAnswerStyle": "plain", "maxValue": "ansrad+0.05", "adaptiveMarkingPenalty": 0, "correctAnswerFraction": false, "customMarkingAlgorithm": "", "customName": "", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "mustBeReduced": false, "useCustomName": false, "variableReplacementStrategy": "originalfirst", "unitTests": [], "showFractionHint": true, "showCorrectAnswer": true, "marks": 1, "extendBaseMarkingAlgorithm": true}, {"mustBeReducedPC": 0, "minValue": "dot_of_ab-0.001", "scripts": {}, "allowFractions": false, "variableReplacements": [], "showFeedbackIcon": true, "correctAnswerStyle": "plain", "maxValue": "dot_of_ab+0.001", "adaptiveMarkingPenalty": 0, "correctAnswerFraction": false, "customMarkingAlgorithm": "", "customName": "", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "mustBeReduced": false, "useCustomName": false, "variableReplacementStrategy": "originalfirst", "unitTests": [], "showFractionHint": true, "showCorrectAnswer": true, "marks": 1, "extendBaseMarkingAlgorithm": true}], "customName": ""}, {"type": "gapfill", "scripts": {}, "variableReplacements": [], "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "unitTests": [], "useCustomName": false, "adaptiveMarkingPenalty": 0, "sortAnswers": false, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "prompt": "

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

\n

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

\n

$\\cos({\\theta})=$ [[0]]  (Give your answer to 2d.p.)

\n

$\\theta=$ [[1]]  (Give your answer, in radians, to 1d.p.)

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

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

\n

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

\n

$\\cos({\\theta})=$ [[0]]  (Give your answer to 2d.p.)

\n

$\\theta=$ [[1]](Give your answer, in radians, to 1d.p.)

", "customMarkingAlgorithm": "", "marks": 0, "gaps": [{"mustBeReducedPC": 0, "minValue": "ans1-0.005", "scripts": {}, "allowFractions": false, "variableReplacements": [], "showFeedbackIcon": true, "correctAnswerStyle": "plain", "maxValue": "ans1+0.005", "adaptiveMarkingPenalty": 0, "correctAnswerFraction": false, "customMarkingAlgorithm": "", "customName": "", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "mustBeReduced": false, "useCustomName": false, "variableReplacementStrategy": "originalfirst", "unitTests": [], "showFractionHint": true, "showCorrectAnswer": true, "marks": 1, "extendBaseMarkingAlgorithm": true}, {"mustBeReducedPC": 0, "minValue": "ansrad-0.05", "scripts": {}, "allowFractions": false, "variableReplacements": [], "showFeedbackIcon": true, "correctAnswerStyle": "plain", "maxValue": "ansrad+0.05", "adaptiveMarkingPenalty": 0, "correctAnswerFraction": false, "customMarkingAlgorithm": "", "customName": "", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "mustBeReduced": false, "useCustomName": false, "variableReplacementStrategy": "originalfirst", "unitTests": [], "showFractionHint": true, "showCorrectAnswer": true, "marks": 1, "extendBaseMarkingAlgorithm": true}, {"mustBeReducedPC": 0, "minValue": "dot_of_ab-0.001", "scripts": {}, "allowFractions": false, "variableReplacements": [], "showFeedbackIcon": true, "correctAnswerStyle": "plain", "maxValue": "dot_of_ab+0.001", "adaptiveMarkingPenalty": 0, "correctAnswerFraction": false, "customMarkingAlgorithm": "", "customName": "", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "mustBeReduced": false, "useCustomName": false, "variableReplacementStrategy": "originalfirst", "unitTests": [], "showFractionHint": true, "showCorrectAnswer": true, "marks": 1, "extendBaseMarkingAlgorithm": true}], "customName": ""}], "variable_groups": [], "tags": [], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"dot_of_ab": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "dot(a,b)", "name": "dot_of_ab"}, "d": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "name": "d"}, "lenb": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "abs(b)", "name": "lenb"}, "ansrad": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "precround(arccos(ans1),1)", "name": "ansrad"}, "a": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "name": "a"}, "lend": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "abs(d)", "name": "lend"}, "dot_of_cd": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "dot(c,d)", "name": "dot_of_cd"}, "ans1": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "precround(dot(a,b)/(lena*lenb),2)", "name": "ans1"}, "ans2": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "precround(dot(c,d)/(lenc*lend),2)", "name": "ans2"}, "c": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "name": "c"}, "lenc": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "abs(c)", "name": "lenc"}, "ansrad2": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "precround(arccos(ans2),1)", "name": "ansrad2"}, "lena": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "abs(a)", "name": "lena"}, "b": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "name": "b"}}, "extensions": [], "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/"}]}]}], "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/"}]}