Riemann integrability: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
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, | 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. | p.push(brd.create('point',[-2.7,(Math.random()-0.2)*5])); | ||
p.push(brd.create('point',[-1,(Math.random()-0. | p.push(brd.create('point',[-1,(Math.random()-0.2)*5])); | ||
p.push(brd.create('point',[0,(Math.random()-0. | p.push(brd.create('point',[0,(Math.random()-0.2)*5])); | ||
p.push(brd.create('point',[1,(Math.random()-0. | p.push(brd.create('point',[1,(Math.random()-0.2)*5])); | ||
p.push(brd.create('point',[2.7,(Math.random()-0. | 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. | var up = brd.create('riemannsum',[f,function(){ return n.Value();}, 'upper',-3,3],{fillColor:'#ff0000', fillOpacity:0.3}); | ||
var lo = brd. | 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',[- | |||
</jsxgraph> | </jsxgraph> | ||
[[Category:Calculus]] | [[Category:Calculus]] | ||
[[Category:Examples]] | [[Category:Examples]] |