Riemann integrability: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 2: Line 2:
var brd = JXG.JSXGraph.initBoard('box', {boundingbox:[-3,4,3,-4],axis:true});
var brd = JXG.JSXGraph.initBoard('box', {boundingbox:[-3,4,3,-4],axis:true});
var p = [];
var p = [];
p.push(brd.create('point',[-2,(Math.random()-0.5)*5]));
p.push(brd.create('point',[-2.7,(Math.random()-0.5)*5]));
p.push(brd.create('point',[-1,(Math.random()-0.5)*5]));
p.push(brd.create('point',[-1,(Math.random()-0.5)*5]));
p.push(brd.create('point',[0,(Math.random()-0.5)*5]));
p.push(brd.create('point',[0,(Math.random()-0.5)*5]));
p.push(brd.create('point',[1,(Math.random()-0.5)*5]));
p.push(brd.create('point',[1,(Math.random()-0.5)*5]));
p.push(brd.create('point',[2,(Math.random()-0.5)*5]));
p.push(brd.create('point',[2.7,(Math.random()-0.5)*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 os = brd.createElement('riemannsum',[f,  
var up = brd.createElement('riemannsum',[f,function(){ return n.Value();}, 'upper',-3,3],{fillColor:'#ff0000', fillOpacity:0.3});
    function(){ return n.Value();}, 'upper',
var lo = brd.createElement('riemannsum',[f,function(){ return n.Value();}, 'lower',-3,3],{fillColor:'#ffff00', fillOpacity:0.3});
    -3,3],  
    {fillColor:'#ffff00', fillOpacity:0.3});
   
   
/*
/*

Revision as of 12:40, 11 May 2010