// Numbas version: exam_results_page_options {"name": "Martin's copy of Kirchoff's Law", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"circuit": {"definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n{boundingBox: [0,13,13,0],\n axis: false,\n showNavigation: false,\n grid: true\n});\n \n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\nvar board = div.board; \n\n\nvar v_source = board.createElement('circle',[[2,6],[2.5,6]],{strokeColor:'black',draft:true});\nvar p1 = board.createElement('point',[2,6.5],{name:' ',visible:false});\nvar p2 = board.createElement('point',[2,9],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{strokeColor:'black',straightFirst:false, straightLast:false});\nvar p1 = board.createElement('point',[2,5.5],{name:' ',visible:false});\nvar p2 = board.createElement('point',[2,3],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{strokeColor:'black',straightFirst:false, straightLast:false});\nvar p1 = board.createElement('point',[2,9],{name:' ',visible:false});\nvar p2 = board.createElement('point',[3,9],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{lastArrow:true,strokeColor:'black',straightFirst:false, straightLast:false});\nvar p1 = board.createElement('point',[3,9],{name:' ',visible:false});\nvar p2 = board.createElement('point',[4,9],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{strokeColor:'black',straightFirst:false, straightLast:false});\n\n\n\np1 = board.create('point',[4,8.75],{name:'',visible:false});\np2 = board.create('point',[4,9.25],{name:'',visible:false});\np3 = board.create('point',[6,9.25],{name:'',visible:false});\np4 = board.create('point',[6,8.75],{name:'',visible:false});\nboard.create('polygon',[p1,p2,p3,p4],{strokeColor:'black'});\n\nvar p1 = board.createElement('point',[6,9],{name:' ',visible:false});\nvar p2 = board.createElement('point',[10,9],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{strokeColor:'black',straightFirst:false, straightLast:false});\n\nvar p1 = board.createElement('point',[10,9],{name:' ',visible:false});\nvar p2 = board.createElement('point',[10,7],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{strokeColor:'black',straightFirst:false, straightLast:false});\n\nvar i_source_a = board.createElement('circle',[[10,6.5],[10.5,6.5]],{strokeColor:'black',draft:true});\nvar i_source_b = board.createElement('circle',[[10,6],[10.5,6]],{strokeColor:'black',draft:true});\n\nvar p1 = board.createElement('point',[10,5.5],{name:' ',visible:false});\nvar p2 = board.createElement('point',[10,3],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{strokeColor:'black',straightFirst:false, straightLast:false});\nvar p1 = board.createElement('point',[2,3],{name:' ',visible:false});\nvar p2 = board.createElement('point',[10,3],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{strokeColor:'black',straightFirst:false, straightLast:false});\n\nvar p1 = board.createElement('point',[7,9],{name:' ',visible:false});\nvar p2 = board.createElement('point',[7,7],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{strokeColor:'black',straightFirst:false, straightLast:false});\n\np1 = board.create('point',[6.75,7],{name:'',visible:false});\np2 = board.create('point',[7.25,7],{name:'',visible:false});\np3 = board.create('point',[7.25,5],{name:'',visible:false});\np4 = board.create('point',[6.75,5],{name:'',visible:false});\nboard.create('polygon',[p1,p2,p3,p4],{strokeColor:'black'});\n\nvar p1 = board.createElement('point',[7,5],{name:' ',visible:false});\nvar p2 = board.createElement('point',[7,3],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{strokeColor:'black',straightFirst:false, straightLast:false});\n\nvar p1 = board.createElement('point',[11,4.5],{name:' ',visible:false});\nvar p2 = board.createElement('point',[11,7.5],{name:' ',visible:false});\nvar line = board.createElement('line',[p1,p2],{lastArrow:true,strokeColor:'black',straightFirst:false, straightLast:false});\n\nboard.create('text', [1, 2, \"R1\"],{fontSize:20});\nvar R1 = board.create('slider', [[2, 2], [6, 2], [1, 5, 10]],{snapWidth:1});\nboard.create('text', [1, 1, \"R2\"],{fontSize:20});\nvar R2 = board.create('slider', [[2, 1], [6, 1], [3, 7, 12]],{snapWidth:1});\n\n\nboard.create('text', [1.1, 6.5, \"+\"],{fontSize:20});\nboard.create('text', [1.1, 5.5, \"-\"],{fontSize:20});\nboard.create('text', [11.5, 6, \"Vx\"],{fontSize:20});\nboard.create('text',[11.5,5,function(){Vx=(I1+Ix)*R2.Value();return +Vx+\"V\"}],{fontSize:20});\nboard.create('text', [3, 6, \"V1\"],{fontSize:20});\nboard.create('text',[3,5,function(){V1=Vx+(Ix*R1.Value());return +V1+\"V\"}],{fontSize:20});\nboard.create('text', [8.7, 6, \"I1\"],{fontSize:20});\nboard.create('text', [8.5, 5.25, +I1+\"A\"],{fontSize:20});\nboard.create('text', [5, 6.5, \"R2\"],{fontSize:20});\nboard.create('text',[5,5.5,function(){return +R2.Value()+\"R\" }],{fontSize:20});\nboard.create('text', [4.5, 10.75, \"R1\"],{fontSize:20});\nboard.create('text',[4.5,10,function(){return +R1.Value()+\"R\" }],{fontSize:20});\nboard.create('text', [2.5, 10.25, \"Ix\"],{fontSize:20});\nboard.create('text', [2.25, 9.5, +Ix+\"A\"],{fontSize:20});\n\n\nreturn div;", "type": "html", "language": "javascript", "parameters": [["Ix", "number"], ["I1", "number"]]}}, "ungrouped_variables": ["Ix", "I1"], "name": "Martin's copy of Kirchoff's Law", "tags": ["graphs", "jsxgraph", "Jsxgraph"], "preamble": {"css": "", "js": ""}, "advice": "

Find the current in $R_2$ using KCL then use Ohm's law to find $V_X$ Find $V_1$ by adding the potential drop $I_X R_1$

", "rulesets": {}, "parts": [], "statement": "

{circuit(Ix,I1)}

\n

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"I1": {"definition": "random(1..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "I1", "description": ""}, "Ix": {"definition": "random(1..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "Ix", "description": ""}}, "metadata": {"notes": "", "description": "", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Martin Johnston", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/536/"}]}]}], "contributors": [{"name": "Martin Johnston", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/536/"}]}