graphInit({range:11,scale:20,axisArrows:"<->",tickStep:1,labelStep:1,gridOpacity:.05,axisOpacity:.2,tickOpacity:.4,labelOpacity:.5}),label([0,11],"y","above"),label([11,0],"x","right"),addMouseLayer(),graph.pointA=addMovablePoint({coord:[5,5],snapX:.5,snapY:.5,normalStyle:{stroke:KhanUtil.BLUE,fill:KhanUtil.BLUE}}),graph.pointB=addMovablePoint({coord:[-5,5],snapX:.5,snapY:.5,normalStyle:{stroke:KhanUtil.BLUE,fill:KhanUtil.BLUE}}),graph.pointC=addMovablePoint({coord:[0,5],snapX:.5,snapY:.5,normalStyle:{stroke:KhanUtil.BLUE,fill:KhanUtil.BLUE}}),graph.invalid=function(r,a,e){return(r[0]-a[0])*(r[0]-e[0])*(a[0]-e[0])===0},graph.fitParabola=function(r,a,e){var n=(r[0]-a[0])*(r[0]-e[0])*(a[0]-e[0]);if(0!==n){var t=(e[0]*(a[1]-r[1])+a[0]*(r[1]-e[1])+r[0]*(e[1]-a[1]))/n,i=(e[0]*e[0]*(r[1]-a[1])+a[0]*a[0]*(e[1]-r[1])+r[0]*r[0]*(a[1]-e[1]))/n,o=(a[0]*e[0]*(a[0]-e[0])*r[1]+e[0]*r[0]*(e[0]-r[0])*a[1]+r[0]*a[0]*(r[0]-a[0])*e[1])/n;return[t,i,o]}return[0,0,0]},graph.pointA.onMove=function(r,a){return graph.invalid([r,a],graph.pointB.coord,graph.pointC.coord)?!1:(graph.pointA.coord=[r,a],graph.drawParabola(),void 0)},graph.pointB.onMove=function(r,a){return graph.invalid(graph.pointA.coord,[r,a],graph.pointC.coord)?!1:(graph.pointB.coord=[r,a],graph.drawParabola(),void 0)},graph.pointC.onMove=function(r,a){return graph.invalid(graph.pointA.coord,graph.pointB.coord,[r,a])?!1:(graph.pointC.coord=[r,a],graph.drawParabola(),void 0)},graph.parabola=bogusShape,graph.drawParabola=function(){graph.parabola.remove();var r=graph.fitParabola(graph.pointA.coord,graph.pointB.coord,graph.pointC.coord);style({stroke:KhanUtil.BLUE},function(){graph.parabola=plot(function(a){return r[0]*a*a+r[1]*a+r[2]},[-11,11]),graph.parabola.toBack()})},graph.drawParabola(),graph.showSolution=function(){$("html, body").animate({scrollTop:$(".question").offset().top},{duration:500,easing:"swing",complete:function(){var r={x1:graph.pointA.coord[0],y1:graph.pointA.coord[1],x2:graph.pointB.coord[0],y2:graph.pointB.coord[1],x3:graph.pointC.coord[0],y3:graph.pointC.coord[1]};$(r).delay(100).animate({x1:X1,y1:Y1,x2:X2,y2:Y2,x3:H,y3:K},{duration:500,easing:"linear",step:function(a,e){r[e.prop]=a,graph.pointA.setCoord([r.x1,r.y1]),graph.pointB.setCoord([r.x2,r.y2]),graph.pointC.setCoord([r.x3,r.y3]),graph.drawParabola()}})}})}
Arrastra los tres puntos para graficar la ecuación.
[ graph.pointA.coord, graph.pointB.coord, graph.pointC.coord ]
var r=graph.fitParabola(graph.pointA.coord,graph.pointB.coord,graph.pointC.coord);return 0===r[0]&&0===r[1]&&5===r[2]?"":abs(A-r[0])<.001&&abs(-2*A*H-r[1])<.001&&abs(A*H*H+K-r[2])<.001
graph.pointA.setCoord(guess[0]),graph.pointB.setCoord(guess[1]),graph.pointC.setCoord(guess[2]),graph.drawParabola()