// Numbas version: finer_feedback_settings {"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": [{"metadata": {"description": "
Find the dot product and the angle between two vectors
", "licence": "Creative Commons Attribution 4.0 International"}, "variables": {"ansrad": {"description": "", "definition": "precround(arccos(ans1),1)", "group": "Ungrouped variables", "templateType": "anything", "name": "ansrad"}, "b": {"description": "", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "group": "Ungrouped variables", "templateType": "anything", "name": "b"}, "lenc": {"description": "", "definition": "abs(c)", "group": "Ungrouped variables", "templateType": "anything", "name": "lenc"}, "lenb": {"description": "", "definition": "abs(b)", "group": "Ungrouped variables", "templateType": "anything", "name": "lenb"}, "c": {"description": "", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "group": "Ungrouped variables", "templateType": "anything", "name": "c"}, "d": {"description": "", "definition": "vector(repeat(random(2..9)*sign(random(1,1)),3))", "group": "Ungrouped variables", "templateType": "anything", "name": "d"}, "dot_of_cd": {"description": "", "definition": "dot(c,d)", "group": "Ungrouped variables", "templateType": "anything", "name": "dot_of_cd"}, "ans1": {"description": "", "definition": "precround(dot(a,b)/(lena*lenb),2)", "group": "Ungrouped variables", "templateType": "anything", "name": "ans1"}, "lend": {"description": "", "definition": "abs(d)", "group": "Ungrouped variables", "templateType": "anything", "name": "lend"}, "dot_of_ab": {"description": "", "definition": "dot(a,b)", "group": "Ungrouped variables", "templateType": "anything", "name": "dot_of_ab"}, "ans2": {"description": "", "definition": "precround(dot(c,d)/(lenc*lend),2)", "group": "Ungrouped variables", "templateType": "anything", "name": "ans2"}, "ansrad2": {"description": "", "definition": "precround(arccos(ans2),1)", "group": "Ungrouped variables", "templateType": "anything", "name": "ansrad2"}, "lena": {"description": "", "definition": "abs(a)", "group": "Ungrouped variables", "templateType": "anything", "name": "lena"}, "a": {"description": "", "definition": "vector(repeat(random(1..9)*sign(random(1,-1)),3))", "group": "Ungrouped variables", "templateType": "anything", "name": "a"}}, "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.
\nThe 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\nand 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}.\\]
\nIn part a) therefore, we have
\n$ \\boldsymbol{a\\cdot b} = \\var{a[0]}\\times\\var{b[0]}+\\var{a[1]}\\times\\var{b[1]}+\\var{a[2]}\\times\\var{b[2]} = \\var{dot(a,b)} $
\n$\\lvert\\boldsymbol{a}\\rvert=\\sqrt{\\var{a[0]}^2+\\var{a[1]}^2+\\var{a[2]}^2}=\\var{precround(lena,3)}$
\n$\\lvert\\boldsymbol{b}\\rvert=\\sqrt{\\var{b[0]}^2+\\var{b[1]}^2+\\var{b[2]}^2}=\\var{precround(lenb,3)}$
\n\\[\\cos(\\theta)=\\frac{\\var{dot(a,b)}}{\\var{precround(lena,3)}\\times\\var{precround(lenb,3)}}=\\frac{\\var{dot(a,b)}}{\\var{precround(lena*lenb,2)}}=\\var{ans1} \\; \\text{to 2d.p.,}\\]
\nWhich gives an angle $\\theta =\\var{ansrad}$ radians to 1 d.p.
", "ungrouped_variables": ["a", "lenb", "c", "b", "lenc", "d", "lend", "ans1", "ans2", "lena", "ansrad", "ansrad2", "dot_of_ab", "dot_of_cd"], "name": "Dot product and angle between two vectors", "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "tags": [], "variable_groups": [], "statement": "Use the dot product to find the angle $\\theta$ between the following pairs of vectors.
", "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"type": "gapfill", "marks": 0, "gaps": [{"correctAnswerFraction": false, "marks": 1, "unitTests": [], "variableReplacementStrategy": "originalfirst", "maxValue": "ans1+0.005", "showCorrectAnswer": true, "showFeedbackIcon": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "minValue": "ans1-0.005", "mustBeReduced": false, "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacements": [], "scripts": {}, "extendBaseMarkingAlgorithm": true, "allowFractions": false}, {"correctAnswerFraction": false, "marks": 1, "unitTests": [], "variableReplacementStrategy": "originalfirst", "maxValue": "ansrad+0.05", "showCorrectAnswer": true, "showFeedbackIcon": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "minValue": "ansrad-0.05", "mustBeReduced": false, "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacements": [], "scripts": {}, "extendBaseMarkingAlgorithm": true, "allowFractions": false}, {"correctAnswerFraction": false, "marks": 1, "unitTests": [], "variableReplacementStrategy": "originalfirst", "maxValue": "dot_of_ab+0.001", "showCorrectAnswer": true, "showFeedbackIcon": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "minValue": "dot_of_ab-0.001", "mustBeReduced": false, "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacements": [], "scripts": {}, "extendBaseMarkingAlgorithm": true, "allowFractions": false}], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "showFeedbackIcon": 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 )
", "customMarkingAlgorithm": "", "unitTests": [], "sortAnswers": false, "variableReplacements": [], "scripts": {}, "extendBaseMarkingAlgorithm": true}, {"type": "gapfill", "marks": 0, "gaps": [{"correctAnswerFraction": false, "marks": 1, "unitTests": [], "variableReplacementStrategy": "originalfirst", "maxValue": "ans2+0.005", "showCorrectAnswer": true, "showFeedbackIcon": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "minValue": "ans2-0.005", "mustBeReduced": false, "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacements": [], "scripts": {}, "extendBaseMarkingAlgorithm": true, "allowFractions": false}, {"correctAnswerFraction": false, "marks": 1, "unitTests": [], "variableReplacementStrategy": "originalfirst", "maxValue": "ansrad2+0.05", "showCorrectAnswer": true, "showFeedbackIcon": true, "mustBeReducedPC": 0, "customMarkingAlgorithm": "", "minValue": "ansrad2-0.05", "mustBeReduced": false, "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "variableReplacements": [], "scripts": {}, "extendBaseMarkingAlgorithm": true, "allowFractions": false}, {"type": "jme", "marks": 1, "expectedVariableNames": [], "unitTests": [], "checkVariableNames": false, "variableReplacementStrategy": "originalfirst", "checkingType": "absdiff", "showCorrectAnswer": true, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "checkingAccuracy": 0.001, "showPreview": true, "vsetRangePoints": 5, "vsetRange": [0, 1], "failureRate": 1, "variableReplacements": [], "scripts": {}, "extendBaseMarkingAlgorithm": true, "answer": "{dot_of_cd}"}], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "showFeedbackIcon": true, "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": "", "unitTests": [], "sortAnswers": false, "variableReplacements": [], "scripts": {}, "extendBaseMarkingAlgorithm": true}], "extensions": [], "functions": {}, "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/"}]}