// Numbas version: finer_feedback_settings {"name": "Dot product - find angles between two pairs of vectors, ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"customMarkingAlgorithm": "", "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

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

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

$\\boldsymbol{c}=\\pmatrix{\\var{c[0]},\\var{c[1]},\\var{c[2]},\\var{c[3]}}$ and $\\boldsymbol{d}=\\pmatrix{\\var{d[0]},\\var{d[1]},\\var{d[2]},\\var{d[3]}}$

\n

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

", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "ans2-0.01", "maxValue": "ans2+0.01", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "mustBeReducedPC": 0}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}], "variables": {"lend": {"group": "Ungrouped variables", "templateType": "anything", "definition": "abs(d)", "name": "lend", "description": ""}, "ans2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "precround(dot(c,d)/(lenc*lend),2)", "name": "ans2", "description": ""}, "d": {"group": "Ungrouped variables", "templateType": "anything", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),4))", "name": "d", "description": ""}, "a": {"group": "Ungrouped variables", "templateType": "anything", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "name": "a", "description": ""}, "c": {"group": "Ungrouped variables", "templateType": "anything", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),4))", "name": "c", "description": ""}, "b": {"group": "Ungrouped variables", "templateType": "anything", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "name": "b", "description": ""}, "ans1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "precround(dot(a,b)/(lena*lenb),2)", "name": "ans1", "description": ""}, "lena": {"group": "Ungrouped variables", "templateType": "anything", "definition": "abs(a)", "name": "lena", "description": ""}, "lenc": {"group": "Ungrouped variables", "templateType": "anything", "definition": "abs(c)", "name": "lenc", "description": ""}, "lenb": {"group": "Ungrouped variables", "templateType": "anything", "definition": "abs(b)", "name": "lenb", "description": ""}}, "ungrouped_variables": ["a", "lenb", "c", "b", "lenc", "d", "lend", "ans1", "ans2", "lena"], "name": "Dot product - find angles between two pairs of vectors, ", "functions": {}, "variable_groups": [], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

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

", "tags": ["checked2015"], "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Find the cosine of the angle between two pairs of 3D and 4D vectors.

\n

The calculations and answers are correct, however the Advice should display the interim calculations of the lengths of vectors and their products to say 6dps. At present the student may be mislead into using 2dps at each stage - the instruction at the start of Advice is somewhat confusing.

"}, "extensions": [], "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

It is also given by

\n

\\[\\boldsymbol{a\\cdot b}=ab\\cos(\\theta)\\]

\n

where $a=\\lvert\\boldsymbol{a}\\rvert=\\sqrt{a_1^2+a_2^2+a_3^2}$ and $b=\\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

Equating the two expressions gives

\n

\\[a_1b_1+a_2b_2+a_3b_3=ab\\cos(\\theta)\\]

\n

and so

\n

\\[\\cos(\\theta)=\\frac{a_1b_1+a_2b_2+a_3b_3}{ab}.\\]

\n

In part a) therefore, we have

\n

\\[\\cos(\\theta)=\\frac{\\simplify[std]{{a[0]*b[0]}+{a[1]*b[1]}+{a[2]*b[2]}}}{\\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

and in part b) we have

\n

\\[\\cos(\\theta)=\\frac{\\simplify[std]{{c[0]*d[0]}+{c[1]*d[1]}+{c[2]*d[2]}+{c[3]*d[3]}}}{\\var{precround(lenc,2)}\\times\\var{precround(lend,2)}}=\\frac{\\var{dot(c,d)}}{\\var{precround(lenc*lend,2)}}=\\var{ans2} \\; \\text{to 2d.p.}\\]

", "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}