// Numbas version: exam_results_page_options {"name": "Free oscillations of a pendulum", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"is_under_damped": {"definition": "(g/l)-k/(2*m) > 0", "group": "damping", "templateType": "anything", "name": "is_under_damped", "description": "

Is the system under-damped? (this should be true)

"}, "beta": {"definition": "k/(2*m)", "group": "damping", "templateType": "anything", "name": "beta", "description": "

decay rate

"}, "T": {"definition": "2*pi*sqrt(l/g)", "group": "Ungrouped variables", "templateType": "anything", "name": "T", "description": "

Time period of the undamped oscillations (seconds)

"}, "damping5": {"definition": "-ln(0.05)/beta", "group": "damping", "templateType": "anything", "name": "damping5", "description": "

Time taken for amplitude to reduce to 5% of original.

"}, "g": {"definition": "9.81", "group": "Ungrouped variables", "templateType": "number", "name": "g", "description": "

gravitational acceleration (ms^-2)

"}, "m": {"definition": "random(2..6)", "group": "Ungrouped variables", "templateType": "anything", "name": "m", "description": "

mass of the bob (kg)

"}, "theta0_frac": {"definition": "random(3,5,6)", "group": "Ungrouped variables", "templateType": "anything", "name": "theta0_frac", "description": "

Question displays pi/theta0_frac.

"}, "damping0p01": {"definition": "abs(log(0.0001))/beta", "group": "damping", "templateType": "anything", "name": "damping0p01", "description": "

Time taken for amplitude to reduce to 0.001% of original.

"}, "l": {"definition": "random(3..6)", "group": "Ungrouped variables", "templateType": "anything", "name": "l", "description": "

length of the pendulum rod (m)

"}, "theta0": {"definition": "pi/theta0_frac", "group": "Ungrouped variables", "templateType": "anything", "name": "theta0", "description": "

Release angle of the pendulum

"}, "k": {"definition": "random(2..5)", "group": "damping", "templateType": "anything", "name": "k", "description": "

friction coefficient (kgs-1)

