Difference between revisions of "Power Series for sine and cosine"
From JSXGraph Wiki
Jump to navigationJump to searchA WASSERMANN (talk | contribs) |
A WASSERMANN (talk | contribs) |
||
Line 1: | Line 1: | ||
== Power Series for Sine == | == Power Series for Sine == | ||
− | + | :<math>\sum_{k=0}^n (-1)^k\frac{1}{(2k+1)!}x^{2k+1}</math> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
<html> | <html> | ||
Line 48: | Line 27: | ||
</script> | </script> | ||
</html> | </html> | ||
+ | <source lang="html4strict"> | ||
+ | <link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" /> | ||
+ | <script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/prototype.js"></script> | ||
+ | <script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script> | ||
+ | <div id="jxgbox1" class="jxgbox" style="width:700px; height:600px;"></div> | ||
+ | </source> | ||
− | |||
<source lang="javascript"> | <source lang="javascript"> | ||
− | + | board1 = JXG.JSXGraph.initBoard('jxgbox1', {axis:true, originX: 300, originY: 150, unitX: 50, unitY: 50}); | |
− | + | board1.suspendUpdate(); | |
− | + | board1.createElement('functiongraph', [function(t){ return Math.sin(t); },-10, 10],{strokeColor: "#cccccc"}); | |
− | var | + | var s = board1.createElement('slider', [[0.75,-1.5],[5.75,-1.5],[0,0,10]], {name:'S',snapWidth:1}); |
− | + | board1.createElement('functiongraph', [ | |
function(t) { | function(t) { | ||
var val = 0; | var val = 0; | ||
− | for(var i = 0; i < | + | for(var i = 0; i < s.Value()+1; i++) { |
− | val = val + Math.pow(-1, i) * Math.pow(t, 2 * i) / | + | val = val + Math.pow(-1, i) * Math.pow(t, 2 * i + 1) / board1.factorial(2*i+1); |
} | } | ||
return val; | return val; | ||
− | }, -10, 10],{strokeColor: "# | + | }, -10, 10], {strokeColor: "#bb0000"}); |
− | + | board1.unsuspendUpdate(); | |
</source> | </source> | ||
+ | |||
+ | |||
+ | == Power Series for Cosine == | ||
<html> | <html> | ||
<div id="jxgbox2" class="jxgbox" style="width:700px; height:300px;"></div> | <div id="jxgbox2" class="jxgbox" style="width:700px; height:300px;"></div> | ||
Line 85: | Line 72: | ||
</script> | </script> | ||
</html> | </html> | ||
+ | |||
+ | <source lang="javascript"> | ||
+ | board2 = JXG.JSXGraph.initBoard('jxgbox2', {axis:true, originX: 300, originY: 150, unitX: 50, unitY: 50}); | ||
+ | board2.suspendUpdate(); | ||
+ | board2.createElement('functiongraph', [function(t){ return Math.cos(t); }, -10, 10],{strokeColor: "#cccccc"}); | ||
+ | var s2 = board2.createElement('slider', [[0.75,-1.5],[5.75,-1.5],[0,0,10]], {name:'T',snapWidth:1}); | ||
+ | board2.createElement('functiongraph', [ | ||
+ | function(t) { | ||
+ | var val = 0; | ||
+ | for(var i = 0; i < Math.floor(s2.Value()) + 1; i++) { | ||
+ | val = val + Math.pow(-1, i) * Math.pow(t, 2 * i) / board2.factorial(2*i); | ||
+ | } | ||
+ | return val; | ||
+ | }, -10, 10],{strokeColor: "#009900"}); | ||
+ | board2.unsuspendUpdate(); | ||
+ | </source> | ||
=== References === | === References === |
Revision as of 15:45, 9 July 2009
Power Series for Sine
- [math]\sum_{k=0}^n (-1)^k\frac{1}{(2k+1)!}x^{2k+1}[/math]
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/prototype.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<div id="jxgbox1" class="jxgbox" style="width:700px; height:600px;"></div>
board1 = JXG.JSXGraph.initBoard('jxgbox1', {axis:true, originX: 300, originY: 150, unitX: 50, unitY: 50});
board1.suspendUpdate();
board1.createElement('functiongraph', [function(t){ return Math.sin(t); },-10, 10],{strokeColor: "#cccccc"});
var s = board1.createElement('slider', [[0.75,-1.5],[5.75,-1.5],[0,0,10]], {name:'S',snapWidth:1});
board1.createElement('functiongraph', [
function(t) {
var val = 0;
for(var i = 0; i < s.Value()+1; i++) {
val = val + Math.pow(-1, i) * Math.pow(t, 2 * i + 1) / board1.factorial(2*i+1);
}
return val;
}, -10, 10], {strokeColor: "#bb0000"});
board1.unsuspendUpdate();
Power Series for Cosine
board2 = JXG.JSXGraph.initBoard('jxgbox2', {axis:true, originX: 300, originY: 150, unitX: 50, unitY: 50});
board2.suspendUpdate();
board2.createElement('functiongraph', [function(t){ return Math.cos(t); }, -10, 10],{strokeColor: "#cccccc"});
var s2 = board2.createElement('slider', [[0.75,-1.5],[5.75,-1.5],[0,0,10]], {name:'T',snapWidth:1});
board2.createElement('functiongraph', [
function(t) {
var val = 0;
for(var i = 0; i < Math.floor(s2.Value()) + 1; i++) {
val = val + Math.pow(-1, i) * Math.pow(t, 2 * i) / board2.factorial(2*i);
}
return val;
}, -10, 10],{strokeColor: "#009900"});
board2.unsuspendUpdate();