// Numbas version: exam_results_page_options {"name": "Q2 intersection of two straight lines", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": [], "name": "Q2 intersection of two straight lines", "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

Use the formula, $\\boldsymbol{a \\cdot b} = \\lVert\\boldsymbol{a}\\rVert\\!\\lVert\\boldsymbol{b}\\rVert \\cos(\\theta)$ where $\\theta$ is the angle between the vectors.

\n

Here

\n

\\begin{align}
\\lVert \\boldsymbol{a} \\rVert &= \\simplify[]{sqrt({v_b[0]}^2 + {v_b[1]}^2 + {v_b[2]}^2)} &= \\var{precround(len_vb,4)} \\\\[1em]
\\lVert \\boldsymbol{b} \\rVert &= \\simplify[]{sqrt({v_d[0]}^2 + {v_d[1]}^2 +{v_d[2]}^2)} &= \\var{precround(len_vd,4)} \\\\[1em]
\\boldsymbol{a \\cdot b} &= \\var{v_b} \\boldsymbol{\\cdot} \\var{v_d} &= \\var{dot(v_b,v_d)}
\\end{align}

\n

So

\n

\\begin{align}
\\cos(\\theta) &= \\frac{\\var{dot(v_b,v_d)}}{\\var{precround(len_vb,4)}\\times\\var{precround(len_vd,4)}} = &\\var{precround(cos_vbd,4)} \\\\[1em]
\\implies \\theta &= \\arccos\\left(\\var{precround(cos_vbd,4)}\\right) \\\\[1em]
&= \\var{precround(angle,precision)} \\text{ radians}
\\end{align}

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "

Find the $x$, $y$ and $z$ coordinates of the point of intersection of the straight lines ${l}_1$ and ${l}_2$.

\n

Note the angle must be in the range $0$ to $\\pi$.

\n

Give your answer to {precision} decimal places.

\n

Angle in radians = [[0]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"precisionType": "dp", "precisionMessage": "

You have not given your answer to the correct precision.

", "allowFractions": false, "variableReplacements": [], "maxValue": "{angle}", "strictPrecision": true, "minValue": "{angle}", "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "precision", "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "extensions": [], "statement": "

\n

You are given the straight lines $\\,{l}_1: \\boldsymbol{\\mathrm{r}} = \\var{v_a} + t\\var{v_b}\\,\\,$ and $\\,\\,{l}_2: \\boldsymbol{\\mathrm{r}} = \\var{v_c} + s\\var{v_d}$

\n

\n

", "variable_groups": [{"variables": ["direction_a", "direction_b", "direction_c", "direction_d", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "units", "v_a", "v_b", "v_c", "v_d", "t", "v_p", "direction_p"], "name": "Initial vectors"}, {"variables": ["angle", "precision"], "name": "Result"}], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"direction_p": {"definition": "map(units[j],j,shuffle(0..2)\n)", "templateType": "anything", "group": "Initial vectors", "name": "direction_p", "description": ""}, "v_p": {"definition": "direction_a[0]+t*direction_b[0]+direction_a[1]+t*direction_b[1]", "templateType": "anything", "group": "Initial vectors", "name": "v_p", "description": ""}, "v_d": {"definition": "direction_d[0]*s7*random(1..9) + direction_d[1]*s8*random(1..9)", "templateType": "anything", "group": "Initial vectors", "name": "v_d", "description": ""}, "direction_c": {"definition": "map(units[j],j,shuffle(0..2))", "templateType": "anything", "group": "Initial vectors", "name": "direction_c", "description": ""}, "direction_b": {"definition": "map(units[j],j,shuffle(0..2))", "templateType": "anything", "group": "Initial vectors", "name": "direction_b", "description": ""}, "v_a": {"definition": "direction_a[0]*s1*random(1..9) + direction_a[1]*s2*random(1..9)", "templateType": "anything", "group": "Initial vectors", "name": "v_a", "description": ""}, "v_b": {"definition": "direction_b[0]*s3*random(1..9) + direction_b[1]*s4*random(1..9)", "templateType": "anything", "group": "Initial vectors", "name": "v_b", "description": ""}, "v_c": {"definition": "direction_c[0]*s5*random(1..9) + direction_c[1]*s6*random(1..9)", "templateType": "anything", "group": "Initial vectors", "name": "v_c", "description": ""}, "s8": {"definition": "random(1,-1)", "templateType": "anything", "group": "Initial vectors", "name": "s8", "description": ""}, "angle": {"definition": "arccos(dot(v_b,v_d)/(len(v_b)*len(v_d)))", "templateType": "anything", "group": "Result", "name": "angle", "description": ""}, "s3": {"definition": "random(1,-1)", "templateType": "anything", "group": "Initial vectors", "name": "s3", "description": ""}, "s2": {"definition": "random(1,-1)", "templateType": "anything", "group": "Initial vectors", "name": "s2", "description": ""}, "s1": {"definition": "random(1,-1)", "templateType": "anything", "group": "Initial vectors", "name": "s1", "description": ""}, "s7": {"definition": "random(1,-1)", "templateType": "anything", "group": "Initial vectors", "name": "s7", "description": ""}, "s6": {"definition": "random(1,-1)", "templateType": "anything", "group": "Initial vectors", "name": "s6", "description": ""}, "s5": {"definition": "random(1,-1)", "templateType": "anything", "group": "Initial vectors", "name": "s5", "description": ""}, "s4": {"definition": "if(s1=s3 ,-s2,random(-1,1))", "templateType": "anything", "group": "Initial vectors", "name": "s4", "description": ""}, "units": {"definition": "map(vector(x),x,list(id(3)))", "templateType": "anything", "group": "Initial vectors", "name": "units", "description": ""}, "precision": {"definition": "3", "templateType": "anything", "group": "Result", "name": "precision", "description": ""}, "direction_a": {"definition": "map(units[j],j,shuffle(0..2))", "templateType": "anything", "group": "Initial vectors", "name": "direction_a", "description": ""}, "t": {"definition": "random(-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9)", "templateType": "anything", "group": "Initial vectors", "name": "t", "description": ""}, "direction_d": {"definition": "map(units[j],j,shuffle(0..2))", "templateType": "anything", "group": "Initial vectors", "name": "direction_d", "description": ""}}, "metadata": {"description": "

Given the vector equations of two straight lines, find the coordinates of the point of intersection

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Stephen Bowlzer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/206/"}]}]}], "contributors": [{"name": "Stephen Bowlzer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/206/"}]}