Difference between revisions of "Lituus"

From JSXGraph Wiki
Jump to navigationJump to search
 
(5 intermediate revisions by one other user not shown)
Line 4: Line 4:
  
 
<jsxgraph width="500" height="500" box="box1">
 
<jsxgraph width="500" height="500" box="box1">
  var b1 = JXG.JSXGraph.initBoard('box1', {axis:true,originX: 250, originY: 250, unitX: 25, unitY: 25});
+
  var b1 = JXG.JSXGraph.initBoard('box1', {axis:true,boundingbox: [-10, 10, 10, -10]});
  var k = b1.createElement('slider', [[1,8],[5,8],[0,1,4]]);
+
  var k = b1.create('slider', [[1,8],[5,8],[0,1,4]]);
  var c = b1.createElement('curve', [function(phi){return Math.sqrt(k.Value()/phi); }, [0, 0],0, 8*Math.PI],
+
  var c = b1.create('curve', [function(phi){return Math.sqrt(k.Value()/phi); }, [0, 0],0, 8*Math.PI],
             {curveType:'polar', strokewidth:4});       
+
             {curveType:'polar', strokewidth:1});       
 
</jsxgraph>
 
</jsxgraph>
  
 
===The JavaScript code to produce this picture===
 
===The JavaScript code to produce this picture===
  
<source lang="xml">
+
<source lang="javascript">
<jsxgraph width="500" height="500" box="box1">
+
var b1 = JXG.JSXGraph.initBoard('box1', {axis:true,boundingbox: [-10, 10, 10, -10]});
var b1 = JXG.JSXGraph.initBoard('box1', {axis:true,originX: 250, originY: 250, unitX: 25, unitY: 25});
+
var k = b1.create('slider', [[1,8],[5,8],[0,1,4]]);
var k = b1.createElement('slider', [[1,8],[5,8],[0,1,4]]);
+
var c = b1.create('curve', [function(phi){return Math.sqrt(k.Value()/phi); }, [0, 0],0, 8*Math.PI],
var c = b1.createElement('curve', [function(phi){return Math.sqrt(k.Value()/phi); }, [0, 0],0, 8*Math.PI],
+
             {curveType:'polar', strokewidth:1});       
             {curveType:'polar', strokewidth:4});       
 
</jsxgraph>
 
 
</source>
 
</source>
===Other curves===
 
The '''quadrifolium''' is a type of rose curve with n=2. It has polar equation:
 
 
:<math>    r = \cos(2\theta), \,</math>
 
 
with corresponding algebraic equation
 
 
:<math>    (x^2+y^2)^3 = (x^2-y^2)^2. \, </math>
 
 
<jsxgraph width="500" height="500" box="box2">
 
var b2 = JXG.JSXGraph.initBoard('box2', {axis:true,originX: 250, originY: 250, unitX: 25, unitY: 25});
 
var f = b2.createElement('slider', [[1,8],[5,8],[0,4,8]]);
 
var len = b2.createElement('slider', [[1,7],[5,7],[0,2,2]]);
 
var k = b2.createElement('slider', [[1,6],[5,6],[0,2,10]]);
 
var c = b2.createElement('curve', [function(phi){return f.Value()*Math.cos(Math.floor(k.Value())*phi); }, [0, 0],0, function(){return len.Value()*Math.PI;}],
 
            {curveType:'polar', strokewidth:2});     
 
</jsxgraph>
 
 
  
 
===External links===
 
===External links===

Latest revision as of 10:35, 8 June 2011

A lituus is a spiral in which the angle is inversely proportional to the square of the radius (as expressed in polar coordinates).

[math]r^2\theta = k \,[/math]

The JavaScript code to produce this picture

var b1 = JXG.JSXGraph.initBoard('box1', {axis:true,boundingbox: [-10, 10, 10, -10]});
var k = b1.create('slider', [[1,8],[5,8],[0,1,4]]);
var c = b1.create('curve', [function(phi){return Math.sqrt(k.Value()/phi); }, [0, 0],0, 8*Math.PI],
             {curveType:'polar', strokewidth:1});

External links