Difference between revisions of "Riemann integrability"

From JSXGraph Wiki
Jump to navigationJump to search
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,4,3,-4],axis:true});
+
var brd = JXG.JSXGraph.initBoard('box', {boundingbox:[-3,5,3,-3],axis:true});
 
var p = [];
 
var p = [];
p.push(brd.create('point',[-2.7,(Math.random()-0.5)*5]));
+
p.push(brd.create('point',[-2.7,(Math.random()-0.2)*5]));
p.push(brd.create('point',[-1,(Math.random()-0.5)*5]));
+
p.push(brd.create('point',[-1,(Math.random()-0.2)*5]));
p.push(brd.create('point',[0,(Math.random()-0.5)*5]));
+
p.push(brd.create('point',[0,(Math.random()-0.2)*5]));
p.push(brd.create('point',[1,(Math.random()-0.5)*5]));
+
p.push(brd.create('point',[1,(Math.random()-0.2)*5]));
p.push(brd.create('point',[2.7,(Math.random()-0.5)*5]));
+
p.push(brd.create('point',[2.7,(Math.random()-0.2)*5]));
  
 
var f = brd.lagrangePolynomial(p);
 
var f = brd.lagrangePolynomial(p);
Line 12: Line 12:
 
var plot = brd.create('functiongraph',[f,-3,3]);
 
var plot = brd.create('functiongraph',[f,-3,3]);
 
   
 
   
var up = brd.createElement('riemannsum',[f,function(){ return n.Value();}, 'upper',-3,3],{fillColor:'#ff0000', fillOpacity:0.3});
+
var up = brd.create('riemannsum',[f,function(){ return n.Value();}, 'upper',-3,3],{fillColor:'#ff0000', fillOpacity:0.3});
var lo = brd.createElement('riemannsum',[f,function(){ return n.Value();}, 'lower',-3,3],{fillColor:'#ffff00', fillOpacity:0.3});
+
var lo = brd.create('riemannsum',[f,function(){ return n.Value();}, 'lower',-3,3],{fillColor:'#ffff00', fillOpacity:0.3});
 
   
 
   
/*
+
brd.createElement('text',[-2,-3,function(){ return 'Diff='+(brd.riemannsum(f,n.Value(),'upper',-3,3)-brd.riemannsum(f,n.Value(),'lower',-3,3)).toFixed(4); }]);
brd.createElement('text',[-6,-3,function(){ return 'Sum='+(brd.riemannsum(f,s.Value(),document.getElementById('sumtype').value,a.Value(),b.Value())).toFixed(4); }]);
 
brd.create('text',[3,-3,'`sum_(i=0)^n i^2`']);
 
*/
 
 
</jsxgraph>
 
</jsxgraph>
  
 
[[Category:Calculus]]
 
[[Category:Calculus]]
 
[[Category:Examples]]
 
[[Category:Examples]]

Revision as of 13:44, 11 May 2010