// Numbas version: finer_feedback_settings {"name": "37. Relationships between Shear and Bending Moment", "metadata": {"description": "

Homeworks 36, 37, 38 and 39 don't resume properly in Numbas LTI, so broken into individual problems.

", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": false, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", ""], "variable_overrides": [[], []], "questions": [{"name": "VM7: Symmetric parabolic loading", "extensions": ["jsxgraph", "polynomials", "quantities"], "custom_part_types": [{"source": {"pk": 19, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/19/edit"}, "name": "Engineering Accuracy with units", "short_name": "engineering-answer", "description": "

A value with units marked right if within an adjustable % error of the correct value.  Marked close if within a wider margin of error.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "siground(settings['correctAnswer'],4)", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\n\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\n\n\ncorrect_units:\nunits(correct_quantity)\n\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_scalar:\nmatch_student_number[1]\n\nstudent_units:\nreplace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")\n\ngood_units:\ntry(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n\n\nstudent_quantity:\nswitch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n\n\npercent_error:\ntry(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n \n\nright:\npercent_error <= settings['right']\n\n\nclose:\nright_sign and percent_error <= settings['close']\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)", "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": "switch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)\n\n"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]\n\n"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)\n"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_scalar", "description": "", "definition": "match_student_number[1]"}, {"name": "student_units", "description": "

Modify the unit portion of the student's answer by

\n

1. replacing \"ohms\" with \"ohm\"  case insensitive

\n

2. replacing '-' with ' ' 

\n

3. replacing '°' with ' deg' 

\n

to allow answers like 10 ft-lb and 30°

