// Numbas version: finer_feedback_settings {"name": "Polar Coordinates: Converting from Cartesian to Polar coordinates", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Polar Coordinates: Converting from Cartesian to Polar coordinates", "tags": [], "metadata": {"description": "

Give the cartesian coordinates of a point $P$, find the equivalent polar coordinates

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "

The Cartesian coordinates of $P$ are $(\\var{x},\\var{y})$, what are the equivalent polar coordinates $[r,\\theta]$ ?

", "advice": "

To convert between Cartesian coordinates and Polar coordinates we need to find the values of $r$ and $\\theta$, where $r$ is the distance of $P$ from the origin and $\\theta$ is the angle measured anti-clockwise from the positive $x$-direction to the line $OP$.

\n

The relationship between $(x,y)$ and $[r,\\theta]$ is given by

\n

\\[ x=r \\cos(\\theta) \\qquad y=r \\sin(\\theta) \\]

\n

and equivalently, 

\n

\\[ r=+\\sqrt{x^2+y^2} \\qquad \\tan(\\theta)=\\frac{y}{x} \\]

\n

Note: Care is needed when calculating $\\theta$, depending on which quadrant the point $P$ is in. If it is NOT in the first quadrant, then extra steps are needed when finding $\\theta$.

\n

For the point $(x,y) = (\\var{x}, \\var{y})$, 

\n

\\[ \\begin{split} r &\\,=\\sqrt{\\simplify[!collectNumbers]{{x}^2+{y}^2}} \\\\ &\\,=\\sqrt{\\simplify{{x^2+y^2}}} \\\\ &\\,=\\simplify{{precround(r,2)}} \\var{dp}\\end{split} \\]

\n

{advice[which]}