"}}, "functions": {"jsx_pendulum2": {"definition": "JXG.Options = JXG.merge(JXG.Options,{\n elements: {\n fixed: true\n },\n point: {\n showInfobox: false\n },\n text: {\n highlightStrokeOpacity: 1\n }\n});\n\n// Get Numbas variables\nvar g = question.unwrappedVariables.g; // grav acc.\nvar l = question.unwrappedVariables.l; // length of rod\nvar m = question.unwrappedVariables.m; // mass of bob\nvar theta0 = question.unwrappedVariables.theta0; // initial angle\nvar k = question.unwrappedVariables.k; // friction coefficient\nvar damping0p01 = question.unwrappedVariables.damping0p01;\n\n// Set up board\nvar div = Numbas.extensions.jsxgraph.makeBoard('600px','250px',\n {\n boundingBox:[-5, 0.2, 9, -6],\n axis:false,\n showNavigation:false,\n grid:false\n }\n);\n\nvar board2 = div.board; \n\n// Pendulum 1: exact solution \nvar p3 = board2.create('point', [0.02, 0], {visible:false, size: 3});\nvar c2 = board2.create('circle', [p3, [0.02,5]], {visible:false, name: 'circle', size: 3});\nvar p4 = board2.create('glider', [0.02,5, c2], {visible: true, name: '', size: 8, color: 'red', highlightFillColor: 'red', strokeWidth: 0, highlightStrokeWidth: 0});\n\n\n// Pendulum 2: student solution\nvar p1 = board2.create('point', [0, 0], {visible:false, size: 3});\nvar c1 = board2.create('circle', [p1, [0,5]], {visible:false, name: 'circle', size: 3});\nvar p2 = board2.create('glider', [0,5, c1], {visible: true, name: '', size: 8, color: '#91bcd8', highlightFillColor: '#91bcd8', strokeWidth: 0, highlightStrokeWidth: 0});\n\n// Decor\nvar l1 = board2.create('line', [[-2,0],[2,0]],{color: 'grey', highlightStrokeColor: 'grey',straightFirst:false, straightLast:false, strokeWidth: 10});\nvar l2 = board2.create('line', [[0.02,0],[0.02,-5]],{color: 'grey', highlightStrokeColor: 'grey',straightFirst:false, straightLast:false, strokeWidth: 1, dash:1});\n//t1 = board2.create('text',[4,-2,\"Enter a solution for θ(t) in the box below to preview your solution\"],{color: 'grey', fontSize: 16});\n\n// Pendulum rods\nvar l3 = board2.create('line', [p3, p4], {visible:true, straightFirst: false,straightLast: false, color: 'red', highlightStrokeColor: 'red', strokeWidth: 3});\nvar l4 = board2.create('line', [p1, p2], {visible:true, straightFirst: false,straightLast: false, color: '#91bcd8', highlightStrokeColor: '#91bcd8', strokeWidth: 3});\n\n// Info panel \nvar t2 = board2.create('text',[5,-0.3,''],{color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar t3 = board2.create('text',[5.5,-1.5,''],{color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar t4 = board2.create('text',[5.5,-2,''],{color: '#444', highlightStrokeColor: '#444', fontSize: 13});\nvar t5 = board2.create('text',[5.5,-3.5,''],{visible: false, color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar t6 = board2.create('text',[5.5,-4,''],{visible: false, color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar t7 = board2.create('text',[5.5,-1,'Correct solution'],{color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar t8 = board2.create('text',[5.5,-3,'Your solution'],{color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar t9 = board2.create('text',[5.5,-4,'Enter an answer below to preview your solution.'],{color: '#AAA', highlightStrokeColor: '#AAA', fontSize: 14});\n\n// Shaded background\nvar sq = board2.create('polygon',[[4.5,-5],[9,-5],[9,0.2],[4.5,0.2]], {color: '#DDD', highlightFillColor: '#DDD', vertices: {visible: false},borders: {strokeWidth: 3,lineCap: 'round',visible: false}});\n\n// Pendulum icons\nvar p5 = board2.create('point', [5, -1.5], {color: '#91bcd8', highlightFillColor: '#91bcd8', size: 8, name: '', strokeWidth: 0, highlightStrokeWidth: 0});\nvar p6 = board2.create('point', [5, -3.5], {color: 'red', highlightFillColor: 'red', size: 8, name: '', strokeWidth: 0, highlightStrokeWidth: 0});\nvar l5 = board2.create('line', [p5, [p5.X(),p5.Y()+0.5]], {straightFirst: false,straightLast: false, color: '#91bcd8', highlightStrokeColor: '#91bcd8', strokeWidth: 3});\nvar l6 = board2.create('line', [p6, [p6.X(),p6.Y()+0.5]], {straightFirst: false,straightLast: false, color: 'red', highlightStrokeColor: 'red', strokeWidth: 3});\n\n// Start button\nbutton1 = board2.create('button', [-4.9,-1, '► Restart', function() {\n startAnimation2(theta0);\n board2.update();\n }], {fontSize: 16, fixed: true}),\n\n\nisInDragMode = false;\n\n// the student's beta\nvar student_beta = null;\n\n// The animation\nfunction startAnimation2(start_pos) {\n\n var duration = 1e5; \n\n // Path of the correct solution\n p2.moveAlong(function() {\n return function(t) {\n if (t >= duration) {\n // Restart the animation\n startAnimation2(start_pos);\n }\n t = t/1000;\n var beta = k/(2*m);\n // Calculate theta \n var angle1= start_pos*Math.exp(-beta*t)*Math.cos(Math.sqrt((g/l)-beta) * t);\n var angle2=-Math.PI/2+angle1;\n t2._setUpdateText('t = '+t.toFixed(0)+'s');\n t3._setUpdateText('θ = '+angle1.toFixed(1)+'rad');\n\n if(t>0.01){\n // Fudge dtheta/dt\n var anglelast = start_pos*Math.exp(-beta*(t-0.01))*Math.cos(Math.sqrt((g/l)-beta) * (t-0.01) );\n var anglediff = (angle1-anglelast)/0.01; \n t4._setUpdateText('dθ/dt = '+anglediff.toFixed(1)+'rads-1');\n }\n return [p1.X()+l*Math.cos(angle2),p1.Y()+l*Math.sin(angle2)];\n }; \n }()\n );\n\n // Path of the student's solution\n p4.moveAlong(function() { \n return function(t) {\n if (t >= duration) {\n // Restart the animation\n startAnimation2(start_pos); \n }\n t = t/1000;\n try {\n if(student_beta===null) {\n throw(new Error(\"beta is not set\"));\n }\n var beta = student_beta || 0;\n var angle1 = start_pos*Math.exp(-beta*t)*Math.cos(Math.sqrt((g/l)-beta) * t);\n var angle2 = -Math.PI/2+angle1;\n\n if(isNaN(angle1) || isNaN(angle2)) {\n throw(new Error(\"angle NaN\"));\n }\n t5._setUpdateText('θ = '+angle1.toFixed(1)+'rad');\n\n if(t>0.01){\n // Fudge dtheta/dt\n anglelast= start_pos*Math.exp(-beta*(t-0.01))*Math.cos(Math.sqrt((g/l)-beta) * (t-0.01) );\n anglediff = (angle1-anglelast)/0.01; \n t6._setUpdateText('dθ/dt = '+anglediff.toFixed(1)+'rads-1');\n } \n\n return [p3.X()+l*Math.cos(angle2),p3.Y()+l*Math.sin(angle2)];\n } catch(e) {\n t5._setUpdateText('θ is not a real number!');\n t6._setUpdateText('');\n return [p3.X(),p3.Y()-l];\n }\n }; \n }());\n\n\n}\n\n// Start the animation with initial condition\nstartAnimation2(theta0);\n\n//pick up the student answer\nquestion.signals.on('HTMLAttached',function(e) {\n var part = question.getPart('p3g0');\n ko.computed(function(){\n var expr = part.display.studentAnswer();\n try {\n student_beta = Numbas.util.parseNumber(expr,part.settings.allowFractions,part.settings.allowFractions);\n if(isNaN(student_beta)) {\n throw(new Error(\"Not a number\"));\n }\n }\n catch(e) {\n student_beta = null;\n }\n console.log(student_beta);\n\n if(student_beta!==null){\n startAnimation2(theta0);\n t5.setAttribute({visible: true});\n t6.setAttribute({visible: true});\n t9.setAttribute({visible: false});\n board2.update();\n } else {\n t5.setAttribute({visible: false});\n t6.setAttribute({visible: false});\n t9.setAttribute({visible: true});\n board2.update();\n }\n\n });\n}); \n\n\nreturn div;\n\n", "parameters": [], "type": "html", "language": "javascript"}, "jsx_pendulum": {"definition": "JXG.Options = JXG.merge(JXG.Options,{\n elements: {\n fixed: true\n },\n point: {\n showInfobox: false\n },\n text: {\n highlightStrokeOpacity: 1\n }\n});\n\n// Get Numbas variables\nvar g = question.unwrappedVariables.g; // grav acc.\nvar l = question.unwrappedVariables.l; // length of rod\nvar m = question.unwrappedVariables.m; // mass of bob\nvar theta0 = question.unwrappedVariables.theta0; // initial angle\n\n// Set up board\nvar div = Numbas.extensions.jsxgraph.makeBoard('600px','250px',\n {\n boundingBox:[-5, 0.2, 9, -6],\n axis:false,\n showNavigation:false,\n grid:false\n }\n);\n\nvar board = div.board; \n\n// Pendulum 1: exact solution \nvar p3 = board.create('point', [0.02, 0], {visible:false, size: 3});\nvar c2 = board.create('circle', [p3, [0.02,5]], {visible:false, name: 'circle', size: 3});\nvar pp4 = board.create('glider', [0.02,5, c2], {visible: true, name: '', size: 8, color: 'red', highlightFillColor: 'red', strokeWidth: 0, highlightStrokeWidth: 0});\n\n\n// Pendulum 2: student solution\nvar p1 = board.create('point', [0, 0], {visible:false, size: 3});\nvar c1 = board.create('circle', [p1, [0,5]], {visible:false, name: 'circle', size: 3});\nvar pp2 = board.create('glider', [0,5, c1], {visible: true, name: '', size: 8, color: '#91bcd8', highlightFillColor: '#91bcd8', strokeWidth: 0, highlightStrokeWidth: 0});\n\n// Decor\nvar line1 = board.create('line', [[-2,0],[2,0]],{color: 'grey', highlightStrokeColor: 'grey',straightFirst:false, straightLast:false, strokeWidth: 10});\nvar line2 = board.create('line', [[0.02,0],[0.02,-5]],{color: 'grey', highlightStrokeColor: 'grey',straightFirst:false, straightLast:false, strokeWidth: 1, dash:1});\n\n// Pendulum rods\nvar line3 = board.create('line', [p3, pp4], {visible:true, straightFirst: false,straightLast: false, color: 'red', highlightStrokeColor: 'red', strokeWidth: 3});\nvar line4 = board.create('line', [p1, pp2], {visible:true, straightFirst: false,straightLast: false, color: '#91bcd8', highlightStrokeColor: '#91bcd8', strokeWidth: 3});\n\n// Info panel \nvar tt2 = board.create('text',[5,-0.3,''],{color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar tt3 = board.create('text',[5.5,-1.5,''],{color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar tt4 = board.create('text',[5.5,-2,''],{color: '#444', highlightStrokeColor: '#444', fontSize: 13});\nvar tt5 = board.create('text',[5.5,-3.5,''],{visible: false, color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar tt6 = board.create('text',[5.5,-4,''],{visible: false, color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar tt7 = board.create('text',[5.5,-1,'Correct solution'],{color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar tt8 = board.create('text',[5.5,-3,'Your solution'],{color: '#444', highlightStrokeColor: '#444', fontSize: 14});\nvar tt9 = board.create('text',[5.5,-4,'Enter an answer below to preview your solution.'],{color: '#AAA', highlightStrokeColor: '#aaa', fontSize: 14});\n\n// Shaded background\nvar sq = board.create('polygon',[[4.5,-5],[9,-5],[9,0.2],[4.5,0.2]], {color: '#DDD', highlightFillColor: '#ddd', vertices: {visible: false},borders: {strokeWidth: 3,lineCap: 'round',visible: false}});\n\n// Pendulum icons\nvar p5 = board.create('point', [5, -1.5], {color: '#91bcd8', highlightFillColor: '#91bcd8', highlightStrokeWidth:0, strokeWidth: 0, size: 8, name: ''});\nvar p6 = board.create('point', [5, -3.5], {color: 'red', highlightFillColor: 'red', size: 8, highlightStrokeWidth:0, strokeWidth: 0, name: ''});\nvar l5 = board.create('line', [p5, [p5.X(),p5.Y()+0.5]], {straightFirst: false,straightLast: false, color: '#91bcd8', highlightStrokeColor: '#91bcd8', strokeWidth: 3});\nvar l6 = board.create('line', [p6, [p6.X(),p6.Y()+0.5]], {straightFirst: false,straightLast: false, color: 'red', highlightStrokeColor: 'red', strokeWidth: 3});\n\n// Start button\nvar button1 = board.create('button', [-4.9,-1, '► Restart', function() {\n startAnimation(theta0);\n board.update();\n}], {fontSize: 16});\n\nvar isInDragMode = false;\n\n// Get the student's function (t is the independant variable)\nvar tree;\nvar nscope = new Numbas.jme.Scope([Numbas.jme.builtinScope]);\nfunction userf(t){\n if(tree) {\n try {\n var val = nscope.evaluate(tree, {t:t});\n if(val.type!=='number') {\n throw(new Error(\"not a number\"));\n }\n return val.value;\n }\n catch(e) {\n return 0;\n }\n } else {\n return 0;\n }\n}\n\n\n// The animation\nfunction startAnimation(start_pos) {\n // Run animations \n var duration = 0.5 * 1e5; \n\n // Path of the correct solution\n pp2.moveAlong(function() {\n return function(t) {\n if (t >= duration) {\n // Restart the animation\n startAnimation(start_pos);\n }\n t = t/1000;\n var angle1 = start_pos*Math.cos(Math.sqrt(g/l) * t);\n var angled1 = -Math.sqrt(g/l)*start_pos*Math.sin(Math.sqrt(g/l) * t);\n var angle2 = -Math.PI/2+angle1;\n tt2._setUpdateText('t = '+t.toFixed(0)+'s');\n tt3._setUpdateText('θ = '+angle1.toFixed(1)+'rad');\n tt4._setUpdateText('dθ/dt = '+angled1.toFixed(1)+'rads-1');\n return [p1.X()+l*Math.cos(angle2),p1.Y()+l*Math.sin(angle2)];\n }; \n }());\n\n // Path of the student's solution\n pp4.moveAlong(function() { \n return function(t) {\n if (t >= duration) {\n // Restart the animation\n startAnimation(start_pos);\n }\n t = t/1000;\n var utheta = userf(t);\n angle1=-Math.PI/2+utheta;\n angled1=(utheta-userf(t-0.001))/0.001;\n tt5._setUpdateText('θ = '+utheta.toFixed(1)+'rad');\n tt6._setUpdateText('dθ/dt = '+angled1.toFixed(1)+'rads-1'); \n return [p3.X()+l*Math.cos(angle1),p3.Y()+l*Math.sin(angle1)];\n }; \n }());\n}\n\n//pick up the student answer\nquestion.signals.on('HTMLAttached',function(e) {\n startAnimation(theta0); \n ko.computed(function(){\n var expr = question.getPart('p0g0').display.studentAnswer();\n try {\n tree = Numbas.jme.compile(expr,scope);\n }\n catch(e) {\n tree = null;\n }\n\n if(tree){\n startAnimation(theta0);\n tt5.setAttribute({visible: true});\n tt6.setAttribute({visible: true});\n tt9.setAttribute({visible: false});\n board.update();\n } else {\n tt9.setAttribute({visible: true});\n tt5.setAttribute({visible: false});\n tt6.setAttribute({visible: false});\n }\n\n });\n}); \n\n\nreturn div;\n\n", "parameters": [], "type": "html", "language": "javascript"}}, "preamble": {"js": "", "css": ".JXGtext button{\n color: black;\n background-color: #a2d1f0;\n border: 1px solid #91bcd8;\n border-radius: 6px;\n}\n\n.JXGtext button:hover{\n background-color: #91bcd8;\n}"}, "name": "Free oscillations of a pendulum", "variable_groups": [{"variables": ["k", "beta", "damping5", "damping0p01", "is_under_damped"], "name": "damping"}], "variablesTest": {"condition": "", "maxRuns": 100}, "extensions": ["jsxgraph"], "rulesets": {}, "ungrouped_variables": ["g", "l", "m", "T", "theta0_frac", "theta0"], "statement": "

