Differential equations: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 6: Line 6:
<jsxgraph width="500" height="500">
<jsxgraph width="500" height="500">
var brd = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-11,11,11,-11]});
var brd = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-11,11,11,-11]});
var N = brd.create('point',[[-7,7],[7,7],[-15,10,15]], {name:'N'});
var P = brd.create('point',[0,1], {name:'(x_0,y_0)'});
var P = brd.create('point',[0,1], {name:'(x_0,y_0)'});


Line 15: Line 16:


function ode() {
function ode() {
   return JXG.Math.Numerics.rungeKutta(JXG.Math.Numerics.predefinedButcher.Heun, [P.Y()], [P.X(), P.X()+10], 200, f);
   return JXG.Math.Numerics.rungeKutta(JXG.Math.Numerics.predefinedButcher.Heun, [P.Y()], [P.X(), P.X()+N.Value()], 200, f);
}
}


Line 21: Line 22:
g.updateDataArray = function() {
g.updateDataArray = function() {
     var data = ode();
     var data = ode();
     var h = 0.05;
     var h = N.Value()/200;
     this.dataX = [];
     this.dataX = [];
     this.dataY = [];
     this.dataY = [];

Revision as of 14:17, 14 July 2010

f(t,x)=

The underlying JavaScript code