// Numbas version: finer_feedback_settings {"name": "Katy's copy of Vector addition by applying the parallelogram rule", "extensions": ["geogebra", "weh", "quantities"], "custom_part_types": [{"source": {"pk": 12, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/12/edit"}, "name": "Angle quantity 2020", "short_name": "angle", "description": "

Adjusts all angles to 0 < $\\theta$ < 360.

\n

Accepts '°' and 'deg' as units.

\n

Penalizes if not close enough or no units.

\n

90° = -270° = 450°

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings['expected_answer']) ", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "original_student_scalar:\nmatchnumber(studentAnswer,['plain','en'])[1]\n\nstudent_scalar:\nmod(original_student_scalar,360)\n\n\nstudent_unit:\nstudentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]\n\ninterpreted_unit:\nif(trim(student_unit)='\u00b0','deg',student_unit)\n\ninterpreted_answer:\nqty(mod(student_scalar,360),'deg')\n\nclose:\nwithintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))\n\ncorrect_scalar:\nmod(scalar(settings['expected_answer']),360)\n\nright:\nwithintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))\n\ngood_unit:\nsame(qty(1,interpreted_unit),qty(1,'deg'))\n\nmark:\nassert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))", "marking_notes": [{"name": "original_student_scalar", "description": "

Retuns the scalar part of students answer (which is a quantity) as a number.

", "definition": "matchnumber(studentAnswer,['plain','en'])[1]"}, {"name": "student_scalar", "description": "

Normalize angle with mod 360

", "definition": "mod(original_student_scalar,360)\n"}, {"name": "student_unit", "description": "

matchnumber(studentAnswer,['plain','en'])[0] is a string \"12.34\"

", "definition": "studentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]"}, {"name": "interpreted_unit", "description": "

Allows student to use degree symbol or 'deg' for units.

", "definition": "if(trim(student_unit)='\u00b0','deg',student_unit)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(mod(student_scalar,360),'deg')"}, {"name": "close", "description": "", "definition": "withintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))"}, {"name": "correct_scalar", "description": "

Normalize expected_answer with mod 360

", "definition": "mod(scalar(settings['expected_answer']),360)"}, {"name": "right", "description": "", "definition": "withintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))"}, {"name": "good_unit", "description": "", "definition": "same(qty(1,interpreted_unit),qty(1,'deg'))"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "assert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))"}], "settings": [{"name": "expected_answer", "label": "Expected Answer", "help_url": "", "hint": "Expected angle as a quantity.", "input_type": "code", "default_value": "qty(30,'deg')", "evaluate": true}, {"name": "unit_penalty", "label": "Unit penalty", "help_url": "", "hint": "Penalty for not including degree sign or 'deg'.", "input_type": "percent", "default_value": "20"}, {"name": "close_penalty", "label": "Close Penalty", "help_url": "", "hint": "Penalty for close answer.", "input_type": "percent", "default_value": "20"}, {"name": "close_tol", "label": "Close", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked close.   ", "input_type": "code", "default_value": "0.5", "evaluate": false}, {"name": "right_tol", "label": "Right ", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked correct.  ", "input_type": "code", "default_value": "0.1", "evaluate": false}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}, {"source": {"pk": 14, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/14/edit"}, "name": "Three Significant Digits", "short_name": "three-significant-digits", "description": "

Requires answer to three significant digits for full credit.  Gives 3/4 credit if answer is accurate to 2sf. and 1/4 credit if 1sf

