Differential equations: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
<html>
<html>
<form>
<form>
f(t,x)=<input type="text" id="odeinput"><input type=button value="ok" onclick="doIt()">
f(t,x)=<input type="text" id="odeinput" value="3*x"><input type=button value="ok" onclick="doIt()">
</form>
</form>
</html>
</html>
Line 17: Line 17:
   var t = document.getElementById("odeinput").value;
   var t = document.getElementById("odeinput").value;
   f = new Function("t", "xx", "var x = xx[0]; var y = " + t + "; return [y]");
   f = new Function("t", "xx", "var x = xx[0]; var y = " + t + "; return [y]");
  brd.update();
}
}


function ode() {
function ode() {
   return JXG.Math.Numerics.rungeKutta(JXG.Math.Numerics.predefinedButcher.Heun, [P.Y()], [0, 10], 20, f);
   return JXG.Math.Numerics.rungeKutta(JXG.Math.Numerics.predefinedButcher.Heun, [P.Y()], [0, 10], 100, f);
}
}



Revision as of 09:39, 14 July 2010

f(t,x)=

The underlying JavaScript code