// Numbas version: finer_feedback_settings {"name": "LV07 Scalar product to find angles between vectors 3D", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "LV07 Scalar product to find angles between vectors 3D", "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "

It is given $\\bf{a} = \\var{a}$ and $\\bf{b} = \\var{b}$.

\n

Find the angle between $\\bf{a}$ and $\\bf{b}$.

", "advice": "

To answer these questions, we want to use the equations for the scalar product. Recall:

\n

For the vectors $ \\mathbf v = \\pmatrix{v_1 \\\\ v_2 \\\\ v_3},\\, \\mathbf w = \\pmatrix{w_1 \\\\ w_2 \\\\ w_3},$

\n

\\[ \\begin{split} \\mathbf{v \\cdot w} &\\,= v_1 \\times w_1 + v_2 \\times w_2 + v_3 \\times w_3 \\\\\\\\ \\mathbf{v \\cdot w} &\\,= |\\mathbf v| |\\mathbf w | \\cos(\\theta), \\end{split} \\]

\n

where $|\\mathbf v|$ and $|\\mathbf w|$ are the magnitudes of the vectors, and $\\theta$ is the angle between the vectors.

\n

For

\n

$$
\\bf{a} = \\var{a} \\qquad \\text{and} \\qquad \\bf{b} = \\var{b},
$$

\n

we have

\n

$$
\\bf{a} \\cdot \\bf{b} = \\var{adotb},
$$

\n

and

\n

$$
|\\bf{a}| = \\sqrt{\\var{a[0]^2 +a[1]^2 +a[2]^2}} \\approx \\var{precround(asize,2)},\\\\
|\\bf{b}| = \\sqrt{\\var{b[0]^2 +b[1]^2 +b[2]^2}}\\approx \\var{precround(bsize,2)}.
$$

\n

So we have:
$$
\\theta = \\cos^{-1}\\left(\\frac{\\var{adotb}}{\\sqrt{\\var{a[0]^2 +a[1]^2 +a[2]^2}}\\times\\sqrt{\\var{b[0]^2 +b[1]^2 +b[2]^2}}}\\right) = \\var{precround(angle,1)}.
$$

\n

Use this link to find some resources which will help you revise this topic.

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "vector(repeat(random(-9..9 except 0),3))", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "vector(repeat(random(-9..9 except 0),3))", "description": "", "templateType": "anything", "can_override": false}, "adotb": {"name": "adotb", "group": "Ungrouped variables", "definition": "dot(a,b)", "description": "", "templateType": "anything", "can_override": false}, "angle": {"name": "angle", "group": "Ungrouped variables", "definition": "degrees(arccos(adotb/(asize*bsize)))", "description": "", "templateType": "anything", "can_override": false}, "asize": {"name": "asize", "group": "Ungrouped variables", "definition": "sqrt(a[0]^2+a[1]^2+a[2]^2)", "description": "", "templateType": "anything", "can_override": false}, "bsize": {"name": "bsize", "group": "Ungrouped variables", "definition": "sqrt(b[0]^2 + b[1]^2+b[2]^2)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "adotb<>0", "maxRuns": 100}, "ungrouped_variables": ["a", "asize", "b", "bsize", "adotb", "angle"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Angle", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

The angle between $\\bf{a}$ and $\\bf{b}$ is [[0]] degrees.

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "Angle", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "alternatives": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "", "useAlternativeFeedback": false, "minValue": "180 - angle", "maxValue": "180 - angle", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "1", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "minValue": "angle", "maxValue": "angle", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "1", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Poppy Jeffries", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21275/"}, {"name": "Will Morgan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21933/"}], "resources": []}]}], "contributors": [{"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Poppy Jeffries", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21275/"}, {"name": "Will Morgan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21933/"}]}