Rose: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 17: Line 17:


<jsxgraph width="500" height="500" box="box2">
<jsxgraph width="500" height="500" box="box2">
  var b2 = JXG.JSXGraph.initBoard('box2', {axis:true,originX: 250, originY: 250, unitX: 25, unitY: 25});
  var b2 = JXG.JSXGraph.initBoard('box2', {axis:true,boundingbox: [-10, 10, 10, -10]});
  var f = b2.createElement('slider', [[1,8],[6,8],[0,4,8]]);
  var f = b2.create('slider', [[1,8],[6,8],[0,4,8]]);
  var len = b2.createElement('slider', [[1,7],[6,7],[0,2,8]],{name:'len'});  
  var len = b2.create('slider', [[1,7],[6,7],[0,2,8]],{snapWidth:1,name:'len'});  
  var k = b2.createElement('slider', [[1,6],[6,6],[0,2,10]],{snapWidth:0.2,name:'k'});
  var k = b2.create('slider', [[1,6],[6,6],[0,2,12]],{snapWidth:0.2,name:'k'});
  var c = b2.createElement('curve', [function(phi){return f.Value()*Math.cos(k.Value()*phi); }, [0, 0],0, function(){return len.Value()*Math.PI;}],
  var c = b2.create('curve', [function(phi){return f.Value()*Math.cos(k.Value()*phi); }, [0, 0],0, function(){return len.Value()*Math.PI;}],
             {curveType:'polar', strokewidth:2});       
             {curveType:'polar', strokewidth:2});       
</jsxgraph>
</jsxgraph>
Line 27: Line 27:
===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="box2">
  var b2 = JXG.JSXGraph.initBoard('box2', {axis:true,boundingbox: [-10, 10, 10, -10]});
  var b2 = JXG.JSXGraph.initBoard('box2', {axis:true,originX: 250, originY: 250, unitX: 25, unitY: 25});
  var f = b2.create('slider', [[1,8],[6,8],[0,4,8]]);
  var f = b2.createElement('slider', [[1,8],[5,8],[0,4,8]]);
  var len = b2.create('slider', [[1,7],[6,7],[0,2,8]],{snapWidth:1,name:'len'});  
  var len = b2.createElement('slider', [[1,7],[5,7],[0,2,2]],{name:'len'});  
  var k = b2.create('slider', [[1,6],[6,6],[0,2,12]],{snapWidth:0.2,name:'k'});
  var k = b2.createElement('slider', [[1,6],[5,6],[0,2,10]],{snapWidth:0.2,name:'k'});
  var c = b2.create('curve', [function(phi){return f.Value()*Math.cos(k.Value()*phi); }, [0, 0],0, function(){return len.Value()*Math.PI;}],
  var c = b2.createElement('curve', [function(phi){return f.Value()*Math.cos(k.Value()*phi); }, [0, 0],0, function(){return len.Value()*Math.PI;}],
             {curveType:'polar', strokewidth:2});       
             {curveType:'polar', strokewidth:2});       
</jsxgraph>
</source>
</source>



Latest revision as of 12:39, 8 June 2011

A rose or rhodonea curve is a sinusoid plotted in polar coordinates. Up to similarity, these curves can all be expressed by a polar equation of the form

[math]\displaystyle{ \!\,r=\cos(k\theta). }[/math]

If k is an integer, the curve will be rose shaped with

  • 2k petals if k is even, and
  • k petals if k is odd.

When k is even, the entire graph of the rose will be traced out exactly once when the value of θ changes from 0 to 2π. When k is odd, this will happen on the interval between 0 and π. (More generally, this will happen on any interval of length [math]\displaystyle{ 2\pi }[/math] for [math]\displaystyle{ k }[/math] even, and [math]\displaystyle{ \pi }[/math] for [math]\displaystyle{ k }[/math] odd.)

The quadrifolium is a type of rose curve with n=2. It has polar equation:

[math]\displaystyle{ r = \cos(2\theta), \, }[/math]

with corresponding algebraic equation

[math]\displaystyle{ (x^2+y^2)^3 = (x^2-y^2)^2. \, }[/math]

The JavaScript code to produce this picture

 var b2 = JXG.JSXGraph.initBoard('box2', {axis:true,boundingbox: [-10, 10, 10, -10]});
 var f = b2.create('slider', [[1,8],[6,8],[0,4,8]]);
 var len = b2.create('slider', [[1,7],[6,7],[0,2,8]],{snapWidth:1,name:'len'}); 
 var k = b2.create('slider', [[1,6],[6,6],[0,2,12]],{snapWidth:0.2,name:'k'});
 var c = b2.create('curve', [function(phi){return f.Value()*Math.cos(k.Value()*phi); }, [0, 0],0, function(){return len.Value()*Math.PI;}],
             {curveType:'polar', strokewidth:2});

External links