Difference between revisions of "Harmonic Waves"

From JSXGraph Wiki
Jump to: navigation, search
(New page: <html> <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/pro...)
 
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<html>
+
<jsxgraph box="jxgbox1" width="600" height="500">
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />
+
     board1 = JXG.JSXGraph.initBoard('jxgbox1', {axis: true, boundingbox: [-6, 5, 6, -5]});
<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:600px; height:300px;"></div>
 
<script language="JavaScript">
 
     board1 = JXG.JSXGraph.initBoard('jxgbox', {originX: 300, originY: 200, unitX: 50, unitY: 50});
 
 
     board1.suspendUpdate();
 
     board1.suspendUpdate();
    board1.createElement('axis', [[0,0], [1,0]], {});
+
     var s = board1.create('slider', [[0.75,-2],[4.5,-2],[0,0,10]], {name:'S',snapWidth:1});
    board1.createElement('axis', [[0,0], [0,1]], {});
+
     board1.create('functiongraph', [
     var s = board1.createElement('slider', [0.75,-2.5,5,0,10,0], {name:'S'});
 
     board1.createElement('curve', [
 
        't',
 
 
         function(t) {
 
         function(t) {
             var val = 0;
+
             var val = 0, sv = s.Value()+1,
            var k = 1;
+
                k = 1;
            for(var i = 0; i < Math.floor(s.X()) + 1; i++) {
+
                for(var i = 0; i < sv; i++) {
                val = val + Math.sin(2*Math.PI*k*t)/k;
+
                    val = val + Math.sin(2*Math.PI*k*t)/k;
                k += 1;
+
                    k += 1;
            }
+
                }
            return val+2;
+
                return val+2;
             }, "t", -10, 10], {strokeColor: "#bb0000", curveType:'plot'});
+
             }, -10, 10], {strokeColor: "#bb0000"});
 
      
 
      
         board1.createElement('curve', [
+
         board1.create('functiongraph', [
            't',
 
 
             function(t) {
 
             function(t) {
                var val = 0;
+
            var val = 0, sv = s.Value()+1,
                 var k = 1;
+
                 k = 1;
                 for(var i = 0; i < Math.floor(s.X()) + 1; 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;
 
                 }
 
                 }
 
                 return val-2;
 
                 return val-2;
                 }, "t", -10, 10], {strokeColor: "#cc5520", curveType:'plot'});
+
                 }, -10, 10], {strokeColor: "#cc5520"});
  
 
     board1.unsuspendUpdate();         
 
     board1.unsuspendUpdate();         
</script>
+
</jsxgraph>
</html>
+
 
 +
<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.createElement('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>
  
 
[[Category:Examples]]
 
[[Category:Examples]]
 +
[[Category:Calculus]]

Latest revision as of 08:12, 8 June 2011

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.createElement('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();