In the absence of air resistance, the equation of motion of a bob, of mass $m$, at the end of a pendulum of length $l$ is

\n

\\[ ml\\frac{\\mathrm{d}^2\\theta}{\\mathrm{d}t^2} = -mg\\sin\\theta\\text{.} \\]

\n

In the small angle approximation, $\\sin\\theta\\approx\\theta$, this reduces to

\n

\\[ \\frac{\\mathrm{d}^2\\theta}{\\mathrm{d}t^2}+\\frac{g}{l}\\theta = 0\\text{.} \\]

", "metadata": {"licence": "None specified", "description": "

Solving 2nd order differential equation for pendulum, with and without damping.

"}, "parts": [{"variableReplacementStrategy": "originalfirst", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "useCustomName": false, "type": "gapfill", "gaps": [{"checkVariableNames": true, "variableReplacements": [], "checkingAccuracy": 0.001, "showFeedbackIcon": true, "useCustomName": false, "extendBaseMarkingAlgorithm": true, "valuegenerators": [{"value": "", "name": "t"}], "answerSimplification": "all,!fractionnumbers", "vsetRange": [0, 1], "marks": "2", "answer": "(pi/{theta0_frac})*cos(sqrt({g}/{l})*t)", "variableReplacementStrategy": "originalfirst", "checkingType": "absdiff", "showPreview": true, "type": "jme", "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "vsetRangePoints": 5, "showCorrectAnswer": true, "failureRate": 1, "adaptiveMarkingPenalty": 0, "customName": ""}], "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "prompt": "

