Riemann sum II: Difference between revisions

From JSXGraph Wiki
(New page: <html> <form>Riemann sum type: <select id="sumtype"> <option value='left' selected> left <option value='right'> right <option value='middle'> middle <option value='trapezodial'> trapezodia...)
 
No edit summary
Line 1: Line 1:
<html>
<html>
<form>Riemann sum type: <select id="sumtype">
<option value='left' selected> left
<option value='right'> right
<option value='middle'> middle
<option value='trapezodial'> trapezodial
<option value='lower'> lower
<option value='upper'> upper
</select></form>
</html>
<jsxgraph width="800" height="400" box="box">
<jsxgraph width="800" height="400" box="box">
var brd = JXG.JSXGraph.initBoard('jxgbox', {originX: 400, originY: 200, grid:true, unitX: 50, unitY: 50});
var brd = JXG.JSXGraph.initBoard('jxgbox', {originX: 400, originY: 200, grid:true, unitX: 50, unitY: 50});
Line 40: Line 31:
</source>
</source>


</html>
[[Category:Examples]]
[[Category:Examples]]
[[Category:Calculus]]
[[Category:Calculus]]

Revision as of 17:59, 30 August 2009

var brd = JXG.JSXGraph.initBoard('jxgbox', {originX: 400, originY: 200, grid:true, unitX: 50, unitY: 50}); brd.createElement('axis', [[0,0], [1,0]], {strokeColor:'black'}); brd.createElement('axis', [[0,0], [0,1]], {strokeColor:'black'}); var b = brd.createElement('slider',[[1,3.5],[5,3.5],[0,1,3]],{name:'a', strokeColor:'black', fillColor:'white'}); var f = function(x){ return b.Value()*Math.sin(x); } var plot = brd.createElement('functiongraph',[f,-7,7], {strokeColor:'#32CD32', strokeWidth:'4px'}); var g = brd.D(f); var plot2 = brd.createElement('functiongraph',[g,-7,7], {strokeColor:'#9370DB', strokeWidth:'2px'}); var os = brd.createElement('riemannsum',[f, 35, 'middle', -7, 7], {fillColor:'#B22222', fillOpacity:0.3, strokeColor:'#8B1A1A', strokeWidth:'2px'}); var t1 = brd.createElement('text',[-7,2,"(a*sin(x))'"],{strokeColor:'#9370DB'}); var t2 = brd.createElement('text',[-7,-1.5,"a*sin(x)"],{strokeColor:'#32CD32'}); ===The underlying JavaScript code=== var brd = JXG.JSXGraph.initBoard('jxgbox', {originX: 400, originY: 200, grid:true, unitX: 50, unitY: 50}); brd.createElement('axis', [[0,0], [1,0]], {strokeColor:'black'}); brd.createElement('axis', [[0,0], [0,1]], {strokeColor:'black'}); var b = brd.createElement('slider',[[1,3.5],[5,3.5],[0,1,3]],{name:'a', strokeColor:'black', fillColor:'white'}); var f = function(x){ return b.Value()*Math.sin(x); } var plot = brd.createElement('functiongraph',[f,-7,7], {strokeColor:'#32CD32', strokeWidth:'4px'}); var g = brd.D(f); var plot2 = brd.createElement('functiongraph',[g,-7,7], {strokeColor:'#9370DB', strokeWidth:'2px'}); var os = brd.createElement('riemannsum',[f, 35, 'middle', -7, 7], {fillColor:'#B22222', fillOpacity:0.3, strokeColor:'#8B1A1A', strokeWidth:'2px'}); var t1 = brd.createElement('text',[-7,2,"(a*sin(x))'"],{strokeColor:'#9370DB'}); var t2 = brd.createElement('text',[-7,-1.5,"a*sin(x)"],{strokeColor:'#32CD32'});