# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
925 lines (816 sloc) 45.6 KB
 Simple Geometry Proofs
new Seg("A","C") AC AD new Seg("B","E") BE new Seg("A","E") AE new Seg("B","C") BC new Seg("B","D") BD new Seg("C","D") CD new Seg("C","E") CE [AC,CA,AE,EA,BC,CB,BD,DB,CD,DC,CE,EC] new Ang("D","A","C", null) new Ang("C","B","E", null) new Ang("A","C","D", null) new Ang("B","C","E", null) new Ang("A","D","C", null) new Ang("C","E","B", null) new Ang("A","C","B", null) new Ang("D","C","E", null) [ang1, ang2, ang3, ang4, ang5, ang6, ang7, ang8] [addAngs(ang3, ang7), addAngs(ang7, ang4), addAngs(ang4, ang8), addAngs(ang8, ang3)] [] [] new Triang([AD, DC, CA], [ang5, ang3, ang1]) new Triang([BE, EC, CB], [ang6, ang4, ang2]) [ADC, BEC] initProof(SEGS, ANGS, TRIANGLES, SUPPLEMENTARY_ANGS, ALTERNATE_INTERIOR_ANGS, 2, 0.25, "triangle") STATEMENTS[0] STATEMENTS[1] "you haven't entered anything yet" 3

Prove FINISHED .

This figure is not drawn to scale.