", "definition": "replace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")"}, {"name": "good_units", "description": "", "definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n"}, {"name": "student_quantity", "description": "

This fixes the student answer for two common errors.  

\n

If student_units are wrong  - replace with correct units

\n

If student_scalar has the wrong sign - replace with right sign

\n

If student makes both errors, only one gets fixed.

", "definition": "switch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n"}, {"name": "percent_error", "description": "", "definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n "}, {"name": "right", "description": "", "definition": "percent_error <= settings['right']\n"}, {"name": "close", "description": "

Only marked close if the student actually has the right sign.

", "definition": "right_sign and percent_error <= settings['close']"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity) "}], "settings": [{"name": "correctAnswer", "label": "Correct Quantity.", "help_url": "", "hint": "The correct answer given as a JME quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "right", "label": "% Accuracy for right.", "help_url": "", "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "0.2", "evaluate": true}, {"name": "close", "label": "% Accuracy for close.", "help_url": "", "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "1.0", "evaluate": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units.  if correct answer is 100 N and close is ±1%,
99  N is accepted.", "input_type": "percent", "default_value": "75"}, {"name": "C2", "label": "No units or wrong sign", "help_url": "", "hint": "Partial credit for forgetting units or using wrong sign.
If the correct answer is 100 N, both 100 and -100 N are accepted.", "input_type": "percent", "default_value": "50"}, {"name": "C3", "label": "Close, no units.", "help_url": "", "hint": "Partial Credit for close value but forgotten units.
This value would be close if the expected units were provided.  If the correct answer is 100 N, and close is ±1%,
99 is accepted.", "input_type": "percent", "default_value": "25"}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": ["question-resources/newVM_cA1Sig0.ggb"], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}], "tags": ["gets answer from ggb", "Mechanics", "mechanics", "shear and bending moment", "Statics", "statics"], "metadata": {"description": "

 Students must derive the shear and bending moment functions for beam loaded with a parabolic distributed load described with a loading function.  Diagrams are given, but the students must derive the equations by integration.

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

A {qty(2b, units[0])} long, simply-supported beam is subjected to a symmetrical parabolic loading, where

\n

\\[w(x) =\\simplify[fractionNumbers]{{w}} \\quad [\\var{units_string(qty(1,units[3]))}]\\].

\n

$V(x) =\\simplify[fractionNumbers]{{v}}$  $[\\var{units_string(qty(1,units[1]))}]$.

\n

$M(x) =\\simplify[fractionNumbers]{{m}}$   $[\\var{units_string(qty(1,units[2]))}]$.

\n

{loadBoard}

\n

{shearBoard}

\n

{momentBoard}

\n

", "advice": "

Given:  The beam is $\\var{qty(L, units[0])}$ long. The loading function is \\[w(x) = \\simplify[fractionNumbers]{{w}}.\\]

\n

The area under the loading function is the downward force on the beam. Here, because positive values of $w$ point down, we replace $w(x)$ with $-w(x)$  to agree with the standard convention that negative forces point down.

\n

1.  The total load acting on the beam is the integral loading function from $0$ to $L$.

\n

\\[\\begin{align}W &= -\\int_0^L w(x)\\; dx \\\\
&= \\int_0^L \\simplify[fractionNumbers]{{-w}}\\; dx\\\\
&=  \\left. \\simplify[fractionNumbers]{{polynomial(x,[ 0,0,-h/b, h/(b^2)/3])}}\\;\\right |_0^L \\\\
&= \\var{force(load_integral)}
\\end{align}\\]

\n

By symmetry, the reactions at $x=0$ and $x= L$ are each half this load, pointing up, so:

\n

\\[\\begin{align}A &= B=W/2 \\\\
 &=\\var{-force(load_integral/2)}\\end{align}\\]

\n

2.   The shear function $V(x)$ is the integral of the loading function $w(x)$.  

\n

\\[\\begin{align} V(x) &= -\\int w(x)\\; dx \\\\
&= \\int \\simplify[fractionNumbers]{{-w}}\\;dx\\\\
&= \\simplify[fractionNumbers]{{polynomial(x,[ 0,0, -h/b, h/(b^2)/3])}} + C_0 \\end{align}\\]

\n

The constant of integration can be found by evaluating the shear function at $x=0$, where $V(0) = A$ to get

\n

\\[V(0) = C_0 = \\var{force(-load_integral/2)} \\]

\n

5.  The moment function is the integral of the shear function

\n

\\[\\begin{align} M(x) &= \\int V(x)\\; dx \\\\
&= \\int \\simplify[fractionNumbers]{{polynomial(x,[ 0,0, -h/b, h/(b^2)/3])}} + C_0 \\;dx\\\\
& = \\simplify[fractionNumbers]{{m}} + C_1\\\\
\\end{align}\\]

\n

Since the moment $M(0) = 0$, $C_1 = 0$

\n

6. The Maximum shear occurs at the ends, where $dV /dx = -w(x) = 0$

\n

\\[\\begin{align}V_{max} &= V(0) = V(L)\\\\
&= \\var{force(maximums[1])}\\end{align}
\\]

\n

7. The  Maximum moment occurs at midpoint, $x = \\var{qty(L/2,units[0])}$, where $dM/dx = 0$

\n

\\[\\begin{align}M_{max} &= M(\\var{b})\\\\
&= \\var{moment(maximums[2])}\\end{align}\\]

\n

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"units": {"name": "units", "group": "Unnamed group", "definition": "random(['ft','lb', 'ft*lb', 'lb/ft'],['m','kN', 'kN*m', 'kN/m'])", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "0.5 L", "description": "

half width of beam \"base\"

", "templateType": "anything", "can_override": false}, "h": {"name": "h", "group": "Ungrouped variables", "definition": "random([1,2,2.5,5,7.5,10])random([10,100])", "description": "

distributed load at the center of the beam.  The \"height\" of the parabola

", "templateType": "anything", "can_override": false}, "w": {"name": "w", "group": "Ungrouped variables", "definition": "polynomial(x,[0,2 h/b,-h/(b^2)])", "description": "

loading function w(x)

", "templateType": "anything", "can_override": false}, "F_A": {"name": "F_A", "group": "Unnamed group", "definition": "rational(2/3 b h)", "description": "

Reaction at A = half the downward force ( 2/3 bh)

\n

Reaction at B is the same.

", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "polynomial(x,[ F_A,0, -h/b, h/(b^2)/3])", "description": "

the shear function. result of integrating -w(x)

", "templateType": "anything", "can_override": false}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "polynomial(x,[0, F_A,0, -h/b/3, h/(b^2)/3/4])", "description": "

The moment function m(x), result of integrating v(x)

", "templateType": "anything", "can_override": false}, "w_t": {"name": "w_t", "group": "Unnamed group", "definition": "2 F_A", "description": "

Total Weight supported by the beam

", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "Ungrouped variables", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "loadBoard": {"name": "loadBoard", "group": "Ungrouped variables", "definition": "let(max, maximums[0],\n jsxgraph(\n 480,200,[-2, 1.2 max, 2 b+2, - max/2],\n merge(\n [ \"$w(x)$\": ['functiongraph', [load_function, 0, L], [name: \"a\", withLabel: true, strokeWidth: 3, strokeColor: \"#CC0000\", fillColor: \"#CC0000\", \n fillOpacity: 0.1,label:[fixed: false, fontSize: 14]]]],\narrows,\n [\"beam\": ['segment', [[0,0],[L,0]], [strokeWidth: 5, color: \"black\"]] ],\n [ \"$A$\": ['segment', [[0,-max 0.4], [0,0]], merge(reactionoptions, [label: [fixed: false, color: \"#CC0000\", fontSize: 16]])]],\n [ \"$B$\": ['segment', [[L,-max 0.4],[L,0],], merge(reactionoptions, [label: [fixed: false, color: \"#CC0000\", fontSize: 16]])]]\n )\n)\n)", "description": "", "templateType": "anything", "can_override": false}, "load_function": {"name": "load_function", "group": "Ungrouped variables", "definition": "expr(polynomials[0])", "description": "", "templateType": "anything", "can_override": false}, "maximums": {"name": "maximums", "group": "Ungrouped variables", "definition": "let(\n w, polynomials[0],\n v, polynomials[1],\n m, polynomials[2],\n [eval(w,b),eval(v,0),eval(m,b)])", "description": "

load function at peak

", "templateType": "anything", "can_override": false}, "L": {"name": "L", "group": "Ungrouped variables", "definition": "20", "description": "

beamLength

", "templateType": "anything", "can_override": false}, "shear_function": {"name": "shear_function", "group": "Ungrouped variables", "definition": "expr(polynomials[1])", "description": "", "templateType": "anything", "can_override": false}, "moment_function": {"name": "moment_function", "group": "Ungrouped variables", "definition": "expr(polynomials[2])", "description": "", "templateType": "anything", "can_override": false}, "polynomials": {"name": "polynomials", "group": "Ungrouped variables", "definition": "[\npolynomial(x,[0,2 h/b,-h/(b^2)]),\npolynomial(x,[ F_A,0, -h/b, h/(b^2)/3]),\npolynomial(x,[0, F_A,0, -h/b/3, h/(b^2)/3/4])\n]", "description": "", "templateType": "anything", "can_override": false}, "shearBoard": {"name": "shearBoard", "group": "Ungrouped variables", "definition": "let(max, 1.2*maximums[1],\n jsxgraph(\n 480,200,[-2, 1.1 max, 2 b+2, -max],\n [ \n \"$V(x)$\": ['functiongraph', [shear_function, 0, L], [withLabel: true, strokeWidth: 3, strokeColor: \"#CC0000\" ,label:[fixed: false, fontSize: 14]]],\n\n ]\n))", "description": "", "templateType": "anything", "can_override": false}, "momentBoard": {"name": "momentBoard", "group": "Ungrouped variables", "definition": " let(max, maximums[2], color, \"#3070AD\", \n jsxgraph(\n 480,200,[-2, 1.2 max, 2 b+2, -max/3],\n [\"$M(x)$\": ['functiongraph', [moment_function, 0, L], [withLabel: true, strokeWidth: 3, strokeColor: color, label:[fixed: false, fontSize: 14]]],\n ],\n ))", "description": "", "templateType": "anything", "can_override": false}, "shearload": {"name": "shearload", "group": "Ungrouped variables", "definition": "eval(-w,L)", "description": "", "templateType": "anything", "can_override": false}, "force": {"name": "force", "group": "Ungrouped variables", "definition": "f -> siground(qty(f,units[1]),4)", "description": "", "templateType": "anything", "can_override": false}, "moment": {"name": "moment", "group": "Ungrouped variables", "definition": "m -> siground(qty(m,units[2]),4)", "description": "", "templateType": "anything", "can_override": false}, "load_integral": {"name": "load_integral", "group": "Ungrouped variables", "definition": "eval(polynomial(x,[0,0, -h/b, h/(b^2)/3]),L)", "description": "", "templateType": "anything", "can_override": false}, "Arrow": {"name": "Arrow", "group": "Ungrouped variables", "definition": "let( w , polynomials[0],\n (x) -> ['segment', [[x, eval(w,x)],[x,0]],[ fixed: true, color: \"black\",strokewidth: 1.5,highlight: false, lastArrow: [ type: 4 ]]])", "description": "", "templateType": "anything", "can_override": false}, "reactionOptions": {"name": "reactionOptions", "group": "Ungrouped variables", "definition": "[withLabel: true, \"fixed\": true, \"color\": \"#CC0000\", \"strokewidth\": 4, \"highlight\": false, \"lastArrow\": [ \"type\": 4 ] ]", "description": "", "templateType": "anything", "can_override": false}, "Arrows": {"name": "Arrows", "group": "Ungrouped variables", "definition": "dict(map((i)->([(\"A\"+i),Arrow(i)]), 1..L))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["debug", "L", "b", "h", "w", "v", "m", "maximums", "load_function", "shear_function", "moment_function", "polynomials", "loadBoard", "shearBoard", "momentBoard", "shearload", "force", "moment", "load_integral", "Arrow", "reactionOptions", "Arrows"], "variable_groups": [{"name": "Unnamed group", "variables": ["w_t", "F_A", "units"]}], "functions": {"show_curvesxxx": {"parameters": [["app", "?"]], "type": "anything", "language": "javascript", "definition": "app.promise.then(function(d) {\n d.app.setVisible(\"showV\", true,false);\n d.app.setVisible(\"showM\", true,false);\n d.app.setValue(\"showV\",true);\n d.app.setValue(\"showM\",true);\n});\nreturn \"\"//new Numbas.jme.types.ggbapplet(app);\n"}}, "preamble": {"js": "\n", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Load and Reactions", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Determine the total weight supported by the beam and the reactions at $A$ and $B$.

\n

$W = $ [[0]]

\n

$R_A =$ [[1]]

\n

$R_B = $ [[2]]

\n

$R_A = R_B =\\simplify[fractionNumbers]{{F_A}}$ =  {force(F_A)}

", "stepsPenalty": "10", "steps": [{"type": "information", "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": "

The total weight is found by integrating the loading function $w(x)$.  Positive values indicate a downward load.

\n

$\\begin{align}W &= \\simplify{defint(w,x,0,L)}\\\\ &= \\simplify[fractionNumbers,canonicalOrder]{defint({w},x,0,{2b})}\\end{align}$

\n

By symmetry, the reactions are half the weight:

\n

$F_A = F_B = \\dfrac{W}{2}$.  These point up.

"}], "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "$W$", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(2 F_A,units[1])", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "$R_A$", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "force(F_A)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "$R_B$", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "force(F_A)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Shear and Bending Moment Functions", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Determine expressions for:

\n

$V\\!(x) =$ [[0]]

\n

$M\\!(x) =$ [[1]]

\n

and then plot the shear and bending moment diagrams.

\n

$V(x) = \\simplify[canonicalOrder,fractionNumbers]{{v}}$

\n

$M(x) = \\simplify[canonicalOrder,fractionNumbers]{{m}}$

\n

", "stepsPenalty": "10", "steps": [{"type": "information", "useCustomName": false, "customName": "", "marks": 0, "scripts": {"validate": {"script": "{show_curves(applet)}", "order": "after"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

The shear function is found by integrating the loading function. The negative sign is because positive values of w(x) represent a load which points down.

\n

$\\begin{align}V(x) &=  \\simplify{-defint(w,x,0,x)} \\\\&= \\simplify[fractionNumbers,canonicalOrder]{defint({-w},x,0,L)} \\\\&= \\simplify[fractionNumbers,canonicalOrder]{{v}}\\end{align}$

\n

The bending moment function is found by integrating the shear function.

\n

$\\begin{align}M(x) &= \\simplify{defint(V,x,0,x)}\\\\&= \\simplify[fractionNumbers,canonicalOrder]{defint({v},x,0,L)} \\\\&= \\simplify[fractionNumbers,canonicalOrder]{{M}}\\end{align}$

\n

In both cases, the resulting constant of integration is determined by considering the values at $x=0$.

\n

$V(0) = F_A, \\text{ and } M(0) = 0$

\n

"}], "gaps": [{"type": "jme", "useCustomName": true, "customName": "V(x)", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{expr(v)}", "answerSimplification": "fractionNumbers", "showPreview": true, "checkingType": "sigfig", "checkingAccuracy": "2", "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}, {"type": "jme", "useCustomName": true, "customName": "M(x)", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{expr(m)}", "answerSimplification": "fractionNumbers", "showPreview": true, "checkingType": "sigfig", "checkingAccuracy": "2", "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Maximum internal loads", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Give the (signed) values of the largest shear and bending moment occuring anywhere within the beam.  Use the standard sign convention for shear and bending moments.

\n

$V_{\\text{max}} = $  [[0]] $\\qquad M_{\\text{max}} = $  [[1]]

\n

$V_{max} = \\var{siground(qty(eval(v,0),units[1]),4)}$ 

\n

$M_{max} = \\var{siground(qty(eval(m,b),units[0]+\" \" + units[1]),4)}$

\n

", "stepsPenalty": "10", "steps": [{"type": "information", "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": "

The maximum shear occurs at the ends, where $\\simplify{diff(V,x,1)} = -w(x) = 0$ i.e. at $x=0$, or $x=\\var{qty(2b,units[0])}$.

\n

$\\begin{align}V_{max} &= V(0) \\\\ &= \\var{siground(qty(F_A,units[1]),4)}\\end{align}$

\n

Maximum moment occurs at midpoint, where $\\simplify{diff(M,x,1)} = V = 0$

\n

$\\begin{align}M_{max} &= M(\\var{b}) \\\\&= \\var{siground(qty(eval(m,b),units[0] + ' ' + units[1]),4)}\\end{align}$

"}], "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "$V_{max}$", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "force(F_A)", "right": "0.5", "close": "1", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "$M_{max}$", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "moment(eval(m,b))", "right": "0.5", "close": "1", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "VM8: Arbitrary loading function", "extensions": ["jsxgraph", "linear-algebra", "polynomials", "quantities"], "custom_part_types": [{"source": {"pk": 19, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/19/edit"}, "name": "Engineering Accuracy with units", "short_name": "engineering-answer", "description": "

A value with units marked right if within an adjustable % error of the correct value.  Marked close if within a wider margin of error.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "siground(settings['correctAnswer'],4)", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\n\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\n\n\ncorrect_units:\nunits(correct_quantity)\n\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_scalar:\nmatch_student_number[1]\n\nstudent_units:\nreplace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")\n\ngood_units:\ntry(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n\n\nstudent_quantity:\nswitch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n\n\npercent_error:\ntry(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n \n\nright:\npercent_error <= settings['right']\n\n\nclose:\nright_sign and percent_error <= settings['close']\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)", "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": "switch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)\n\n"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]\n\n"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)\n"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_scalar", "description": "", "definition": "match_student_number[1]"}, {"name": "student_units", "description": "

Modify the unit portion of the student's answer by

\n

1. replacing \"ohms\" with \"ohm\"  case insensitive

\n

2. replacing '-' with ' ' 

\n

3. replacing '°' with ' deg' 

\n

to allow answers like 10 ft-lb and 30°

", "definition": "replace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")"}, {"name": "good_units", "description": "", "definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n"}, {"name": "student_quantity", "description": "

This fixes the student answer for two common errors.  

\n

If student_units are wrong  - replace with correct units

\n

If student_scalar has the wrong sign - replace with right sign

\n

If student makes both errors, only one gets fixed.

", "definition": "switch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n"}, {"name": "percent_error", "description": "", "definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n "}, {"name": "right", "description": "", "definition": "percent_error <= settings['right']\n"}, {"name": "close", "description": "

Only marked close if the student actually has the right sign.

", "definition": "right_sign and percent_error <= settings['close']"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity) "}], "settings": [{"name": "correctAnswer", "label": "Correct Quantity.", "help_url": "", "hint": "The correct answer given as a JME quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "right", "label": "% Accuracy for right.", "help_url": "", "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "0.2", "evaluate": true}, {"name": "close", "label": "% Accuracy for close.", "help_url": "", "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "1.0", "evaluate": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units.  if correct answer is 100 N and close is ±1%,
99  N is accepted.", "input_type": "percent", "default_value": "75"}, {"name": "C2", "label": "No units or wrong sign", "help_url": "", "hint": "Partial credit for forgetting units or using wrong sign.
If the correct answer is 100 N, both 100 and -100 N are accepted.", "input_type": "percent", "default_value": "50"}, {"name": "C3", "label": "Close, no units.", "help_url": "", "hint": "Partial Credit for close value but forgotten units.
This value would be close if the expected units were provided.  If the correct answer is 100 N, and close is ±1%,
99 is accepted.", "input_type": "percent", "default_value": "25"}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}], "tags": ["Mechanics", "mechanics", "shear and bending moment", "Statics", "statics"], "metadata": {"description": "

Shear and bending moment diagram for a beam loaded with an arbitrary parabolic distributed load with a loading function  given.  Students must integrate to find reactions and equations for shear and bending moment.  Problem sometimes fails when simplifying up the equations.

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

A simply-supported beam of length $L = \\var {qty(L, units[0])}$ is subjected to a parabolic loading $w(x)$  in {units[3]} given by the function:

\n

\\[w(x) = \\simplify[fractionNumbers,canonicalOrder]{{w}}\\]  

\n

The load, shear and bending moment diagrams are shown below.

\n

{loadBoard}

\n

{shearBoard}

\n

{momentBoard}

", "advice": "

Given $w(x)$ and beam length $L$,

\n

\\[ w(x) = \\simplify[fractionNumbers,canonicalOrder]{{w}} \\]

\n

1.  Find load $W= \\int_0^L w(x)\\; dx$

\n

\\[\\begin{align} W & = \\int w(x) \\text{d}x \\\\ & = \\simplify[fractionNumbers,canonicalOrder]{defint({w}, x, 0, {L})} \\\\ &= \\left[\\simplify[fractionNumbers,canonicalOrder]{{intw}}\\right]_0^\\var{L}\\\\ &= \\var{siground(qty(load,units[1]),5)} = \\var{siground(qty(abs(load),units[1]),5)}  \\var{arrow(-load)}\\end{align}\\]

\n

2.  Find $Q_y = \\int_0^L x w(x)\\;dx$

\n

\\[\\begin{align}  Q_y &= \\int_0^L x\\ w(x) \\text{d}x\\\\&= \\simplify[fractionNumbers,canonicalOrder]{defint({dqy},x,0,L)}\\\\& = \\left[\\simplify[fractionNumbers,canonicalOrder]{{intdqy}} \\right]_0^\\var{L}\\\\ &= \\var{siground(qty(Qy,units[0] + \" \" + units[1]),4)} \\end{align}\\]

\n

3.  Find centroid $\\bar{x}=\\frac{Q_y}{W}$

\n

\\[\\bar{x} = \\dfrac{Q_y}{W} = \\dfrac{\\var{siground(Qy,4)}}{\\var{siground(load,4)}} = \\var{siground(qty(xbar,units[0]),4)}\\]

\n

4.  Take moments about $A$ and $B$ to find reactions.

\n

\\[\\begin{align}
\\sum M_B &= 0 & \\sum M_A &=0 \\\\
  R_A L &=  \\simplify{{sign(load)} W }(L-\\bar{x}) & + R_B L &= \\simplify{{sign(load)} W }\\bar{x} &  \\\\
R_A&= \\var{force(abs(R_A))} \\var{arrow(R_A)} &  R_B &= \\var{force(abs(R_B))} \\var{arrow(R_B)}
 \\end{align}\\]

\n

5.  Integrate $V(x) = \\int w(x)\\; dx$ to get the shear function.

\n

Note: Positive values of $w(x)$ indicate downward forces, so the integrations is over $-w(x)$.

\n

\\[\\begin{align} V(x) &= \\int - w(x) dx \\\\
&= \\simplify[fractionNumbers, canonicalOrder]{int({-w},x)} \\\\
&= \\simplify[fractionNumbers,canonicalOrder]{{v -v[0]}}+C_3  && v(0) = R_A  \\therefore C_3 = \\var{force(R_A)}
\\\\ &= \\simplify[fractionNumbers,canonicalOrder]{{v}} && [\\var{units[1]}] &\\end{align}\\]

\n

6.  Integrate $M(x) = \\int V(x)\\; dx$ to get moment function.  

\n

\\[\\begin{align}
M(x) &= \\int V(x) dx \\\\
&= \\simplify[fractionNumbers, canonicalOrder]{int({v},x)}\\\\
&= \\simplify[fractionNumbers,canonicalOrder]{{m}}+C_4  && M(0) =0  \\therefore C_4 = 0 \\\\
&= \\simplify[fractionNumbers,canonicalOrder]{{m}} && [\\var{units[1]}\\text{-}\\var{units[0]} ]&
\\end{align}\\]

\n

\n

Maximum moment occurs where $dM/dx = V = 0$

\n

Evaluate $M(x)$ at point of maximum bending moment.

\n

Maximum shear occurs where $d V /d x = -w(x) = 0$

\n

Evaluate $V(x)$ at point of maximum shear.

\n

\n

To find maximum shear, determine where $\\simplify{diff(v,x,1)} = -w(x) = 0$ using the quadratic equation.

\n

$x_{max} =  \\frac{- b \\pm \\sqrt{b^2 - 4 a c}}{2a}$ where, $a= \\var[fractionNumbers]{-w[2]}, b=\\var[fractionNumbers]{-w[1]}$ and $c=\\var[fractionNumbers]{-w[0]}$.

\n

Any real roots of $w(x)$ between the beam's endpoints plus the endpoints themselves are locations of local maximums or minimums.

\n

{v_extremes}

\n

The maximum of these local maximums is the the one we want

\n

$V_{max} = \\var{show(qty(v_max, units[1]))}$

\n

\n

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"L": {"name": "L", "group": "Unnamed group", "definition": "20", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Unnamed group", "definition": "random(['ft','lb','ft*lb', 'lb/ft'],['m','kN', 'kN*m', 'kN/m'])", "description": "", "templateType": "anything", "can_override": false}, "w": {"name": "w", "group": "functions", "definition": "polynomial(x,load_coefficients)", "description": "

loading function w(x)

\n

", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "functions", "definition": "-polynomial(x, [-R_A, w[0], w[1]/2, w[2]/3, w[3]/4])", "description": "

This is the shear function V(x) = - \\int w(x) dx

\n

Constant C is reaction at x=0

", "templateType": "anything", "can_override": false}, "m": {"name": "m", "group": "functions", "definition": "polynomial(x,moment_coefficients)", "description": "", "templateType": "anything", "can_override": false}, "load": {"name": "load", "group": "Reactions", "definition": "eval(intW,L) - eval(intW,0)", "description": "

downward force on beam = $\\simplify{defint(w,x,0,{beamlen})$

\n

\n

Positive = down

", "templateType": "anything", "can_override": false}, "dQy": {"name": "dQy", "group": "Reactions", "definition": "polynomial(x) w", "description": "", "templateType": "anything", "can_override": false}, "intdQy": {"name": "intdQy", "group": "Reactions", "definition": "polynomial(x, [0, dQy[0], dQy[1]/2, dQy[2]/3, dQy[3]/4, dQy[4]/5])", "description": "

integral of dQy   

", "templateType": "anything", "can_override": false}, "Qy": {"name": "Qy", "group": "Reactions", "definition": "eval(intdqy,L)", "description": "

definite integral of x dw from 0 to L

", "templateType": "anything", "can_override": false}, "xBar": {"name": "xBar", "group": "Reactions", "definition": "Qy/load", "description": "", "templateType": "anything", "can_override": false}, "intW": {"name": "intW", "group": "Reactions", "definition": "polynomial(x, [0, w[0], w[1]/2, w[2]/3, w[3]/4])", "description": "", "templateType": "anything", "can_override": false}, "R_B": {"name": "R_B", "group": "Reactions", "definition": "xbar load / L", "description": "

reaction at B  Positive is up

", "templateType": "anything", "can_override": false}, "R_A": {"name": "R_A", "group": "Reactions", "definition": "(L-xbar) load/ L", "description": "", "templateType": "anything", "can_override": false}, "check": {"name": "check", "group": "Reactions", "definition": "withintolerance(R_A+R_B,load,10^10)", "description": "

check sometimes has roundoff error.

", "templateType": "anything", "can_override": false}, "roots": {"name": "roots", "group": "maxshear", "definition": "sort(\n if(d>=0, \n filter(x>=0 and x <=L, x,\n let([a: w[2], b: w[1], c: w[0]], \n [(-b + sqrt(d))/(2 a), (-b - sqrt(d))/(2 a)]\n)),[]) + [0,L])", "description": "

use quadratic equation to find where w(x) is zero, filter out any roots not on interval, or imaginary.

\n

The maximum shear will occur at one of these points

", "templateType": "anything", "can_override": false}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "w[1]^2 - 4 w[2] * w[0]", "description": "

descriminant for quadratic equation w(x)

", "templateType": "anything", "can_override": false}, "v_extremes": {"name": "v_extremes", "group": "maxshear", "definition": "map(vector(x,eval(v,x)),x,roots)", "description": "

extreme points

\n

list of shear force v(x) at ends and at roots of w(x) -- potential maximums or minimums

", "templateType": "anything", "can_override": false}, "v_max": {"name": "v_max", "group": "functions", "definition": "max([v_maxmin[0],-v_maxmin[1]])", "description": "

filters the list of v_extremes to find the one with the greatest absolute value of shear

", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "Ungrouped variables", "definition": "false", "description": "", "templateType": "anything", "can_override": true}, "loadBoard": {"name": "loadBoard", "group": "Ungrouped variables", "definition": "let(max, w_maxmin,\n jsxgraph(\n 500,250,[-2, max(1.2 max[0],-max[1]/2), L+2, min(1.2 max[1], -max[0]/2)],\n merge(\n arrows,\n [\"$w(x)$\": ['functiongraph', [load_function, 0, L], [name: \"a\", withLabel: true, strokeWidth: 3, strokeColor: \"#CC0000\", fillOpacity: 0.1,label:[fixed: false, fontSize: 14]]]],\n [\"beam\": ['segment', [[0,0],[L,0]], [strokeWidth: 5, color: \"black\"]] ]\n \n\n )\n))\n", "description": "", "templateType": "anything", "can_override": false}, "load_function": {"name": "load_function", "group": "functions", "definition": "expr(w)", "description": "", "templateType": "anything", "can_override": false}, "reactionoptions": {"name": "reactionoptions", "group": "Ungrouped variables", "definition": "[withLabel: true, \"fixed\": true, \"color\": \"#CC0000\", \"strokewidth\": 3, \"highlight\": false, \"lastArrow\": [ \"type\": 4 ] ]", "description": "", "templateType": "anything", "can_override": false}, "drawArrow": {"name": "drawArrow", "group": "Ungrouped variables", "definition": " (x) -> ['segment', [[x, eval(w,x)],[x,0]],[ fixed: true, color: \"black\",strokewidth: 1.5,highlight: false, lastArrow: [ type: 4 ]]]", "description": "", "templateType": "anything", "can_override": false}, "arrows": {"name": "arrows", "group": "Ungrouped variables", "definition": "dict(map((i)->([(\"A\"+i),drawArrow(i)]), 1..L))", "description": "", "templateType": "anything", "can_override": false}, "w_max": {"name": "w_max", "group": "functions", "definition": "max([abs(r_a),abs(r_b)])", "description": "

hack to scale load diagram

", "templateType": "anything", "can_override": false}, "w_maxmin": {"name": "w_maxmin", "group": "functions", "definition": "[max(map(x->eval(w,x),0..l)) |> round(), round(min(map(x->eval(w,x),0..l)))]", "description": "", "templateType": "anything", "can_override": false}, "shearBoard": {"name": "shearBoard", "group": "Ungrouped variables", "definition": "\n jsxgraph(\n 500,250,[-2, 1.2 v_max, L+2, -v_max],\n [ \n \"$V(x)$\": ['functiongraph', [shear_function, 0, L], [withLabel: true, strokeWidth: 3, strokeColor: \"#CC0000\", label:[fixed: false, fontSize: 14]]],\n\n ]\n)", "description": "", "templateType": "anything", "can_override": false}, "shear_function": {"name": "shear_function", "group": "functions", "definition": "expr(v)", "description": "", "templateType": "anything", "can_override": false}, "v_maxmin": {"name": "v_maxmin", "group": "functions", "definition": "[max(map(x->eval(v,x),0..l)) |> round(), round(min(map(x->eval(v,x),0..l)))]", "description": "", "templateType": "anything", "can_override": false}, "moment_function": {"name": "moment_function", "group": "functions", "definition": "expr(m)", "description": "", "templateType": "anything", "can_override": false}, "m_maxmin": {"name": "m_maxmin", "group": "functions", "definition": "[max(map(x->eval(m,x),0..l)) |> round(), round(min(map(x->eval(m,x),0..l)))]", "description": "", "templateType": "anything", "can_override": false}, "m_max": {"name": "m_max", "group": "functions", "definition": "max([m_maxmin[0],-m_maxmin[1]])", "description": "", "templateType": "anything", "can_override": false}, "momentBoard": {"name": "momentBoard", "group": "Ungrouped variables", "definition": " let(max, m_maxmin[0], min, m_maxmin[1],\n jsxgraph(\n 500,250,[-2, 1.2 max(1.2 max, -min/2), L+2, min(1.2 min, -max/2)],\n [\"$M(x)$\": ['functiongraph', [moment_function, 0, L], [withLabel: true, strokeWidth: 3, strokeColor: \"#3070AD\", label:[fixed: false, fontSize: 14] ]],\n ]\n ) )", "description": "

max(1.2 max[0],-max[1]/2)

", "templateType": "anything", "can_override": false}, "force": {"name": "force", "group": "Ungrouped variables", "definition": "(f)->siground(qty(f,units[1]),4)", "description": "", "templateType": "anything", "can_override": false}, "load_coefficients": {"name": "load_coefficients", "group": "functions", "definition": "random(coefficients)", "description": "

get coefficients puts curve through three points, A,B,C  siground tries to make the coefficients simpler fractions

", "templateType": "anything", "can_override": false}, "moment_coefficients": {"name": "moment_coefficients", "group": "functions", "definition": "[0,v[0],v[1]/2,v[2]/3,v[3]/4,v[4]/5]", "description": "", "templateType": "anything", "can_override": false}, "shear_coefficients": {"name": "shear_coefficients", "group": "functions", "definition": "[-R_A, w[0], w[1]/2, w[2]/3, w[3]/4]", "description": "", "templateType": "anything", "can_override": false}, "random_frac": {"name": "random_frac", "group": "Ungrouped variables", "definition": "() -> random(-9..9 except 0)/random(1..9)", "description": "", "templateType": "anything", "can_override": false}, "coefficients": {"name": "coefficients", "group": "functions", "definition": "[[ 0, -10, 3, -0.1 ],\n[ 0, -10, 4, -0.1 ],\n[ 0, -10, 4, -0.1 ],\n[ 0, -10, 4, -0.2 ],\n[ 0, -20, 4, -0.2 ],\n[ 0, -20, 5, -0.2 ],\n[ 0, -3, 0.3, -0.006 ],\n[ 0, -4, 0.04, 0.009 ],\n[ 0, -4, 0.07, 0.006 ],\n[ 0, -4, 0.3, -0.007 ],\n[ 0, -4, 0.4, -0.008 ],\n[ 0, -5, 0.5, -0.01 ],\n[ 0, -5, 0.6, -0.02 ],\n[ 0, -5, 0.7, -0.02 ],\n[ 0, -6, 0.5, -0.01 ],\n[ 0, -6, 0.8, -0.03 ],\n[ 0, -7, 0.9, -0.03 ],\n[ 0, -8, 1, -0.03 ],\n[ 0, -8, 1, -0.04 ],\n[ 0, -9, 1, -0.04 ],\n[ 0, 2, -0.04, -0.004 ],\n[ 0, 2, -0.05, -0.004 ],\n[ 0, 2, -0.1, 0 ],\n[ 0, 20, -5, 0.2 ],\n[ 0, 3, -0.03, -0.007 ],\n[ 0, 3, -0.05, -0.005 ],\n[ 0, 3, -0.1, 0 ],\n[ 0, 3, -0.3, 0.006 ],\n[ 0, 4, -0.03, -0.007 ],\n[ 0, 4, -0.04, -0.008 ],\n[ 0, 4, -0.04, -0.009 ],\n[ 0, 4, -0.07, -0.006 ],\n[ 0, 4, -0.2, 0 ],\n[ 0, 5, -0.05, -0.01 ],\n[ 0, 5, -0.7, 0.02 ],\n[ 0, 6, -0.05, -0.01 ],\n[ 0, 6, -0.06, -0.01 ],\n[ 0, 6, -0.8, 0.03 ],\n[ 0, 8, -1, 0.03 ],\n[ 0, -3, 0.3, -0.007 ]]", "description": "

These coefficients do not cause \"Simplifier is stuck in a loop\" errors.  The were generated by giving three random points to getCoefficients() extension function

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["d", "debug", "loadBoard", "shearBoard", "momentBoard", "reactionoptions", "drawArrow", "arrows", "force", "random_frac"], "variable_groups": [{"name": "Unnamed group", "variables": ["L", "units"]}, {"name": "functions", "variables": ["w", "v", "m", "coefficients", "load_coefficients", "shear_coefficients", "moment_coefficients", "load_function", "shear_function", "moment_function", "w_maxmin", "v_maxmin", "m_maxmin", "w_max", "v_max", "m_max"]}, {"name": "Reactions", "variables": ["load", "dQy", "intdQy", "Qy", "xBar", "intW", "R_B", "R_A", "check"]}, {"name": "maxshear", "variables": ["roots", "v_extremes"]}], "functions": {"arrow": {"parameters": [["F", "?"]], "type": "anything", "language": "jme", "definition": "if(sign(F) >= 0 ,latex(\"\\\\uparrow\"), latex(\"\\\\downarrow\"))"}, "getCoefficients": {"parameters": [["A", "list of integer"], ["B", "list of integer"], ["C", "list of integer"]], "type": "list", "language": "javascript", "definition": " const jme = Numbas.jme;\n const extension = Numbas.extensions.polynomial\n const [x0, y1] = A;\n const [x2, y2] = B;\n const [x3, y3] = C;\n\n // Sanity check: first point must be at x=0\n if (x0 !== 0) {\n throw new Error(\"First point A must have x = 0\");\n }\n\n const d = y1;\n\n // Right-hand side: subtract y1 to isolate a,b,c terms\n const r1 = y2 - y1;\n const r2 = y3 - y1;\n\n // Matrix coefficients\n const a11 = Math.pow(x2, 3);\n const a12 = Math.pow(x2, 2);\n const a13 = x2;\n\n const a21 = Math.pow(x3, 3);\n const a22 = Math.pow(x3, 2);\n const a23 = x3;\n\n // Solve the system using Cramer's Rule or elimination\n // We'll eliminate c first\n\n // Multiply row 1 by x3 and row 2 by x2 to align c terms\n const m1 = x3, m2 = x2;\n\n const A1 = m1 * a11 - m2 * a21;\n const B1 = m1 * a12 - m2 * a22;\n const R1 = m1 * r1 - m2 * r2;\n\n // Now solve A1 * a + B1 * b = R1\n // We'll solve for b in terms of a, then back-substitute\n\n // Solve for a and b\n // System: A1 * a + B1 * b = R1\n // a13 * a + a12 * b + c = r1\n\n // Choose to solve directly (2x2 linear system)\n const det = A1 * (-a12) - B1 * (-a13);\n if (Math.abs(det) < 1e-12) {\n throw new Error(\"Points are degenerate or lead to singular system.\");\n }\n\n // Use Cramer's Rule\n const detA = R1 * (-a12) - B1 * (r1 - a13 * 0); // assuming a = 0 temporarily\n const detB = A1 * (r1 - a13 * 0) - R1 * (-a13);\n\n const a = detA / det;\n const b = detB / det;\n\n // Solve for c using first equation\n const c = (r1 - a * a11 - b * a12) / a13;\n\n // Return function a * x ** 3 + b * x ** 2 + c * x + d;\n return [d,c,b,a]\n \n"}, "show": {"parameters": [["A", "number"]], "type": "anything", "language": "jme", "definition": "if(abs(if(type(A)=type(qty(1,'m')),scalar(A),A))<1,\n precround(A,4),siground(A,4))"}}, "preamble": {"js": "question.signals.on('adviceDisplayed',function() {\n try{\n }\n catch(err){} \n})\n\n\n", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Reactions", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Find the reactions at the end suppports.  Use negative values to indicate downward forces.

\n

$R_A = $ [[0]]

\n

$ R_B= $ [[1]]

", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "A", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(R_A,units[1])", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "B", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(R_B,units[1])", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Shear Function", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Use integration to determine the equation of the shear function $V (x) = \\int -w(x)\\ dx$

\n

$V\\!(x) = \\simplify[fractionNumbers,canonicalOrder]{{v}} =  \\simplify[canonicalOrder]{{v}} $

\n

$V\\!(x) = $[[0]]

", "gaps": [{"type": "jme", "useCustomName": true, "customName": "$V(x)$", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{expr(v)}", "answerSimplification": "fractionNumbers,canonicalOrder", "showPreview": true, "checkingType": "sigfig", "checkingAccuracy": "2", "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, "1"], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Bending Moment", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Use integration to find the bending moment function $M(x) =\\int V(x)\\ dx$.

\n

$M(x) = \\simplify[fractionNumbers,canonicalOrder]{{m}}$ 

\n

$=\\simplify[canonicalOrder]{{m}}$

\n

$M(x) = $ [[0]]

", "gaps": [{"type": "jme", "useCustomName": true, "customName": "$M(x)$", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{expr(m)}", "answerSimplification": "fractionNumbers,canonicalOrder", "showPreview": true, "checkingType": "sigfig", "checkingAccuracy": "2", "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"}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": false, "navigatemode": "sequence", "onleave": {"action": "none", "message": ""}, "preventleave": true, "typeendtoleave": false, "startpassword": "", "autoSubmit": true, "allowAttemptDownload": false, "downloadEncryptionKey": "", "showresultspage": "oncompletion"}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"enterreviewmodeimmediately": true, "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "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": true, "showtotalmark": true, "reviewshowscore": true, "reviewshowadvice": true}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "contributors": [{"name": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}], "extensions": ["jsxgraph", "linear-algebra", "polynomials", "quantities"], "custom_part_types": [{"source": {"pk": 19, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/19/edit"}, "name": "Engineering Accuracy with units", "short_name": "engineering-answer", "description": "

A value with units marked right if within an adjustable % error of the correct value.  Marked close if within a wider margin of error.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "siground(settings['correctAnswer'],4)", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\n\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\n\n\ncorrect_units:\nunits(correct_quantity)\n\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_scalar:\nmatch_student_number[1]\n\nstudent_units:\nreplace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")\n\ngood_units:\ntry(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n\n\nstudent_quantity:\nswitch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n\n\npercent_error:\ntry(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n \n\nright:\npercent_error <= settings['right']\n\n\nclose:\nright_sign and percent_error <= settings['close']\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)", "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": "switch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)\n\n"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]\n\n"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)\n"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_scalar", "description": "", "definition": "match_student_number[1]"}, {"name": "student_units", "description": "

Modify the unit portion of the student's answer by

\n

1. replacing \"ohms\" with \"ohm\"  case insensitive

\n

2. replacing '-' with ' ' 

\n

3. replacing '°' with ' deg' 

\n

to allow answers like 10 ft-lb and 30°

", "definition": "replace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")"}, {"name": "good_units", "description": "", "definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n"}, {"name": "student_quantity", "description": "

This fixes the student answer for two common errors.  

\n

If student_units are wrong  - replace with correct units

\n

If student_scalar has the wrong sign - replace with right sign

\n

If student makes both errors, only one gets fixed.

", "definition": "switch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n"}, {"name": "percent_error", "description": "", "definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n "}, {"name": "right", "description": "", "definition": "percent_error <= settings['right']\n"}, {"name": "close", "description": "

Only marked close if the student actually has the right sign.

", "definition": "right_sign and percent_error <= settings['close']"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity) "}], "settings": [{"name": "correctAnswer", "label": "Correct Quantity.", "help_url": "", "hint": "The correct answer given as a JME quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "right", "label": "% Accuracy for right.", "help_url": "", "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "0.2", "evaluate": true}, {"name": "close", "label": "% Accuracy for close.", "help_url": "", "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "1.0", "evaluate": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units.  if correct answer is 100 N and close is ±1%,
99  N is accepted.", "input_type": "percent", "default_value": "75"}, {"name": "C2", "label": "No units or wrong sign", "help_url": "", "hint": "Partial credit for forgetting units or using wrong sign.
If the correct answer is 100 N, both 100 and -100 N are accepted.", "input_type": "percent", "default_value": "50"}, {"name": "C3", "label": "Close, no units.", "help_url": "", "hint": "Partial Credit for close value but forgotten units.
This value would be close if the expected units were provided.  If the correct answer is 100 N, and close is ±1%,
99 is accepted.", "input_type": "percent", "default_value": "25"}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": [["question-resources/newVM_cA1Sig0.ggb", "/srv/numbas/media/question-resources/newVM_cA1Sig0.ggb"]]}