Riemann sum II: Difference between revisions
From JSXGraph Wiki
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', {originX: 400, originY: 200 | var brd = JXG.JSXGraph.initBoard('box', {originX: 400, originY: 200, unitX: 50, unitY: 50}); | ||
brd. | brd.create('axis', [[0,0], [1,0]], {strokeColor:'black'}); | ||
brd. | brd.create('axis', [[0,0], [0,1]], {strokeColor:'black'}); | ||
var b = brd. | var b = brd.create('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 f = function(x){ return b.Value()*Math.sin(x); } | ||
var plot = brd. | var plot = brd.create('functiongraph',[f,-7,7], {strokeColor:'#32CD32', strokeWidth:'4px'}); | ||
var g = brd.D(f); | var g = brd.D(f); | ||
var plot2 = brd. | var plot2 = brd.create('functiongraph',[g,-7,7], {strokeColor:'#9370DB', strokeWidth:'2px'}); | ||
var os = brd. | var os = brd.create('riemannsum',[f, 35, 'middle', -7, 7], {fillColor:'#B22222', fillOpacity:0.3, strokeColor:'#8B1A1A', strokeWidth:'2px'}); | ||
var t1 = brd. | var t1 = brd.create('text',[-7,2,"(a*sin(x))'"],{strokeColor:'#9370DB'}); | ||
var t2 = brd. | var t2 = brd.create('text',[-7,-1.5,"a*sin(x)"],{strokeColor:'#32CD32'}); | ||
</jsxgraph> | </jsxgraph> | ||
Line 16: | Line 16: | ||
<source lang="xml"> | <source lang="xml"> | ||
<jsxgraph width="800" height="400" box="box"> | <jsxgraph width="800" height="400" box="box"> | ||
var brd = JXG.JSXGraph.initBoard('box', {originX: 400, originY: 200 | var brd = JXG.JSXGraph.initBoard('box', {originX: 400, originY: 200, unitX: 50, unitY: 50}); | ||
brd. | brd.create('axis', [[0,0], [1,0]], {strokeColor:'black'}); | ||
brd. | brd.create('axis', [[0,0], [0,1]], {strokeColor:'black'}); | ||
var b = brd. | var b = brd.create('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 f = function(x){ return b.Value()*Math.sin(x); } | ||
var plot = brd. | var plot = brd.create('functiongraph',[f,-7,7], {strokeColor:'#32CD32', strokeWidth:'4px'}); | ||
var g = brd.D(f); | var g = brd.D(f); | ||
var plot2 = brd. | var plot2 = brd.create('functiongraph',[g,-7,7], {strokeColor:'#9370DB', strokeWidth:'2px'}); | ||
var os = brd. | var os = brd.create('riemannsum',[f, 35, 'middle', -7, 7], {fillColor:'#B22222', fillOpacity:0.3, strokeColor:'#8B1A1A', strokeWidth:'2px'}); | ||
var t1 = brd. | var t1 = brd.create('text',[-7,2,"(a*sin(x))'"],{strokeColor:'#9370DB'}); | ||
var t2 = brd. | var t2 = brd.create('text',[-7,-1.5,"a*sin(x)"],{strokeColor:'#32CD32'}); | ||
</jsxgraph> | </jsxgraph> | ||
</source> | </source> |
Revision as of 11:02, 25 March 2011
The underlying JavaScript code
<jsxgraph width="800" height="400" box="box">
var brd = JXG.JSXGraph.initBoard('box', {originX: 400, originY: 200, unitX: 50, unitY: 50});
brd.create('axis', [[0,0], [1,0]], {strokeColor:'black'});
brd.create('axis', [[0,0], [0,1]], {strokeColor:'black'});
var b = brd.create('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.create('functiongraph',[f,-7,7], {strokeColor:'#32CD32', strokeWidth:'4px'});
var g = brd.D(f);
var plot2 = brd.create('functiongraph',[g,-7,7], {strokeColor:'#9370DB', strokeWidth:'2px'});
var os = brd.create('riemannsum',[f, 35, 'middle', -7, 7], {fillColor:'#B22222', fillOpacity:0.3, strokeColor:'#8B1A1A', strokeWidth:'2px'});
var t1 = brd.create('text',[-7,2,"(a*sin(x))'"],{strokeColor:'#9370DB'});
var t2 = brd.create('text',[-7,-1.5,"a*sin(x)"],{strokeColor:'#32CD32'});
</jsxgraph>