init({ range: [[-5, 5], [-5, 5]], scale: 40 }); addMouseLayer(); graph.congruency = addCongruency({ y1: -0.7, y2: 10.7 }); graph.congruency.addPoint("A", [-4, 4]); graph.congruency.addPoint("B", [4, 4]); graph.congruency.addPoint("C", [0, -(4/3)]); graph.congruency.addPoint("D", [-2, -4]); graph.congruency.addPoint("E", [2, -4]); graph.congruency.addLine({ start: "A", end: "D", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "A", end: "C", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "C", end: "D", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "C", end: "B", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "C", end: "E", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "E", end: "B", clickable: true, maxState: 3 }); graph.congruency.addAngles("A", { maxState: 3 }); graph.congruency.addAngles("B", { maxState: 3 }); graph.congruency.addAngles("C", { maxState: 3 }); graph.congruency.addAngles("D", { maxState: 3 }); graph.congruency.addAngles("E", { maxState: 3 }); for(var angle in graph.congruency.angles){ graph.congruency.angles[angle].setSelectedStyle({ stroke: "black", "stroke-width": 3 }); } graph.congruency.addLabel("A", "left"); graph.congruency.addLabel("B", "right"); graph.congruency.addLabel("C", "right"); graph.congruency.addLabel("D", "left"); graph.congruency.addLabel("E", "right"); $(".hint1").hide();$(".hint2").hide(); $(".hint3").hide(); var hintCategory = "good format but wrong"; var hintsLeft = 2; var giveAway = false;$(".nextStatement input").keyup(function(){ var thing1 = $("#thing1").val().toUpperCase(); var thing2 =$("#thing2").val().toUpperCase(); var reason = $("#reason").val(); if(thing1.length === 0 && thing2.length === 0){ hintCategory = "good format but wrong"; return; } var verifyTriangles = thing1.length === 3 && thing2.length === 3 ? verifyStatementArgs(thing1+"="+thing2, reason, "triangle congruence") : false; var verifyAngles = thing1.length === 3 && thing2.length === 3 ? verifyStatementArgs(thing1+"="+thing2, reason, "angle equality") : false; var verifySegments = thing1.length === 2 && thing2.length === 2 ? verifyStatementArgs(thing1+"="+thing2, reason, "segment equality") : false; if(verifyTriangles === true || verifyAngles === true || verifySegments === true){$(".statements").html(outputKnownProof()); _.each($(".statements code"), function(tag){$.tmpl.type.code()(tag); }); $("#thing1").val("");$("#thing2").val(""); $("#reason").val("");$("#symbol1").html(""); $("#symbol2").html(""); if(userProofDone === true){$(".nextStatement").hide(); $("#hint").attr("disabled", true);$("#hint").unbind("click", giveHint); } else{ hintsLeft = 2; $("#hint").val("I'd like a hint (2 hints left for this step)");$("#hint").attr("disabled", false); hintCategory = "good format but wrong"; giveAway = false; } if(verifySegments === true){ animateSegmentPair(thing1, thing2, null); } if(verifyAngles === true){ animateAnglePair(thing1, thing2, null); } if(verifyTriangles === true){ aniNames = _.map(animationObjects, function(pair){ if(pair[0] instanceof Seg){ return [pair[0].toString().substring(3,5), pair[1].toString().substring(3,5)]; } else{ return [pair[0].toString().substring(3,6), pair[1].toString().substring(3,6)]; } }); animatePair(aniNames[0][0], aniNames[0][1], function(){ animatePair(aniNames[1][0], aniNames[1][1], function(){ animatePair(aniNames[2][0], aniNames[2][1], null); }); }); } } else if(verifyTriangles === false || verifyAngles === false || verifySegments === false){ hintCategory = "good format but wrong"; } else{ hintCategory = "bad format"; } }); $("#reason").change(function(){$(".nextStatement input").keyup(); }); var storedHint = ""; var giveHint = function(){ if(hintsLeft > 0){ hintsLeft--; if(hintCategory === "bad format"){ hintsLeft++; var stepsLeft = hintsLeft + " hint" + (hintsLeft === 1 ? "" : "s") + " left"; $(this).val("I'd like a hint (" + stepsLeft + " for this step)");$(this).attr("disabled", false); $(".actualHints").append("<p> The things you've entered aren't segments, angles, or triangles in the figure. </p>"); } else{ var stepsLeft = hintsLeft + " hint" + (hintsLeft === 1 ? "" : "s") + " left";$(this).val("I'd like a hint (" + stepsLeft + " for this step)"); $(this).attr("disabled", false); if(!giveAway){ var nextHintSet = nextStatementHint();$(".actualHints").append("<p>"+nextHintSet[0]+"</p>"); storedHint = nextHintSet[1]; } else{ $(".actualHints").append("<p>"+storedHint+"</p>"); storedHint = ""; } _.each($(".actualHints code"), function(tag){ $.tmpl.type.code()(tag); }); giveAway = !giveAway; } if(hintsLeft === 0){$("#hint").attr("disabled", true); } } }; $("#hint").click(giveHint); outputKnownProof() \cong because When you enter the next statement in the proof, and a valid reason, that statement will be added to the proof. When you're done, hit check answer. 1 return isProofDone(); outputKnownProof(); new Seg("A","B") AB new Seg("A","C") AC new Seg("A","E") AE new Seg("B","C") BC new Seg("B","D") BD new Seg("C","D") CD new Seg("C","E") CE new Seg("D","E") DE [AB,BA,AC,CA,AE,EA,BC,CB,BD,DB,CD,DC,CE,EC,DE,ED] new Ang("C","A","B", null) new Ang("C","B","A", null) new Ang("A","C","B", null) new Ang("D","C","E", null) new Ang("C","D","E", null) new Ang("C","E","D", null) new Ang("A","C","D", null) new Ang("B","C","E", null) [ang1, ang2, ang3, ang4, ang5, ang6, ang7, ang8] [addAngs(ang3, ang7), addAngs(ang7, ang4), addAngs(ang4, ang8), addAngs(ang8, ang3)] [[ang2, ang5], [ang1, ang6]] [] new Triang([AB, BC, CA], [ang2, ang3, ang1]) new Triang([CD, DE, EC], [ang5, ang6, ang4]) [ABC, CDE] initProof(SEGS, ANGS, TRIANGLES, SUPPLEMENTARY_ANGS, ALTERNATE_INTERIOR_ANGS, 2, 0.25, "triangle") STATEMENTS[0] STATEMENTS[1] { r: 0.2, fill: BLUE, stroke: "none" } Prove FINISHED . \overline{AB} is parallel to \overline{DE} . This figure is not drawn to scale. init({ range: [[-5, 5], [-5, 5]], scale: 40 }); addMouseLayer(); graph.congruency = addCongruency({ y1: -0.7, y2: 10.7 }); graph.congruency.addPoint("A", [-3, 4]); graph.congruency.addPoint("B", [3, 4]); graph.congruency.addPoint("C", [0, 0]); graph.congruency.addPoint("D", [-3, -4]); graph.congruency.addPoint("E", [3, -4]); graph.congruency.addLine({ start: "A", end: "B", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "A", end: "C", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "B", end: "C", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "C", end: "D", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "C", end: "E", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "D", end: "E", clickable: true, maxState: 3 }); graph.congruency.addAngles("A", { maxState: 3 }); graph.congruency.addAngles("B", { maxState: 3 }); graph.congruency.addAngles("C", { maxState: 3 }); graph.congruency.addAngles("D", { maxState: 3 }); graph.congruency.addAngles("E", { maxState: 3 }); for(var angle in graph.congruency.angles){ graph.congruency.angles[angle].setSelectedStyle({ stroke: "black", "stroke-width": 3 }); } graph.congruency.addLabel("A", "left"); graph.congruency.addLabel("B", "right"); graph.congruency.addLabel("C", "right"); graph.congruency.addLabel("D", "left"); graph.congruency.addLabel("E", "right");$(".hint1").hide(); $(".hint2").hide();$(".hint3").hide(); var hintCategory = "good format but wrong"; var hintsLeft = 2; var giveAway = false; $(".nextStatement input").keyup(function(){ var thing1 =$("#thing1").val().toUpperCase(); var thing2 = $("#thing2").val().toUpperCase(); var reason =$("#reason").val(); if(thing1.length === 0 && thing2.length === 0){ hintCategory = "good format but wrong"; return; } filteredAngles = {"BAE" : "BAC", "EAB" : "CAB", "BDE" : "CDE", "EDB" : "EDC", "ABD" : "ABC", "DBA" : "CBA", "AED" : "CED", "DEA" : "DEC"}; if(thing1 in filteredAngles){ thing1 = filteredAngles[thing1]; } if(thing2 in filteredAngles){ thing2 = filteredAngles[thing2]; } var verifyTriangles = thing1.length === 3 && thing2.length === 3 ? verifyStatementArgs(thing1+"="+thing2, reason, "triangle congruence") : false; var verifyAngles = thing1.length === 3 && thing2.length === 3 ? verifyStatementArgs(thing1+"="+thing2, reason, "angle equality") : false; var verifySegments = thing1.length === 2 && thing2.length === 2 ? verifyStatementArgs(thing1+"="+thing2, reason, "segment equality") : false; if(verifyTriangles === true || verifyAngles === true || verifySegments === true){ $(".statements").html(outputKnownProof()); _.each($(".statements code"), function(tag){ $.tmpl.type.code()(tag); });$("#thing1").val(""); $("#thing2").val("");$("#reason").val(""); $("#symbol1").html("");$("#symbol2").html(""); if(userProofDone === true){ $(".nextStatement").hide();$("#hint").attr("disabled", true); $("#hint").unbind("click", giveHint); } else{ hintsLeft = 2;$("#hint").val("I'd like a hint (2 hints left for this step)"); $("#hint").attr("disabled", false); hintCategory = "good format but wrong"; giveAway = false; } if(verifySegments === true){ animateSegmentPair(thing1, thing2, null); } if(verifyAngles === true){ animateAnglePair(thing1, thing2, null); } if(verifyTriangles === true){ aniNames = _.map(animationObjects, function(pair){ if(pair[0] instanceof Seg){ return [pair[0].toString().substring(3,5), pair[1].toString().substring(3,5)]; } else{ return [pair[0].toString().substring(3,6), pair[1].toString().substring(3,6)]; } }); animatePair(aniNames[0][0], aniNames[0][1], function(){ animatePair(aniNames[1][0], aniNames[1][1], function(){ animatePair(aniNames[2][0], aniNames[2][1], null); }); }); } } else if(verifyTriangles === false || verifyAngles === false || verifySegments === false){ hintCategory = "good format but wrong"; } else{ hintCategory = "bad format"; } });$("#reason").change(function(){ $(".nextStatement input").keyup(); });$(".actualHints").html(""); var storedHint = ""; var giveHint = function(){ if(hintsLeft > 0){ hintsLeft--; if(hintCategory === "bad format"){ hintsLeft++; var stepsLeft = hintsLeft + " hint" + (hintsLeft === 1 ? "" : "s") + " left"; $(this).val("I'd like a hint (" + stepsLeft + " for this step)");$(this).attr("disabled", false); $(".actualHints").append("<p> The things you've entered aren't segments, angles, or triangles in the figure. </p>"); } else{ var stepsLeft = hintsLeft + " hint" + (hintsLeft === 1 ? "" : "s") + " left";$(this).val("I'd like a hint (" + stepsLeft + " for this step)"); $(this).attr("disabled", false); if(!giveAway){ var nextHintSet = nextStatementHint();$(".actualHints").append("<p>"+nextHintSet[0]+"</p>"); storedHint = nextHintSet[1]; } else{ $(".actualHints").append("<p>"+storedHint+"</p>"); storedHint = ""; } _.each($(".actualHints code"), function(tag){ $.tmpl.type.code()(tag); }); giveAway = !giveAway; } if(hintsLeft === 0){$("#hint").attr("disabled", true); } } }; $("#hint").click(giveHint); outputKnownProof() \cong because When you enter the next statement in the proof, and a valid reason, that statement will be added to the proof. When you're done, hit check answer. 1 return isProofDone(); outputKnownProof(); [0,6] [-8,0] [8,0] [0,-6] ["A","B","C","D"] new Seg("A","B") AB new Seg("A","C") AC new Seg("B","D") BD new Seg("C","D") CD AD [AB,BA,AC,CA,BD,DB,CD,DC,AD,DA] new Ang("A","B","D", null) new Ang("B","A","D", null) new Ang("D","A","C", null) new Ang("A","C","D", null) new Ang("A","D","B", null) new Ang("A","D","C", null) [ang1, ang2, ang3, ang4, ang5, ang6] [] [] [] new Triang([BA, AD, DB], [ang2, ang5, ang1]) new Triang([CA, AD, DC], [ang3, ang6, ang4]) [BAD, CAD] initProof(SEGS, ANGS, TRIANGLES, SUPPLEMENTARY_ANGS, ALTERNATE_INTERIOR_ANGS, 2, 0.25, "triangle") STATEMENTS[0] STATEMENTS[1] You are given KNOWN . Prove FINISHED init({ range: [[-5, 5], [-5, 5]], scale: 40 }); addMouseLayer(); graph.congruency = addCongruency({ y1: -0.7, y2: 10.7 }); graph.congruency.addPoint("A", [0, 3]); graph.congruency.addPoint("B", [-4, 0]); graph.congruency.addPoint("C", [4, 0]); graph.congruency.addPoint("D", [0, -3]); graph.congruency.addLine({ start: "A", end: "B", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "B", end: "D", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "A", end: "D", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "A", end: "C", clickable: true, maxState: 3 }); graph.congruency.addLine({ start: "C", end: "D", clickable: true, maxState: 3 }); graph.congruency.addAngles("A", { maxState: 3 }); graph.congruency.addAngles("B", { maxState: 3 }); graph.congruency.addAngles("C", { maxState: 3 }); graph.congruency.addAngles("D", { maxState: 3 }); for(var angle in graph.congruency.angles){ graph.congruency.angles[angle].setSelectedStyle({ stroke: "black", "stroke-width": 3 }); } graph.congruency.addLabel("A", "above"); graph.congruency.addLabel("B", "left"); graph.congruency.addLabel("C", "right"); graph.congruency.addLabel("D", "below");$(".hint1").hide(); $(".hint2").hide();$(".hint3").hide(); var hintCategory = "good format but wrong"; var hintsLeft = 2; var giveAway = false; $(".nextStatement input").keyup(function(){ var thing1 =$("#thing1").val().toUpperCase(); var thing2 = $("#thing2").val().toUpperCase(); var reason =$("#reason").val(); if(thing1.length === 0 && thing2.length === 0){ hintCategory = "good format but wrong"; return; } var verifyTriangles = thing1.length === 3 && thing2.length === 3 ? verifyStatementArgs(thing1+"="+thing2, reason, "triangle congruence") : false; var verifyAngles = thing1.length === 3 && thing2.length === 3 ? verifyStatementArgs(thing1+"="+thing2, reason, "angle equality") : false; var verifySegments = thing1.length === 2 && thing2.length === 2 ? verifyStatementArgs(thing1+"="+thing2, reason, "segment equality") : false; if(verifyTriangles === true || verifyAngles === true || verifySegments === true){ $(".statements").html(outputKnownProof()); _.each($(".statements code"), function(tag){ $.tmpl.type.code()(tag); });$("#thing1").val(""); $("#thing2").val("");$("#reason").val(""); if(userProofDone === true){ $(".nextStatement").hide();$("#hint").attr("disabled", true); $("#hint").unbind("click", giveHint); } else{ hintsLeft = 2;$("#hint").val("I'd like a hint (2 hints left for this step)"); $("#hint").attr("disabled", false); hintCategory = "good format but wrong"; giveAway = false; } if(verifySegments === true){ animateSegmentPair(thing1, thing2, null); } if(verifyAngles === true){ animateAnglePair(thing1, thing2, null); } if(verifyTriangles === true){ aniNames = _.map(animationObjects, function(pair){ if(pair[0] instanceof Seg){ return [pair[0].toString().substring(3,5), pair[1].toString().substring(3,5)]; } else{ return [pair[0].toString().substring(3,6), pair[1].toString().substring(3,6)]; } }); animatePair(aniNames[0][0], aniNames[0][1], function(){ animatePair(aniNames[1][0], aniNames[1][1], function(){ animatePair(aniNames[2][0], aniNames[2][1], null); }); }); } } else if(verifyTriangles === false || verifyAngles === false || verifySegments === false){ hintCategory = "good format but wrong"; } else{ hintCategory = "bad format"; } });$("#reason").change(function(){ $(".nextStatement input").keyup(); }); var storedHint = ""; var giveHint = function(){ if(hintsLeft > 0){ hintsLeft--; if(hintCategory === "bad format"){ hintsLeft++; var stepsLeft = hintsLeft + " hint" + (hintsLeft === 1 ? "" : "s") + " left";$(this).val("I'd like a hint (" + stepsLeft + " for this step)"); $(this).attr("disabled", false);$(".actualHints").append("<p> The things you've entered aren't segments, angles, or triangles in the figure. </p>"); } else{ var stepsLeft = hintsLeft + " hint" + (hintsLeft === 1 ? "" : "s") + " left"; $(this).val("I'd like a hint (" + stepsLeft + " for this step)");$(this).attr("disabled", false); if(!giveAway){ var nextHintSet = nextStatementHint(); $(".actualHints").append("<p>"+nextHintSet[0]+"</p>"); storedHint = nextHintSet[1]; } else{$(".actualHints").append("<p>"+storedHint+"</p>"); storedHint = ""; } _.each($(".actualHints code"), function(tag){$.tmpl.type.code()(tag); }); giveAway = !giveAway; } if(hintsLeft === 0){ $("#hint").attr("disabled", true); } } };$("#hint").click(giveHint);

outputKnownProof()

\cong because

When you enter the next statement in the proof, and a valid reason, that statement will be added to the proof. When you're done, hit check answer.
1
return isProofDone();
outputKnownProof();

Something went wrong with that request. Please try again.