{jsx_pendulum()}

\n

You are told that $g=\\var{g}\\textrm{ms}^{-2}$ and that the length of the pendulum's rod $l = \\var{l}$ m. 

\n

Solve for $\\theta(t)$ with initial conditions $\\frac{\\mathrm{d}\\theta}{\\mathrm{d}t}(0)=0$,  $\\theta(0)=\\frac{\\pi}{\\var{theta0_frac}}$. 

\n

$\\theta(t) = $ [[0]]

", "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "marks": 0, "sortAnswers": false, "customName": ""}, {"variableReplacementStrategy": "originalfirst", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "useCustomName": false, "type": "gapfill", "gaps": [{"precisionMessage": "You have not given your answer to the correct precision.", "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showFeedbackIcon": true, "useCustomName": false, "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "precision": "2", "precisionType": "dp", "marks": 1, "showPrecisionHint": true, "minValue": "T", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "correctAnswerFraction": false, "type": "numberentry", "customMarkingAlgorithm": "", "strictPrecision": false, "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "maxValue": "T", "adaptiveMarkingPenalty": 0, "correctAnswerStyle": "plain", "customName": "", "mustBeReduced": false}], "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "prompt": "

What is the time period of the undamped oscillations?

\n

$T = $ [[0]]s

", "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "marks": 0, "sortAnswers": false, "customName": ""}, {"variableReplacementStrategy": "originalfirst", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "useCustomName": false, "type": "gapfill", "gaps": [{"precisionMessage": "You have not given your answer to the correct precision.", "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showFeedbackIcon": true, "useCustomName": false, "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "precision": "2", "precisionType": "dp", "marks": 1, "showPrecisionHint": true, "minValue": "{theta0*sqrt(g/l)}", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "correctAnswerFraction": false, "type": "numberentry", "customMarkingAlgorithm": "", "strictPrecision": false, "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "maxValue": "{theta0*sqrt(g/l)}", "adaptiveMarkingPenalty": 0, "correctAnswerStyle": "plain", "customName": "", "mustBeReduced": false}], "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "prompt": "

Determine the maximum angular velocity of the bob.

\n

$\\left(\\frac{\\mathrm{d}\\theta}{\\mathrm{d}t}\\right)_{\\text{max}} = $ [[0]] rad s$^{-1}$.

", "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "marks": 0, "sortAnswers": false, "customName": ""}, {"variableReplacementStrategy": "originalfirst", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "useCustomName": false, "type": "gapfill", "gaps": [{"precisionMessage": "You have not given your answer to the correct precision.", "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showFeedbackIcon": true, "useCustomName": false, "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "precision": "2", "precisionType": "dp", "marks": "2", "showPrecisionHint": true, "minValue": "{k/(2*m)}", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "correctAnswerFraction": false, "type": "numberentry", "customMarkingAlgorithm": "", "strictPrecision": false, "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "maxValue": "{k/(2*m)}", "adaptiveMarkingPenalty": 0, "correctAnswerStyle": "plain", "customName": "", "mustBeReduced": false}], "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "prompt": "

Introducing a friction coefficient, $k$, that is proportional to the speed of the bob, the equation of motion becomes

\n

\\[ \\frac{\\mathrm{d}^2\\theta}{\\mathrm{d}t^2}+\\frac{k}{m}\\frac{\\mathrm{d}\\theta}{\\mathrm{d}t}+\\frac{g}{l}\\theta = 0\\text{.} \\]

\n

Let $k=\\var{k}\\textrm{kg s}^{-1}$ and $m=\\var{m}$kg. The initial conditions in part (a) yield the solution

\n

\\[\\theta(t) = \\frac{\\pi}{\\var{theta0_frac}}e^{-\\beta t}\\cos\\left(t \\;\\sqrt{\\frac{\\var{g}}{\\var{l}}-\\beta^2}\\right)\\text{.} \\]

\n

Determine the value of $\\beta$.

\n

$\\beta = $ [[0]]

\n

{jsx_pendulum2()}

", "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "marks": 0, "sortAnswers": false, "customName": ""}, {"variableReplacementStrategy": "originalfirst", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "useCustomName": false, "type": "gapfill", "gaps": [{"precisionMessage": "You have not given your answer to the correct precision.", "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "showFeedbackIcon": true, "useCustomName": false, "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "precision": "2", "precisionType": "dp", "marks": 1, "showPrecisionHint": true, "minValue": "{damping5}", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "correctAnswerFraction": false, "type": "numberentry", "customMarkingAlgorithm": "", "strictPrecision": false, "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "maxValue": "{damping5}", "adaptiveMarkingPenalty": 0, "correctAnswerStyle": "plain", "customName": "", "mustBeReduced": false}], "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "prompt": "

After how long do the amplitude of oscillations decay to 5% of the initial release angle?

\n

[[0]]s

", "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "marks": 0, "sortAnswers": false, "customName": ""}], "advice": "

a)

