Power Series for sine and cosine

From JSXGraph Wiki
Revision as of 12:28, 17 September 2008 by 132.180.198.9 (talk)

Jump to: navigation, search

Power Series for Cosine

<script language="JavaScript"> // Board board2 = JXG.JSXGraph.initBoard('jxgbox2', {originX: 300, originY: 150, unitX: 50, unitY: 50}); board2.suspendUpdate(); // Axes and Properties board2.createElement('axis', [[1,0], [0,0]], {}); board2.createElement('axis', [[0,1], [0,0]], {}); // board2.createElement('curve', [function(t){ return t; }, function(t){ return Math.cos(t); }, "t", -10, 10],{strokeColor: "#cccccc"}); // var s2 = board2.createElement('slider', [0.75,-2.5,5,0,10,0], {name:'T'}); // board2.createElement('curve', [ function(t){ return t; }, function(t) { var val = 0; for(var i = 0; i < Math.floor(s2.X()) + 1; i++) { var f = 1; var n = 1; while (n <= 2 * i) { f = f * n++; }

  			val = val + Math.pow(-1, i) * Math.pow(t, 2 * i) / f;

} return val; }, "t", -10, 10],{strokeColor: "#009900"}); board2.unsuspendUpdate(); </script> </html>