", "help_url": "", "input_widget": "number", "input_options": {"correctAnswer": "settings['correct_answer']", "hint": {"static": true, "value": ""}, "allowedNotationStyles": {"static": true, "value": ["plain", "en"]}, "allowFractions": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "interpreted_answer:\nstudentAnswer\n\ncorrect_answer:\ninput_options[\"correctAnswer\"]\n\nright_sign:\nsign(studentAnswer) = sign(correct_answer)\n\nmark:\nif(right_value & right_sign, correct('Right.'),\n if(close & right_sign, set_credit(0.5, 'Close.'),\n if(right_value, set_credit(0.5, 'Right value, wrong sign.'),\n incorrect('Wrong.'))))\n\nright_value:\nresultsequal(abs(studentAnswer), abs(correct_answer), 'sigfig', 3)\n\nclose:\nresultsequal(abs(studentAnswer), abs(correct_answer), 'sigfig', 2)", "marking_notes": [{"name": "interpreted_answer", "definition": "studentAnswer", "description": "A value representing the student's answer to this part."}, {"name": "correct_answer", "definition": "input_options[\"correctAnswer\"]", "description": ""}, {"name": "right_sign", "definition": "sign(studentAnswer) = sign(correct_answer)", "description": ""}, {"name": "mark", "definition": "if(right_value & right_sign, correct('Right.'),\n if(close & right_sign, set_credit(0.5, 'Close.'),\n if(right_value, set_credit(0.5, 'Right value, wrong sign.'),\n incorrect('Wrong.'))))", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer."}, {"name": "right_value", "definition": "resultsequal(abs(studentAnswer), abs(correct_answer), 'sigfig', 3)", "description": ""}, {"name": "close", "definition": "resultsequal(abs(studentAnswer), abs(correct_answer), 'sigfig', 2)", "description": ""}], "settings": [{"name": "correct_answer", "input_type": "code", "label": "Correct Answer", "default_value": "309", "help_url": "", "evaluate": true, "hint": ""}], "public_availability": "restricted", "published": false, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", "description": "

Find the sum of two 2-dimensional vectors, graphically and exactly using the parallelogram rule.

"}, "functions": {"direction": {"definition": "return Math.atan2(v[1],v[0])\n", "parameters": [["v", "vector"]], "type": "number", "language": "javascript"}}, "ungrouped_variables": [], "parts": [{"marks": 0, "unitTests": [], "variableReplacements": [], "gaps": [{"marks": "2", "unitTests": [], "scripts": {"mark": {"script": "var ans= numbasGGBApplet0.getValue(\"\u03b8_a\")*180/Math.PI;\nthis.resolved_input_options.correctAnswer= Numbas.math.siground(ans,3); \n", "order": "before"}}, "type": "angle", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "settings": {"tolerance": "1", "expected_answer": "0"}, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "variableReplacements": [], "showFeedbackIcon": true}, {"marks": 1, "unitTests": [], "scripts": {"mark": {"script": "var ans= numbasGGBApplet0.getValue(\"\u03b8_b\")*180/Math.PI;\nthis.resolved_input_options.correctAnswer= Numbas.math.siground(ans,3); \n", "order": "before"}}, "type": "angle", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "settings": {"tolerance": "1", "expected_answer": "2"}, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "variableReplacements": [], "showFeedbackIcon": true}, {"marks": "2", "unitTests": [], "scripts": {"mark": {"script": "var ans= numbasGGBApplet0.getValue(\"\u03b8_r\")*180/Math.PI;\nthis.resolved_input_options.correctAnswer= Numbas.math.siground(ans,3); \n", "order": "before"}}, "type": "angle", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "settings": {"tolerance": "1", "expected_answer": "0"}, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "variableReplacements": [], "showFeedbackIcon": true}, {"marks": "2", "unitTests": [], "scripts": {}, "type": "three-significant-digits", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "settings": {"correct_answer": "abs(R)"}, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "variableReplacements": [], "showFeedbackIcon": true}, {"marks": "3", "unitTests": [], "scripts": {"mark": {"script": "var ans= numbasGGBApplet0.getValue(\"\u03b8_r\")*180/Math.PI;\nthis.resolved_input_options.correctAnswer= Numbas.math.siground(ans,3); \n", "order": "before"}}, "type": "angle", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "settings": {"tolerance": "1", "expected_answer": "degrees(direction(R))"}, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "variableReplacements": [], "showFeedbackIcon": true}], "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "prompt": "