\n

We have a second order constant coefficient differential equation,

\n

\\[ \\frac{\\mathrm{d}^2\\theta}{\\mathrm{d}t^2}+\\frac{g}{l}\\theta = 0 \\text{.} \\]

\n

Setting $\\theta = e^{\\lambda t}$, we obtain the auxiliary equation

\n

\\[ \\lambda^2 + \\frac{g}{l} = 0 \\implies \\lambda = \\pm i\\sqrt{\\frac{g}{l}} \\text{.} \\]

\n

The general solution for an auxiliary equation with complex roots is

\n

\\[ \\theta(t) = A\\sin\\omega t + B\\cos\\omega t \\text{,} \\]

\n

where $\\omega = \\sqrt{\\frac{g}{l}}$ is the angular frequency of the oscillations, also known as the natural frequency: the frequency with which the pendulum oscillates in the absence of external forcing).

\n

Note that

\n

\\[ \\frac{\\mathrm{d}\\theta}{\\mathrm{d}t} = A\\omega\\cos\\omega t - B\\omega\\sin\\omega t \\text{.} \\]

\n

Applying the initial conditions:

\n

\\begin{align}
\\frac{\\mathrm{d}\\theta}{\\mathrm{d}t} (0) = 0 &=A\\omega\\cos(0) - B\\omega\\sin(0) \\text{,}  \\\\
&= A\\omega \\text{,} \\\\
\\therefore A &= 0 \\text{.}
\\end{align}