\n

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"x": {"name": "x", "group": "Ungrouped variables", "definition": "random(-1,1)*random(2..5)", "description": "", "templateType": "anything", "can_override": false}, "y": {"name": "y", "group": "Ungrouped variables", "definition": "random(-1,1)*random(2..5)", "description": "", "templateType": "anything", "can_override": false}, "r": {"name": "r", "group": "Ungrouped variables", "definition": "sqrt(x^2+y^2)", "description": "", "templateType": "anything", "can_override": false}, "theta": {"name": "theta", "group": "Ungrouped variables", "definition": "[\n arctan(y/x),\n pi-arctan(abs(y/x)),\n pi+arctan(abs(y/x)),\n 2*pi-arctan(abs(y/x))\n]", "description": "", "templateType": "anything", "can_override": false}, "theta2": {"name": "theta2", "group": "Ungrouped variables", "definition": "[\n arctan(y/x),\n pi-arctan(abs(y/x)),\n -(pi-arctan(abs(y/x))),\n -arctan(abs(y/x))\n]", "description": "", "templateType": "anything", "can_override": false}, "dp": {"name": "dp", "group": "Ungrouped variables", "definition": "if(round(r)=r,' ',' (2 d.p.)')", "description": "", "templateType": "anything", "can_override": false}, "advice": {"name": "advice", "group": "Ungrouped variables", "definition": "[\n quad1,\n quad2,\n quad3,\n quad4\n]", "description": "", "templateType": "anything", "can_override": false}, "which": {"name": "which", "group": "Ungrouped variables", "definition": "if(x>0 and y>0,0, if(x<0 and y>0,1, if(x<0 and y<0,2,3)))", "description": "", "templateType": "anything", "can_override": false}, "quad1": {"name": "quad1", "group": "Ungrouped variables", "definition": "\"

Since the point $P$ is in the first quadrant we can use the above relation to calculate $\\\\theta$:

\\n

\\\\[ \\\\begin{split} \\\\tan(\\\\theta) &\\\\,= \\\\frac{\\\\var{y}}{\\\\var{x}} \\\\\\\\ \\\\implies \\\\theta &\\\\,= \\\\tan^{-1} \\\\left(\\\\simplify[fractionNumbers]{{y/x}}\\\\right) \\\\\\\\ &\\\\,=\\\\simplify{{precround(theta[which],2)}} \\\\text{ rad.} \\\\end{split} \\\\]

\\n

Therefore, for the Cartesian coordinates $(\\\\var{x}, \\\\var{y})$, the equivalent Polar coordinates are \\\\[ [r,\\\\theta] = [\\\\simplify{{precround(r,2)}},\\\\simplify{{precround(theta[which],2)}}].\\\\]

\"", "description": "", "templateType": "long string", "can_override": false}, "quad2": {"name": "quad2", "group": "Ungrouped variables", "definition": "\"

Since $P$ is in the second quadrant, to calculate $\\\\theta$ it can be easier to first calculate the angle formed between the line $OP$ and the negative $x$-axis, and then subtract this answer from $\\\\pi$ rad. We can define this angle as $\\\\phi$:

\\n

\\\\[ \\\\begin{split} \\\\tan(\\\\phi) &\\\\,= \\\\frac{\\\\var{abs(y)}}{\\\\var{abs(x)}} \\\\\\\\ \\\\implies \\\\phi &\\\\,= \\\\tan^{-1} \\\\left(\\\\simplify[fractionNumbers]{{abs(y)/abs(x)}}\\\\right) \\\\\\\\ &\\\\,=\\\\simplify{{precround(pi-theta[which],2)}} \\\\, \\\\text{  rad.  (2 d.p.)}. \\\\end{split} \\\\]

\\n

Since \\\\[ \\\\begin{split} \\\\theta+\\\\phi &\\\\,= \\\\pi \\\\text{  rad.} \\\\\\\\ \\\\implies \\\\theta &\\\\,= \\\\pi - \\\\phi \\\\\\\\ &\\\\,=\\\\simplify{{precround(theta[which],2)}} \\\\, \\\\text{ rad.  (2 d.p.)}. \\\\end{split} \\\\]

\\n

Therefore, for the Cartesian coordinates $(\\\\var{x}, \\\\var{y})$, the equivalent Polar coordinates are \\\\[ [r,\\\\theta] = [\\\\simplify{{precround(r,2)}},\\\\simplify{{precround(theta[which],2)}}].\\\\]

\"", "description": "", "templateType": "long string", "can_override": false}, "quad3": {"name": "quad3", "group": "Ungrouped variables", "definition": "\"

Since $P$ is in the third quadrant, to calculate $\\\\theta$ it can be easier to first calculate the angle formed between the line $OP$ and the negative $x$-axis, and then add this answer to $\\\\pi$ rad. We can define this angle as $\\\\phi$:

\\n

\\\\[ \\\\begin{split} \\\\tan(\\\\phi) &\\\\,= \\\\frac{\\\\var{abs(y)}}{\\\\var{abs(x)}} \\\\\\\\ \\\\implies \\\\phi &\\\\,= \\\\tan^{-1} \\\\left(\\\\simplify[fractionNumbers]{{abs(y)/abs(x)}}\\\\right) \\\\\\\\ &\\\\,=\\\\simplify{{precround((theta[which]-pi),2)}} \\\\, \\\\text{  rad.  (2 d.p.)}. \\\\end{split} \\\\]

\\n

Hence,

\\n

\\\\[ \\\\begin{split} \\\\theta &\\\\,= \\\\pi + \\\\phi \\\\\\\\ &\\\\,=\\\\simplify{{precround(theta[which],2)}} \\\\, \\\\text{ rad.  (2 d.p.)}. \\\\end{split} \\\\]

\\n

Alternatively, if we were to measure $\\\\theta$ by going clockwise from the $x$-axis, 

\\n

\\\\[ \\\\begin{split} \\\\theta &\\\\,= - (\\\\pi - \\\\phi) \\\\\\\\ &\\\\,= \\\\simplify{{precround(theta2[which],2)}} \\\\text{ rad.  (2 d.p.)}.\\\\end{split} \\\\]

\\n

Therefore, for the Cartesian coordinates $(\\\\var{x}, \\\\var{y})$, the equivalent Polar coordinates are \\\\[ [r,\\\\theta] = [\\\\simplify{{precround(r,2)}},\\\\simplify{{precround(theta[which],2)}}],\\\\]

\\n

or 

\\n

\\\\[ [r,\\\\theta] = [\\\\simplify{{precround(r,2)}},\\\\simplify{{precround(theta2[which],2)}}].\\\\]

\"", "description": "", "templateType": "long string", "can_override": false}, "quad4": {"name": "quad4", "group": "Ungrouped variables", "definition": "\"

Since the point $P$ is in the fourth quadrant, to calculate $\\\\theta$ it can be easier to first calculate the angle the line $OP$ and the positive $x$-axis from below, and then subtract this answer from $2\\\\pi$ rad. We can define this angle as $\\\\phi$:

\\n

\\\\[ \\\\begin{split} \\\\tan(\\\\phi) &\\\\,= \\\\frac{\\\\var{abs(y)}}{\\\\var{abs(x)}} \\\\\\\\ \\\\implies \\\\phi &\\\\,= \\\\tan^{-1} \\\\left(\\\\simplify[fractionNumbers]{{abs(y)/abs(x)}}\\\\right) \\\\\\\\ &\\\\,=\\\\simplify{{precround(2*pi-theta[which],2)}} \\\\, \\\\text{  rad.  (2 d.p.)}. \\\\end{split} \\\\]

\\n

Since \\\\[ \\\\begin{split} \\\\theta+\\\\phi &\\\\,= 2\\\\pi \\\\text{  rad.} \\\\\\\\ \\\\implies \\\\theta &\\\\,= 2\\\\pi - \\\\phi \\\\\\\\ &\\\\,=\\\\simplify{{precround(theta[which],2)}} \\\\, \\\\text{ rad.  (2 d.p.)}. \\\\end{split} \\\\]

\\n

Alternatively, if we were to measure $\\\\theta$ by going clockwise from the $x$-axis, 

\\n

\\\\[ \\\\begin{split} \\\\theta &\\\\,= - \\\\phi \\\\\\\\ &\\\\,= \\\\simplify{{precround(theta2[which],2)}} \\\\text{ rad.  (2 d.p.)}.\\\\end{split} \\\\]

\\n

\\n

Therefore, for the Cartesian coordinates $(\\\\var{x}, \\\\var{y})$, the equivalent Polar coordinates are \\\\[ [r,\\\\theta] = [\\\\simplify{{precround(r,2)}},\\\\simplify{{precround(theta[which],2)}}],\\\\]

\\n

or 

\\n

\\\\[ [r,\\\\theta] = [\\\\simplify{{precround(r,2)}},\\\\simplify{{precround(theta2[which],2)}}].\\\\]

\"", "description": "", "templateType": "long string", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["x", "y", "r", "which", "theta", "theta2", "dp", "advice", "quad1", "quad2", "quad3", "quad4"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

$(r, \\theta)=$ ([[0]] , [[1]] )

\n

(Give your answers to 2 decimal places where necessary)

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{precround(r,2)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "alternatives": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "", "useAlternativeFeedback": false, "answer": "{precround(theta2[which],2)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "answer": "{precround(theta[which],2)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}, {"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}], "resources": []}]}], "contributors": [{"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}, {"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}