// Numbas version: finer_feedback_settings {"name": "Forberedelsestest Coulombs lov", "metadata": {"description": "", "licence": "None specified"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": false, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", "", "", "", ""], "variable_overrides": [[], [], [], [], [], []], "questions": [{"name": "Coulomb-distanse", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "feedback": {"showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "allowrevealanswer": true, "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview"}, "contributors": [{"name": "B\u00f8rge Irgens", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3579/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

To punktladninger påvirker hverandre med en elektrisk kraft med størrelse \\(F_{\\mathrm{gammel}}\\) når avstanden mellom dem er \\(r\\).

\n

Avstanden endres til \\(\\var[fractionNumbers]{s}r\\). Begge ladningene er uendret.

", "advice": "

Fra Coulombs lov har vi at kraftstørrelsen er omvendt proporsjonal med kvadratet av avstanden:

\n

$$F=k\\frac{|q_1q_2|}{r^2}.$$

\n

Siden begge ladningene er uendret, får vi

\n

$$\\begin{aligned} \\frac{F_{\\mathrm{ny}}}{F_{\\mathrm{gammel}}} &=\\frac{k|q_1q_2|/(\\var[fractionNumbers]{s}r)^2} {k|q_1q_2|/r^2}\\\\ &=\\frac{1}{(\\var[fractionNumbers]{s})^2}\\\\ &=\\var[fractionNumbers]{ratio}. \\end{aligned}$$

\n

Den nye kraftstørrelsen blir dermed

\n

$$F_{\\mathrm{ny}}= \\var[fractionNumbers]{ratio}F_{\\mathrm{gammel}}.$$

\n