\n

\\begin{align}
\\theta (0) =\\frac{\\pi}{\\var{theta0_frac}} &=B\\cos(0) \\text{,}  \\\\
\\therefore B &=\\frac{\\pi}{\\var{theta0_frac}} \\text{.}
\\end{align}

\n

Therefore our solution is

\n

\\[ \\theta(t) = \\frac{\\pi}{\\var{theta0_frac}}\\cos\\left(\\sqrt{\\frac{g}{l}}t\\right)\\text{.} \\]

\n

Using the given values for $g$ and $l$,

\n

\\[ \\theta(t) = \\frac{\\pi}{\\var{theta0_frac}}\\cos\\left(\\sqrt{\\frac{\\var{g}}{\\var{l}}}t\\right)\\text{.} \\]

\n

\n

b)

\n

The time period of oscillations is given by

\n

\\[ T = \\frac{2\\pi}{\\omega} = 2\\pi\\sqrt{\\frac{l}{g}} =2\\pi\\sqrt{\\frac{\\var{l}}{\\var{g}}} = \\var{precround(T,2)} \\text{ s.} \\]

\n

c)

\n

Differentiating our solution from part (a), we have

\n

\\[ \\frac{d\\theta}{dt} = -\\frac{\\pi}{\\var{theta0_frac}}\\omega \\sin\\omega t\\text{.} \\]

