Difference between revisions of "Differential equations"

From JSXGraph Wiki
Jump to navigationJump to search
Line 1: Line 1:
 +
<html>
 +
<form>
 +
f(t,x)=<input type="text" id="odeinput"><input type=button value="ok" onclick="doIt()">
 +
</form>
 +
</html>
 
<jsxgraph width="500" height="500">
 
<jsxgraph width="500" height="500">
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-5,5,5,-5]});
 
var brd = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox:[-5,5,5,-5]});
 
var P = brd.create('point',[0,0], {name:'x_0'});
 
var P = brd.create('point',[0,0], {name:'x_0'});
var f = function(t,x) {
+
var f = function(t,xx) {
       return [3*x[0]];
+
       var x = xx[0];
 +
      y = 3*x;
 +
     
 +
      return [y];
 
     };
 
     };
 +
 +
function doIt() {
 +
  var t = document.getElementById(odeinput).value;
 +
  f = new Function("t", "xx", "var x = xx[0]; var y = " + t + "; return [y]");
 +
}
  
 
function ode() {
 
function ode() {

Revision as of 11:36, 14 July 2010

f(t,x)=

The underlying JavaScript code