Difference between revisions of "Antiderivative"

From JSXGraph Wiki
Jump to navigationJump to search
(New page: <jsxgraph width="800" height="400" box="box"> var brd = JXG.JSXGraph.initBoard('box', {boundingbox:[-3,5,3,-3],axis:true}); var p = []; p.push(brd.create('point',[-2,(Math.random()-0.2)*5]...)
 
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<jsxgraph width="800" height="400" box="box">
 
<jsxgraph width="800" height="400" box="box">
var brd = JXG.JSXGraph.initBoard('box', {boundingbox:[-3,5,3,-3],axis:true});
+
var brd = JXG.JSXGraph.initBoard('box', {boundingbox:[-3,10,3,-3],axis:true});
 
var p = [];
 
var p = [];
p.push(brd.create('point',[-2,(Math.random()-0.2)*5]));
+
p.push(brd.create('point',[-2,(Math.random()-0.2)*5],{name:''}));
p.push(brd.create('point',[0,(Math.random()-0.2)*5]));
+
p.push(brd.create('point',[0,(Math.random()-0.2)*5],{name:''}));
p.push(brd.create('point',[1,(Math.random()-0.2)*5]));
+
p.push(brd.create('point',[2.2,(Math.random()-0.2)*5],{name:''}));
p.push(brd.create('point',[2.2,(Math.random()-0.2)*5]));
 
  
var f = brd.lagrangePolynomial(p);
+
var f = JXG.Math.Numerics.lagrangePolynomial(p);
 
var plot = brd.create('functiongraph',[f,-3,3]);
 
var plot = brd.create('functiongraph',[f,-3,3]);
 
var s = brd.create('glider',[-2,0,plot],{name:'drag me'});
 
var s = brd.create('glider',[-2,0,plot],{name:'drag me'});
+
var int = brd.create('integral',[[function(){return p[0].X();},function(){return s.X();}],plot],{fillOpacity:0.2});
 +
 
 +
var F = brd.create('point',[function(){return s.X();}, function(){return JXG.Math.Numerics.I([p[0].X(),s.X()],f);}],
 +
                  {trace:true,name:'F',fillColor:'#0000aa',strokeColor:'#0000aa',face:'[]'});
 
</jsxgraph>
 
</jsxgraph>
  
 
===The underlying JavaScript code===
 
===The underlying JavaScript code===
 
<source lang="javascript">
 
<source lang="javascript">
 +
var brd = JXG.JSXGraph.initBoard('box', {boundingbox:[-3,10,3,-3],axis:true});
 +
var p = [];
 +
p.push(brd.create('point',[-2,(Math.random()-0.2)*5],{name:''}));
 +
p.push(brd.create('point',[0,(Math.random()-0.2)*5],{name:''}));
 +
p.push(brd.create('point',[2.2,(Math.random()-0.2)*5],{name:''}));
 +
 +
var f = JXG.Math.Numerics.lagrangePolynomial(p);
 +
var plot = brd.create('functiongraph',[f,-3,3]);
 +
var s = brd.create('glider',[-2,0,plot],{name:'drag me'});
 +
var int = brd.create('integral',[[function(){return p[0].X();},function(){return s.X();}],plot],{fillOpacity:0.2});
 +
 +
var F = brd.create('point',[function(){return s.X();}, function(){return JXG.Math.Numerics.I([p[0].X(),s.X()],f);}],
 +
                  {trace:true,name:'F',fillColor:'#0000aa',strokeColor:'#0000aa',face:'[]'});
 
</source>
 
</source>
  
 
[[Category:Calculus]]
 
[[Category:Calculus]]
 
[[Category:Examples]]
 
[[Category:Examples]]

Latest revision as of 16:39, 20 February 2013

The underlying JavaScript code

var brd = JXG.JSXGraph.initBoard('box', {boundingbox:[-3,10,3,-3],axis:true});
var p = [];
p.push(brd.create('point',[-2,(Math.random()-0.2)*5],{name:''}));
p.push(brd.create('point',[0,(Math.random()-0.2)*5],{name:''}));
p.push(brd.create('point',[2.2,(Math.random()-0.2)*5],{name:''}));

var f = JXG.Math.Numerics.lagrangePolynomial(p);
var plot = brd.create('functiongraph',[f,-3,3]);
var s = brd.create('glider',[-2,0,plot],{name:'drag me'});
var int = brd.create('integral',[[function(){return p[0].X();},function(){return s.X();}],plot],{fillOpacity:0.2});

var F = brd.create('point',[function(){return s.X();}, function(){return JXG.Math.Numerics.I([p[0].X(),s.X()],f);}],
                   {trace:true,name:'F',fillColor:'#0000aa',strokeColor:'#0000aa',face:'[]'});