\n

This is at its maximum when $\\sin \\omega t = -1$, 

\n

\\[ \\left(\\frac{\\mathrm{d}\\theta}{\\mathrm{d}t}\\right)_{\\text{max}} = \\frac{\\pi}{\\var{theta0_frac}}\\omega =\\frac{\\pi}{\\var{theta0_frac}}\\sqrt{\\frac{\\var{g}}{\\var{l}}} = \\var{precround(theta0*sqrt(g/l),2)}\\text{ rad s}^{-1 }\\text{.} \\]

\n

d)

\n

With the addition of a damping term, our differential equation becomes

\n

\\[ \\frac{\\mathrm{d}^2\\theta}{\\mathrm{d}t^2}+\\frac{k}{m}\\frac{\\mathrm{d}\\theta}{\\mathrm{d}t}+\\frac{g}{l}\\theta = 0\\text{.} \\]

\n

This is still a constant-coefficient second-order differential equation, however the extra term changes the auxiliary equation. For convenience we can let $\\beta = \\frac{k}{2m}$ (we will later find that this is $\\beta$ as asked for in the question) and $\\omega^2 = \\frac{g}{l}$, as before, to put our auxiliary equation in the form

\n

\\[ \\lambda^2 + 2\\beta \\lambda + \\omega^2 = 0\\text{,} \\]