Trigonometric (Exact) Solution

\n

\n

Use law of cosines/sines to find the following values, exactly. Give all answers to three significant digits.

\n

$\\theta_A$ = [[0]] 

\n

$\\theta_B$ = [[1]]

\n

$\\theta_R$ = [[2]]

\n

$|\\textbf{R}|$ = [[3]]

\n

$\\theta_x$ = [[4]]

", "scripts": {}, "type": "gapfill", "showCorrectAnswer": true, "sortAnswers": false, "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true}], "variable_groups": [{"variables": ["FB", "dirB", "Ax", "Ay", "units"], "name": "Inputs"}, {"variables": ["A", "dirA", "B", "R"], "name": "Results"}], "variables": {"B": {"definition": "FB vector(cos(radians(dirB)),sin(radians(dirB)))\n", "templateType": "anything", "name": "B", "description": "

Force B

", "group": "Results"}, "dirA": {"definition": "degrees(atan2(Ay,Ax))", "templateType": "anything", "name": "dirA", "description": "

Direction of force A, based on Ax and Ay.

", "group": "Results"}, "units": {"definition": "random(['lb','N','kN','kip'])", "templateType": "anything", "name": "units", "description": "", "group": "Inputs"}, "FB": {"definition": "random(5..100#5)", "templateType": "anything", "name": "FB", "description": "

Magnitude of force B,  Magnitude of A is twice this value.

", "group": "Inputs"}, "Ay": {"definition": "random(-4..4 except 0)", "templateType": "anything", "name": "Ay", "description": "", "group": "Inputs"}, "dirB": {"definition": "(random(0..360#15 except 0..360#45))", "templateType": "anything", "name": "dirB", "description": "", "group": "Inputs"}, "A": {"definition": "2 FB vector(cos(radians(dirA)),sin(radians(dirA)))", "templateType": "anything", "name": "A", "description": "

Force A

", "group": "Results"}, "R": {"definition": "A + B", "templateType": "anything", "name": "R", "description": "", "group": "Results"}, "Ax": {"definition": "random(-4..4 except 0)", "templateType": "anything", "name": "Ax", "description": "", "group": "Inputs"}}, "name": "Katy's copy of Vector addition by applying the parallelogram rule", "rulesets": {}, "preamble": {"js": "Numbas.extensions.weh.scope.ggbApplet.then((diagram) => doThings(diagram));\n\nvar doThings = function(applet){\n applet.setVisible('show',false);\n};\n\n\n\n", "css": ""}, "tags": [], "statement": "

Vector Addition: $\\textbf{R}$ = $\\textbf{A}$ + $\\textbf{B}$

\n

Find the magnitude and direction of resultant $\\textbf{R}$ when $A$ = {2 FB} {units} and $B$ = {FB} {units},

\n

by using triginometry.

\n

{geogebra_applet('udgn8s84',[['A_x',Ax],['A_y',Ay],['θ_B',radians(dirB)]])}

", "advice": "

Procedure:

\n
    \n
  1. Draw a neat diagram and label the unknown side and angles.
  2. \n
  3. Determine the angle opposite the unknown force $\\textbf{R}$.
  4. \n
  5. Use law of cosines to determine the magnitude $|\\textbf{R}|$
  6. \n
  7. Use either the law of sines or cosines to determine the other two angles.
  8. \n
  9. Use the angles you have found to determine the direction of force $\\textbf{R}$ from the x-axis.
  10. \n
", "extensions": ["geogebra", "weh"], "variablesTest": {"condition": "dirA <> dirB", "maxRuns": "200"}, "type": "question", "contributors": [{"name": "Katy Dobson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/854/"}, {"name": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}]}]}], "contributors": [{"name": "Katy Dobson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/854/"}, {"name": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}]}