// Numbas version: finer_feedback_settings {"name": "Exploiter le th\u00e9or\u00e8me de l'\u00e9nergie cin\u00e9tique", "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.
\nIf 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.
\nMarking 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:Utilisation du théorème de l'énergie cinétique dans le cas d'une force constante colinéaire à la vitesse.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "L'objet est en chute libre, donc il n'est soumis qu'à une seule force : son poids $\\vec{P} = m\\vec{g}$
\n$\\overrightarrow{AB}$ et $\\vec{g}$ sont de même direction et sens, donc le travail du poids entre A et B :
\n$W_{A\\to B}(\\vec{P}) = \\overrightarrow{AB}\\cdot\\vec{P} = mgh$
\nPar le théorème de l'énergie cinétique on peut donc écrire :
\n$\\begin{align*}E_c(B) - E_c(A) &= W_{A\\to B}(\\vec{P})\\\\[16pt]\\frac{1}{2}m{v_B}^2 - 0 &= mgh\\end{align*}$
\nEn effet la vitesse au point A est nulle, donc l'énergie cinétique au point A est nulle.
\nIl ne reste plus qu'à isoler $v_B$ :
\n$\\begin{align*}\\frac{1}{2}m{v_B}^2 = mgh &\\Leftrightarrow {v_B}^2 = 2gh\\\\&\\Leftrightarrow v_B = \\sqrt{2gh}\\end{align*}$
\nD'où une vitesse au point B : $v_B = \\sqrt{2\\times9.81 \\ \\mathrm{m.s^{-2}}\\times \\var{d}}$
\n$\\overrightarrow{AB}$ et $\\vec{F}$ la force de freinage sont de même direction mais de sens opposés , donc le travail de la force de freinage entre A et B :
\n$W_{A\\to B}(\\vec{F}) = -\\overrightarrow{AB}\\cdot\\vec{F} = -AB\\times F$
\nSeule la force de freinage travaille, donc par le théorème de l'énergie cinétique on peut écrire :
\n$\\begin{align*}E_c(B) - E_c(A) &= W_{A\\to B}(\\vec{F})\\\\[16pt]0- \\frac{1}{2}m{v_A}^2 &= -AB\\times F\\end{align*}$
\nEn effet la vitesse au point B est nulle, donc l'énergie cinétique au point B est nulle.
\nIl ne reste plus qu'à isoler la distance d'arrèt $AB$ :
\n$-\\frac{1}{2}m{v_A}^2 = -AB\\times F \\Leftrightarrow AB = \\dfrac{m {v_A}^2}{2F}$
\nPour utilser cette formule il ne faut pas oublier de convertir les km/h en m/s (1 N = 1 kg.m.s-2) :
\n$v_A = \\var{v} = \\dfrac{\\var{scalar(v)} \\ \\mathrm{km}}{1 \\ \\mathrm{h}} = \\dfrac{\\var{scalar(v)}\\times 1000 \\ \\mathrm{m}}{3600 \\ \\mathrm{s}} = \\var{siground(v in \"m/s\",3)}$
\nD'où une distance d'arrèt: $AB = \\dfrac{\\var{m}\\times (\\var{siground(v in \"m/s\",3)})^2}{2\\times\\var{F}} = \\var{d}$
\nOn lache à vitesse nulle un objet de masse $m$ = {m} depuis un point A
\nLe point A est situé à une hauteur $h$ = {d} d'un point B
\nL'accélérationd de la pesanteur $g$ = 9.81 m.s-2
\nOn suppose que l'objet est en chute libre.
\nUtiliser le théorème de l'énergie cinétique pour calculer la vitesse $v_B$ de l'objet au point B : [[0]]
\nUne voiture de masse $m$ = {m} se déplace en ligne droite sur une route {etat_route} à la vitesse $v$ = {v}.
\nAu point A, le conducteur appuie sur la pédale de frein, le véhicule s'arrète au point B.
\nLe freinage est modélisé par une force constante de norme $F$ = {F} de sens opposé à la vitesse du véhicule.
\nSeule la force de freinage travaille.
\nUtiliser le théorème de l'énergie cinétique pour calculer la distance de freinage AB : [[0]]
\n