Difference between revisions of "Fermat's spiral"

From JSXGraph Wiki
Jump to navigationJump to search
 
Line 5: Line 5:
 
with a real number <math>a</math>.
 
with a real number <math>a</math>.
 
<jsxgraph width="500" height="500">
 
<jsxgraph width="500" height="500">
  var board = JXG.JSXGraph.initBoard('jxgbox', {originX: 250, originY: 250, unitX: 25, unitY: 25});
+
  var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-10, 10, 10, -10]});
 
  var a = board.create('slider', [[1,9],[5,9],[0,1,4]],{name:'a'});
 
  var a = board.create('slider', [[1,9],[5,9],[0,1,4]],{name:'a'});
 
  var c1 = board.create('curve', [function(phi){return a.Value()*Math.sqrt(phi); }, [0, 0],0, 8*Math.PI],
 
  var c1 = board.create('curve', [function(phi){return a.Value()*Math.sqrt(phi); }, [0, 0],0, 8*Math.PI],
Line 14: Line 14:
 
===The JavaScript code to produce this picture===
 
===The JavaScript code to produce this picture===
 
<source lang="javascript">
 
<source lang="javascript">
  var board = JXG.JSXGraph.initBoard('jxgbox', {originX: 250, originY: 250, unitX: 25, unitY: 25});
+
  var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-10, 10, 10, -10]});
 
  var a = board.create('slider', [[1,9],[5,9],[0,1,4]],{name:'a'});
 
  var a = board.create('slider', [[1,9],[5,9],[0,1,4]],{name:'a'});
 
  var c1 = board.create('curve', [function(phi){return a.Value()*Math.sqrt(phi); }, [0, 0],0, 8*Math.PI],
 
  var c1 = board.create('curve', [function(phi){return a.Value()*Math.sqrt(phi); }, [0, 0],0, 8*Math.PI],

Latest revision as of 15:11, 7 June 2011

It can be described in polar coordinates [math](r, \theta)[/math] by the equation

[math]r = \pm a\theta^{1/2}\,[/math]

with a real number [math]a[/math].

The JavaScript code to produce this picture

 var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-10, 10, 10, -10]});
 var a = board.create('slider', [[1,9],[5,9],[0,1,4]],{name:'a'});
 var c1 = board.create('curve', [function(phi){return a.Value()*Math.sqrt(phi); }, [0, 0],0, 8*Math.PI],
             {curveType:'polar', strokewidth:4});        
 var c2 = board.create('curve', [function(phi){return -a.Value()*Math.sqrt(phi); }, [0, 0],0, 8*Math.PI],
             {curveType:'polar', strokewidth:4});