\n

which has the solutions

\n

\\[ \\begin{align} \\lambda &=-\\frac{2\\beta}{2}\\pm \\frac{\\sqrt{2\\beta^2-4\\omega^2}}{2} \\\\
 &= -\\beta\\pm \\sqrt{\\beta^2-\\omega^2} \\\\
 &= -\\beta\\pm i\\sqrt{\\omega^2-\\beta^2}\\text{.} \\end{align}\\]

\n

Note that the values in our problem have determined that $\\omega >\\beta$. As in part (a), we have an auxiliary equation with complex roots:

\n

\\[\\theta(t) = e^{-\\beta t}\\left[A\\sin\\left(\\sqrt{\\omega^2-\\beta^2}\\; t\\right) + B\\cos\\left(\\sqrt{\\omega^2-\\beta^2}\\; t\\right)\\right]\\text{.} \\]

\n

Using the values and initial conditions from part (a), this becomes

\n

\\[\\theta(t) = \\frac{\\pi}{\\var{theta0_frac}}e^{-\\beta t}\\cos\\left(\\sqrt{\\frac{\\var{g}}{\\var{l}}-\\beta^2}\\; t\\right)\\text{,} \\]

\n

with

\n

\\[ \\beta = \\frac{k}{2m} = \\frac{\\var{k}}{2\\times\\var{m}} = \\var{precround(beta,2)}\\text{.}\\]

\n

e)

\n

The amplitude of the oscillation is at 5% of the initial release angle when

\n

\\[ e^{-\\beta t} = 0.05\\text{.} \\]

\n

The time taken is therefore

\n

\\[ t = -\\frac{\\ln{(0.05)}}{\\beta}=-\\frac{\\ln{(0.05)}}{\\var{precround(beta,2)}} = \\var{precround(damping5,2)}\\text{ s.} \\]

\n

", "tags": [], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas-editor.mas.ncl.ac.uk/accounts/profile/3/"}, {"name": "Christopher Graham", "profile_url": "https://numbas-editor.mas.ncl.ac.uk/accounts/profile/73/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas-editor.mas.ncl.ac.uk/accounts/profile/3/"}, {"name": "Christopher Graham", "profile_url": "https://numbas-editor.mas.ncl.ac.uk/accounts/profile/73/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}]}