Harmonic Waves: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
< | <jsxgraph box="jxgbox1" width="600" height="500"> | ||
board1 = JXG.JSXGraph.initBoard('jxgbox1', {axis: true, boundingbox: [-6, 5, 6, -5]}); | |||
board1 = JXG.JSXGraph.initBoard('jxgbox1', { | |||
board1.suspendUpdate(); | board1.suspendUpdate(); | ||
var s = board1.create('slider', [[0.75,-2],[4.5,-2],[0,0,10]], {name:'S',snapWidth:1}); | |||
board1.create('functiongraph', [ | |||
var s = board1. | |||
board1. | |||
function(t) { | function(t) { | ||
var val = 0 | var val = 0, sv = s.Value()+1, | ||
k = 1; | |||
for(var i = 0; i < sv; i++) { | |||
val = val + Math.sin(2*Math.PI*k*t)/k; | |||
k += 1; | |||
} | |||
return val+2; | |||
}, -10, 10], {strokeColor: "#bb0000"}); | }, -10, 10], {strokeColor: "#bb0000"}); | ||
board1. | board1.create('functiongraph', [ | ||
function(t) { | function(t) { | ||
var val = 0, sv = s.Value()+1, | |||
k = 1; | |||
for(var i = 0; i < | for(var i = 0; i < sv; i++) { | ||
val = val + Math.sin(2*Math.PI*(2*k-1)*t)/(2*k-1); | val = val + Math.sin(2*Math.PI*(2*k-1)*t)/(2*k-1); | ||
k += 1; | k += 1; | ||
Line 33: | Line 26: | ||
board1.unsuspendUpdate(); | board1.unsuspendUpdate(); | ||
</ | </jsxgraph> | ||
<source lang="javascript"> | <source lang="javascript"> | ||
board1 = JXG.JSXGraph.initBoard('jxgbox1', {axis: true, boundingbox: [-6, 5, 6, -5]}); | |||
board1.suspendUpdate(); | |||
var s = board1.create('slider', [[0.75,-2],[4.5,-2],[0,0,10]], {name:'S',snapWidth:1}); | |||
board1.create('functiongraph', [ | |||
function(t) { | |||
var val = 0, sv = s.Value()+1, | |||
k = 1; | |||
for(var i = 0; i < sv; i++) { | |||
val = val + Math.sin(2*Math.PI*k*t)/k; | |||
k += 1; | |||
} | |||
return val+2; | |||
}, -10, 10], {strokeColor: "#bb0000"}); | |||
board1.create('functiongraph', [ | |||
function(t) { | |||
var val = 0, sv = s.Value()+1, | |||
k = 1; | |||
for(var i = 0; i < sv; i++) { | |||
val = val + Math.sin(2*Math.PI*(2*k-1)*t)/(2*k-1); | |||
k += 1; | |||
} | |||
return val-2; | |||
}, -10, 10], {strokeColor: "#cc5520"}); | |||
board1.unsuspendUpdate(); | |||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Calculus]] | [[Category:Calculus]] |
Latest revision as of 17:31, 15 March 2020
board1 = JXG.JSXGraph.initBoard('jxgbox1', {axis: true, boundingbox: [-6, 5, 6, -5]});
board1.suspendUpdate();
var s = board1.create('slider', [[0.75,-2],[4.5,-2],[0,0,10]], {name:'S',snapWidth:1});
board1.create('functiongraph', [
function(t) {
var val = 0, sv = s.Value()+1,
k = 1;
for(var i = 0; i < sv; i++) {
val = val + Math.sin(2*Math.PI*k*t)/k;
k += 1;
}
return val+2;
}, -10, 10], {strokeColor: "#bb0000"});
board1.create('functiongraph', [
function(t) {
var val = 0, sv = s.Value()+1,
k = 1;
for(var i = 0; i < sv; i++) {
val = val + Math.sin(2*Math.PI*(2*k-1)*t)/(2*k-1);
k += 1;
}
return val-2;
}, -10, 10], {strokeColor: "#cc5520"});
board1.unsuspendUpdate();