Kraften blir altså {change}.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"s": {"name": "s", "group": "Ungrouped variables", "definition": "random([1/4,1/3,1/2,2,3,4])", "description": "", "templateType": "anything", "can_override": false}, "ratio": {"name": "ratio", "group": "Ungrouped variables", "definition": "1/s^2", "description": "", "templateType": "anything", "can_override": false}, "change": {"name": "change", "group": "Ungrouped variables", "definition": "if(s>1,\"mindre\",\"st\u00f8rre\")", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["s", "ratio", "change"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "prompt": "

Hva blir forholdet mellom den nye og den opprinnelige kraftstørrelsen?

\n

\\[ \\frac{F_{\\mathrm{ny}}}{F_{\\mathrm{gammel}}} \\]

\n

Svar med en brøk eller et desimaltall. Bruk minst fire desimaler dersom desimaltallet må avrundes.

", "minValue": "ratio-0.00005", "maxValue": "ratio+0.00005", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "ratio", "showFractionHint": false, "notationStyles": ["plain", "plain-eu", "scientific"], "correctAnswerStyle": "plain-eu"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "showAllParts": false}, {"name": "Forskyvningsvektor", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "feedback": {"showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "allowrevealanswer": true, "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview"}, "contributors": [{"name": "B\u00f8rge Irgens", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3579/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

En punktladning ligger i punktet \\(S=(\\var{xs},\\,\\var{ys})\\,\\mathrm{m}\\).

\n

Om vi er interessert i det elektriske feltet i punktet \\(P=(\\var{xp},\\,\\var{yp})\\,\\mathrm{m}\\) trenger vi forskyvningsvektoren \\(\\vec R\\) som peker fra S til P.

", "advice": "

En forskyvningsvektor er sluttposisjon minus startposisjon. Her starter vi i kildepunktet S og ender i observasjonspunktet P: \\(\\vec R=\\vec r_P-\\vec r_S\\).

\n

Vi trekker fra komponentvis:

\n

\\[ R_x= \\left[\\var{xp}-(\\var{xs})\\right]\\mathrm{m} =\\var{dx}\\,\\mathrm{m}, \\]

\n

\\[ R_y= \\left[\\var{yp}-(\\var{ys})\\right]\\mathrm{m} =\\var{dy}\\,\\mathrm{m}. \\]

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"xp": {"name": "xp", "group": "Ungrouped variables", "definition": "xs+dx", "description": "", "templateType": "anything", "can_override": false}, "xs": {"name": "xs", "group": "Ungrouped variables", "definition": "random(-3..3)", "description": "", "templateType": "anything", "can_override": false}, "yp": {"name": "yp", "group": "Ungrouped variables", "definition": "ys+dy", "description": "", "templateType": "anything", "can_override": false}, "ys": {"name": "ys", "group": "Ungrouped variables", "definition": "random(-3..3)", "description": "", "templateType": "anything", "can_override": false}, "dx": {"name": "dx", "group": "Ungrouped variables", "definition": "random(-4..4 except 0)", "description": "", "templateType": "anything", "can_override": false}, "dy": {"name": "dy", "group": "Ungrouped variables", "definition": "random(-4..4 except 0)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["ys", "xs", "xp", "yp", "dx", "dy"], "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, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "prompt": "

Finn x- og y-komponenten til forskyvningsvektoren:

\n

\\(\\vec{R}=(\\)  [[0]]\\(\\hat{x}+\\)  [[1]]\\(\\hat{y})~\\mathrm{m}\\)

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "minValue": "dx", "maxValue": "dx", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "minValue": "dy", "maxValue": "dy", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false, "inlineCorrectAnswer": true}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "showAllParts": false}, {"name": "Superposisjon 1D", "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 239, "author": {"name": "Timur Zaripov", "pk": 3272}, "edit_page": "/part_type/239/edit"}, "name": "Quantity with units (relative tolerance)", "short_name": "quantity-with-units-relative-tolerance", "description": "

The student enters a quantity with units. Answer accepted as correct within range defined as percentage of expected answer.

", "help_url": "https://github.com/numbas/numbas-extension-quantities", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings[\"correctAnswer\"])", "hint": {"static": false, "value": "switch(\n settings[\"hint\"]=\"remind units\",\n \"Include units in your answer.\",\n settings[\"hint\"]=\"show units\",\n \"Give your answer in \"+units_string(settings[\"correctAnswer\"])+\" to \"+string(settings[\"wiggle\"])+\"% accuracy\"\n ,\n \"\"\n)"}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\napply(valid_number);\napply(student_quantity);\napply(has_units);\napply(compatible);\ntry(\n correctif(close_enough),\n x,\n apply(student_quantity)\n);\napply(same_units)\n\ninterpreted_answer:\nstudent_quantity\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_number:\nmatch_student_number[1]\n\nraw_student_units:\ntry(\n quantity(studentAnswer[len(match_student_number[0])..len(studentAnswer)]),\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)\n\nstudent_units:\nif(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)\n\nstudent_quantity:\napply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\ncompatible:\nif(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)\n\ncorrect_units:\nunits(correct_quantity)\n\nsame_units:\nassert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)\n\nhas_units:\nassert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)\n\ncan_compare:\ncompatible or settings[\"incompatible_units_action\"]=\"convert\"\n\nclose_enough:\nif(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)\n\nwiggle:\nabs(eval(settings[\"wiggle\"]))*0.01*abs(settings[\"correctAnswer\"])\n\nvalid_number:\nif(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "apply(valid_number);\napply(student_quantity);\napply(has_units);\napply(compatible);\ntry(\n correctif(close_enough),\n x,\n apply(student_quantity)\n);\napply(same_units)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "student_quantity"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_number", "description": "

The scalar part of the student's quantity

", "definition": "match_student_number[1]"}, {"name": "raw_student_units", "description": "

The units of the student's quantity, before converting.

", "definition": "try(\n quantity(studentAnswer[len(match_student_number[0])..len(studentAnswer)]),\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "student_units", "description": "

The units of the student's quantity.

\n

If the student used units incompatible with the units in the expected answer, and the \"what to do if incompatible units used\" option is set to \"mark as if correct units used\", the student's units are ignored and the expected units are used instead.

", "definition": "if(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)"}, {"name": "student_quantity", "description": "

The student's answer, interpreted as a quantity.

\n

Marking fails if the student does not enter a valid quantity.

", "definition": "apply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]"}, {"name": "compatible", "description": "

Are the units of the student's quantity compatible with the units of the expected quantity?

", "definition": "if(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"name": "same_units", "description": "

/Are the student's quantity and the expected quantity in exactly the same units?

", "definition": "assert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)"}, {"name": "has_units", "description": "", "definition": "assert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)"}, {"name": "can_compare", "description": "

Can the student's answer be compared with the correct answer? True if compatible units used, or \"mark as if correct units used\" selected.

", "definition": "compatible or settings[\"incompatible_units_action\"]=\"convert\""}, {"name": "close_enough", "description": "

Is the student's quantity within the allowed tolerance of the expected answer?

", "definition": "if(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)"}, {"name": "wiggle", "description": "", "definition": "abs(eval(settings[\"wiggle\"]))*0.01*abs(settings[\"correctAnswer\"])"}, {"name": "valid_number", "description": "

Is the scalar part of the student's answer a valid number?

", "definition": "if(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )\n"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The expected quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "hint", "label": "Input hint", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "remind units", "choices": [{"value": "none", "label": "None"}, {"value": "remind units", "label": "Remind to include units"}, {"value": "show units", "label": "Show required units"}]}, {"name": "allow_unitless", "label": "Allow unitless answer?", "help_url": "", "hint": "If not ticked, the student is prevented from submitting an answer without specifying units.", "input_type": "checkbox", "default_value": true}, {"name": "incompatible_units_action", "label": "What to do if incompatible units used", "help_url": "", "hint": "If the student's answer is given in units incompatible with the correct answer's units:
\n", "input_type": "dropdown", "default_value": "incorrect", "choices": [{"value": "incorrect", "label": "Mark as incorrect"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "convert", "label": "Mark as if correct units used"}]}, {"name": "different_units_action", "label": "What to do if different units used", "help_url": "", "hint": "If the student's answer is given in different units to the expected answer:
\n", "input_type": "dropdown", "default_value": "convert", "choices": [{"value": "convert", "label": "Convert"}, {"value": "warn", "label": "Warn and convert"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "incorrect", "label": "Mark incorrect"}]}, {"name": "different_units_penalty", "label": "Penalty if different units used", "help_url": "", "hint": "This penalty is applied if the student gives their answer in different units to the expected answer. The selected percentage of the student's score is taken away.", "input_type": "percent", "default_value": "100"}, {"name": "wiggle", "label": "Realtive margin of error in %", "help_url": "", "hint": "The student's answer is marked correct if the difference between it and the correct answer is at most this percentage of the correct answer.", "input_type": "mathematical_expression", "default_value": "2", "subvars": true}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "feedback": {"showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "allowrevealanswer": true, "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview"}, "contributors": [{"name": "B\u00f8rge Irgens", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3579/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

To punktladninger holdes fast på x-aksen:

\n\n

Bruk \\(k=9.0\\cdot10^9\\,\\mathrm{N\\,m^2/C^2}\\). Positiv x-retning er mot høyre.

", "advice": "

Vi finner feltbidraget fra hver ladning og summerer komponentene med fortegn.

\n

Origo ligger til høyre for A. En positiv ladning A gir derfor felt mot høyre, mens en negativ ladning A gir felt mot venstre:

\n

\\[\\vec{E}_A=\\frac{kQ_A}{r_A^2}\\hat{x}=\\left(\\var{ea}\\right)\\hat{x}\\]

\n

Origo ligger til venstre for B. En positiv ladning B gir derfor felt mot venstre, mens en negativ ladning B gir felt mot høyre:

\n

\\[ \\vec{E}_{B}=-\\frac{kQ_B}{r_B^2}\\hat{x} =\\left(\\var{eb}\\right)\\hat{x}\\]

\n

Ved superposisjon blir det samlede feltet \\(\\vec{E}=\\vec{E}_A+\\vec{E}_B=\\left(\\var{e_net}\\right)\\hat{x}\\).

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"qa": {"name": "qa", "group": "Ungrouped variables", "definition": "qty(random(-4..4 except 0),\"nC\")", "description": "", "templateType": "anything", "can_override": false}, "qb": {"name": "qb", "group": "Ungrouped variables", "definition": "qty(random(-4..4 except 0),\"nC\")", "description": "", "templateType": "anything", "can_override": false}, "xa": {"name": "xa", "group": "Ungrouped variables", "definition": "qty(random(-4..-1),\"dm\")", "description": "", "templateType": "anything", "can_override": false}, "e_net": {"name": "e_net", "group": "Ungrouped variables", "definition": "precround(ea+eb,8)", "description": "", "templateType": "anything", "can_override": false}, "xb": {"name": "xb", "group": "Ungrouped variables", "definition": "qty(random(1..4),\"dm\")", "description": "", "templateType": "anything", "can_override": false}, "ea": {"name": "ea", "group": "Ungrouped variables", "definition": "k*qa/(xa*xa)", "description": "", "templateType": "anything", "can_override": false}, "eb": {"name": "eb", "group": "Ungrouped variables", "definition": "-k*qb/(xb*xb)", "description": "", "templateType": "anything", "can_override": false}, "k": {"name": "k", "group": "Ungrouped variables", "definition": "qty(9*10^9,\"N*m^2/C^2\")", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": ""}, "ungrouped_variables": ["qa", "qb", "xa", "xb", "e_net", "ea", "eb", "k"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "quantity-with-units-relative-tolerance", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "prompt": "

Hva er x-komponenten \\(E_x\\) av det elektriske feltet i origo?

\n

Ta med fortegn: positivt for felt mot høyre og negativt for felt mot venstre. Svar 0 N/C dersom feltet er null. Bruk minst tre desimaler dersom svaret må avrundes.

", "settings": {"correctAnswer": "e_net", "hint": "remind units", "allow_unitless": false, "incompatible_units_action": "incorrect", "different_units_action": "convert", "different_units_penalty": "100", "wiggle": "2"}}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "showAllParts": false}, {"name": "Kraft mellom to ladde partikler", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "feedback": {"showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "allowrevealanswer": true, "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview"}, "contributors": [{"name": "B\u00f8rge Irgens", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3579/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "

To partikler holdes fast i en avstand \\(R\\) fra hverandre. De har ladning \\(Q_A=\\var{qa}e\\) og \\(Q_B=\\var{qb}e\\) så påvirker hverandre med elektriske krefter. 

", "advice": "

Coulombs lov gir samme kraftstørrelse for begge ladningene: \\[F=k\\frac{|q_Aq_B|}{R^2}.\\]

\n

Kreftene er like store og motsatt rettet, i samsvar med Newtons tredje lov. Siden ladningene har motsatt fortegn, peker kreftene mot hverandre.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"qa": {"name": "qa", "group": "Ungrouped variables", "definition": "random(1..6)", "description": "", "templateType": "anything", "can_override": false}, "qb": {"name": "qb", "group": "Ungrouped variables", "definition": "-random(1..7 except qa)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["qa", "qb"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "prompt": "

Hvilken figur viser de elektriske kreftene som ladningene virker på hverandre med?

\n

Pilretningen viser kraftretningen, og pillengden viser kraftens størrelse. Alle figurene bruker samme skala. A er til venstre og B til høyre.

", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showBlankOption": true, "showCellAnswerState": true, "interpretedAnswerForm": "list of list of boolean", "choices": [" A B ", " A B ", " A B ", " A B ", " A B "], "matrix": ["1", 0, 0, 0, 0], "distractors": ["", "", "", "", ""]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "showAllParts": false}, {"name": "Likevektspunkt med to ladninger", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "feedback": {"showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "allowrevealanswer": true, "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview"}, "contributors": [{"name": "B\u00f8rge Irgens", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3579/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "

To positive punktladninger holdes fast på x-aksen. Ladning A har \\(Q_A=\\var{qa}e\\) og ligger i \\(x=0\\). Ladning B har \\(Q_B=\\var{qb}e\\) og ligger i \\(x=d\\), hvor \\(d>0\\) og \\(e\\) er elementærladningen.

\n

x + + A B 0 d

\n

En tredje punktladning har ladning \\(q=-e\\) og plasseres langs x-aksen.

", "advice": "

Den negative ladningen tiltrekkes av begge de positive ladningene. Utenfor dem peker kreftene samme vei. Likevektspunktet må derfor ligge mellom dem.

\n

Mellom ladningene peker kreftene motsatt vei. Den største positive ladningen ville gitt størst kraft ved lik avstand. Den negative ladningen må derfor plasseres nærmere den minste positive ladningen for at kreftene skal bli like store.

\n

Ved likevekt, med \\(0<x<d\\), gjelder \\[k\\frac{Q_A|q|}{x^2} = k\\frac{Q_B|q|}{(d-x)^2}.\\]

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"qa": {"name": "qa", "group": "Ungrouped variables", "definition": "random(1..7)", "description": "", "templateType": "anything", "can_override": false}, "qb": {"name": "qb", "group": "Ungrouped variables", "definition": "random(1..7 except qa)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["qa", "qb"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "prompt": "

Hvor må den negative ladningen plasseres for at den samlede elektriske kraften på den skal være null?

\n

Du trenger ikke beregne den nøyaktige posisjonen.

", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showBlankOption": true, "showCellAnswerState": true, "interpretedAnswerForm": "list of list of boolean", "choices": ["Til venstre for begge de positive ladningene.", "Mellom ladningene, nærmest A.", "Midt mellom ladningene.", "Mellom ladningene, nærmest B.", "Til høyre for begge de positive ladningene."], "matrix": [0, "if(qaEn tynn tråd har lengde \\(L=\\var{length}\\) og total ladning \\(Q=\\var{qtotal}\\). Ladningen er jevnt fordelt langs tråden.

\n

Vi deler tråden opp i små biter. En av bitene har lengde \\(d\\ell\\) og ladning \\(dq\\).

", "advice": "

Når ladningen er jevnt fordelt, er den lineære ladningstettheten \\[\\lambda=\\frac{Q}{L} =\\frac{\\var{qtotal}}{\\var{length}} =\\var{density}.\\]

\n

Ladningen på en liten bit med lengde \\(d\\ell\\) blir dermed \\[dq=\\lambda\\,d\\ell =\\left(\\var{density}\\right)d\\ell. \\]

\n

Vi kan kontrollere enheten:

\n

\\[ \\frac{\\mathrm{C}}{\\mathrm{m}}\\cdot\\mathrm{m} =\\mathrm{C}. \\]

\n

Dette ladningselementet kan vi bruke i Coulombs lov for å finne feltbidraget fra den lille biten.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"length": {"name": "length", "group": "Ungrouped variables", "definition": "qty(random(2..6),\"m\")", "description": "", "templateType": "anything", "can_override": false}, "qtotal": {"name": "qtotal", "group": "Ungrouped variables", "definition": "density*length", "description": "", "templateType": "anything", "can_override": false}, "density": {"name": "density", "group": "Ungrouped variables", "definition": "qty(random(2..9),\"nC/m\")", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["length", "qtotal", "density"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "prompt": "

Hvilket uttrykk beskriver ladningen \\(dq\\) på den lille biten?

", "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showBlankOption": true, "showCellAnswerState": true, "interpretedAnswerForm": "list of list of boolean", "choices": ["\\(dq=\\left(\\var{density}\\right)d\\ell \\)", "\\(dq=\\left(\\var{qtotal}\\right)d\\ell \\)", "\\(dq=\\frac{\\var{density}}{d\\ell}\\)", "\\(dq=\\var{density}\\)"], "matrix": ["1", 0, 0, 0], "distractors": ["", "", "", ""]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "showAllParts": false}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": true, "navigatemode": "sequence", "onleave": {"action": "none", "message": ""}, "preventleave": true, "typeendtoleave": false, "startpassword": "", "autoSubmit": true, "allowAttemptDownload": false, "downloadEncryptionKey": "", "showThemeLinks": true, "showresultspage": "oncompletion"}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"enterreviewmodeimmediately": true, "showactualmarkwhen": "inreview", "showtotalmarkwhen": "inreview", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview", "allowrevealanswer": true, "intro": "", "end_message": "", "results_options": {"printquestions": true, "printadvice": true}, "feedbackmessages": [], "reviewshowexpectedanswer": true, "showanswerstate": true, "reviewshowfeedback": true, "showactualmark": false, "showtotalmark": false, "reviewshowscore": true, "reviewshowadvice": true}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "contributors": [{"name": "B\u00f8rge Irgens", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3579/"}], "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 239, "author": {"name": "Timur Zaripov", "pk": 3272}, "edit_page": "/part_type/239/edit"}, "name": "Quantity with units (relative tolerance)", "short_name": "quantity-with-units-relative-tolerance", "description": "

The student enters a quantity with units. Answer accepted as correct within range defined as percentage of expected answer.

", "help_url": "https://github.com/numbas/numbas-extension-quantities", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings[\"correctAnswer\"])", "hint": {"static": false, "value": "switch(\n settings[\"hint\"]=\"remind units\",\n \"Include units in your answer.\",\n settings[\"hint\"]=\"show units\",\n \"Give your answer in \"+units_string(settings[\"correctAnswer\"])+\" to \"+string(settings[\"wiggle\"])+\"% accuracy\"\n ,\n \"\"\n)"}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\napply(valid_number);\napply(student_quantity);\napply(has_units);\napply(compatible);\ntry(\n correctif(close_enough),\n x,\n apply(student_quantity)\n);\napply(same_units)\n\ninterpreted_answer:\nstudent_quantity\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_number:\nmatch_student_number[1]\n\nraw_student_units:\ntry(\n quantity(studentAnswer[len(match_student_number[0])..len(studentAnswer)]),\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)\n\nstudent_units:\nif(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)\n\nstudent_quantity:\napply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\ncompatible:\nif(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)\n\ncorrect_units:\nunits(correct_quantity)\n\nsame_units:\nassert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)\n\nhas_units:\nassert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)\n\ncan_compare:\ncompatible or settings[\"incompatible_units_action\"]=\"convert\"\n\nclose_enough:\nif(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)\n\nwiggle:\nabs(eval(settings[\"wiggle\"]))*0.01*abs(settings[\"correctAnswer\"])\n\nvalid_number:\nif(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "apply(valid_number);\napply(student_quantity);\napply(has_units);\napply(compatible);\ntry(\n correctif(close_enough),\n x,\n apply(student_quantity)\n);\napply(same_units)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "student_quantity"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_number", "description": "

The scalar part of the student's quantity

", "definition": "match_student_number[1]"}, {"name": "raw_student_units", "description": "

The units of the student's quantity, before converting.

", "definition": "try(\n quantity(studentAnswer[len(match_student_number[0])..len(studentAnswer)]),\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "student_units", "description": "

The units of the student's quantity.

\n

If the student used units incompatible with the units in the expected answer, and the \"what to do if incompatible units used\" option is set to \"mark as if correct units used\", the student's units are ignored and the expected units are used instead.

", "definition": "if(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)"}, {"name": "student_quantity", "description": "

The student's answer, interpreted as a quantity.

\n

Marking fails if the student does not enter a valid quantity.

", "definition": "apply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]"}, {"name": "compatible", "description": "

Are the units of the student's quantity compatible with the units of the expected quantity?

", "definition": "if(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"name": "same_units", "description": "

/Are the student's quantity and the expected quantity in exactly the same units?

", "definition": "assert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)"}, {"name": "has_units", "description": "", "definition": "assert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)"}, {"name": "can_compare", "description": "

Can the student's answer be compared with the correct answer? True if compatible units used, or \"mark as if correct units used\" selected.

", "definition": "compatible or settings[\"incompatible_units_action\"]=\"convert\""}, {"name": "close_enough", "description": "

Is the student's quantity within the allowed tolerance of the expected answer?

", "definition": "if(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)"}, {"name": "wiggle", "description": "", "definition": "abs(eval(settings[\"wiggle\"]))*0.01*abs(settings[\"correctAnswer\"])"}, {"name": "valid_number", "description": "

Is the scalar part of the student's answer a valid number?

", "definition": "if(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )\n"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The expected quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "hint", "label": "Input hint", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "remind units", "choices": [{"value": "none", "label": "None"}, {"value": "remind units", "label": "Remind to include units"}, {"value": "show units", "label": "Show required units"}]}, {"name": "allow_unitless", "label": "Allow unitless answer?", "help_url": "", "hint": "If not ticked, the student is prevented from submitting an answer without specifying units.", "input_type": "checkbox", "default_value": true}, {"name": "incompatible_units_action", "label": "What to do if incompatible units used", "help_url": "", "hint": "If the student's answer is given in units incompatible with the correct answer's units:
\n", "input_type": "dropdown", "default_value": "incorrect", "choices": [{"value": "incorrect", "label": "Mark as incorrect"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "convert", "label": "Mark as if correct units used"}]}, {"name": "different_units_action", "label": "What to do if different units used", "help_url": "", "hint": "If the student's answer is given in different units to the expected answer:
\n", "input_type": "dropdown", "default_value": "convert", "choices": [{"value": "convert", "label": "Convert"}, {"value": "warn", "label": "Warn and convert"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "incorrect", "label": "Mark incorrect"}]}, {"name": "different_units_penalty", "label": "Penalty if different units used", "help_url": "", "hint": "This penalty is applied if the student gives their answer in different units to the expected answer. The selected percentage of the student's score is taken away.", "input_type": "percent", "default_value": "100"}, {"name": "wiggle", "label": "Realtive margin of error in %", "help_url": "", "hint": "The student's answer is marked correct if the difference between it and the correct answer is at most this percentage of the correct answer.", "input_type": "mathematical_expression", "default_value": "2", "subvars": true}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": []}