Polynomial curve of constant width: Difference between revisions
From JSXGraph Wiki
| A WASSERMANN (talk | contribs) No edit summary | A WASSERMANN (talk | contribs) mNo edit summary | ||
| Line 1: | Line 1: | ||
| The curve defined by | |||
| :<math> p(\phi) = a\cdot cos(k\cdot\phi/2)+b </math> | |||
| in polar form is smooth and of constant width for odd values of <math>k</math>. | |||
| <jsxgraph width="600" height="600"> | <jsxgraph width="600" height="600"> | ||
| var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-2,2,2,-2], keepaspectratio:true}); | var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-2,2,2,-2], keepaspectratio:true}); | ||
| Line 15: | Line 21: | ||
|                                var co = Math.cos(kk*phi*0.5); |                                var co = Math.cos(kk*phi*0.5); | ||
|                                return aa*co*co+bb; |                                return aa*co*co+bb; | ||
|                               },[0,0], 0,Math.PI*2], {curveType:'polar', strokeWidth:6, strokeColor:'# |                               },[0,0], 0,Math.PI*2], {curveType:'polar', strokeWidth:6, strokeColor:'#ad5544'}); | ||
| brd.unsuspendUpdate(); | brd.unsuspendUpdate(); | ||
| </jsxgraph> | </jsxgraph> | ||
| ===References=== | |||
| * [http://www.mathpropress.com/stan/bibliography/ Stanley Rabinowitz, A Polynomial Curve of Constant Width. Missouri Journal of Mathematical Sciences, 9(1997)23-27.] | |||
| ===The underlying JavaScript code=== | |||
| var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-2,2,2,-2], keepaspectratio:true}); | |||
| brd.suspendUpdate(); | |||
| var a = brd.create('slider',[[-1,1.8],[1,1.8],[-5,0.20,5]], {name:'a'}); | |||
| var b = brd.create('slider',[[-1,1.6],[1,1.6],[-5,1.15,10]], {name:'b'}); | |||
| var k = brd.create('slider',[[-1,1.4],[1,1.4],[1,1,11]], {name:'k\'', snapWidth:1}); | |||
| var p = brd.create('curve',[function(phi, suspendUpdate){  | |||
|                               var kk, aa, bb; | |||
|                               if (!suspendUpdate) { | |||
|                                 aa = a.Value(); | |||
|                                 bb = b.Value(); | |||
|                                 kk = 2*k.Value()+1; | |||
|                               } | |||
|                               var co = Math.cos(kk*phi*0.5); | |||
|                               return aa*co*co+bb; | |||
|                              },[0,0], 0,Math.PI*2], {curveType:'polar', strokeWidth:6, strokeColor:'#ad5544'}); | |||
| brd.unsuspendUpdate(); | |||
| [[Category:Examples]] | [[Category:Examples]] | ||
| [[Category:Curves]] | [[Category:Curves]] | ||
Revision as of 14:39, 6 October 2010
The curve defined by
- [math]\displaystyle{ p(\phi) = a\cdot cos(k\cdot\phi/2)+b }[/math]
in polar form is smooth and of constant width for odd values of [math]\displaystyle{ k }[/math].
References
The underlying JavaScript code
var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox:[-2,2,2,-2], keepaspectratio:true}); brd.suspendUpdate(); var a = brd.create('slider',[[-1,1.8],[1,1.8],[-5,0.20,5]], {name:'a'}); var b = brd.create('slider',[[-1,1.6],[1,1.6],[-5,1.15,10]], {name:'b'}); var k = brd.create('slider',[[-1,1.4],[1,1.4],[1,1,11]], {name:'k\, snapWidth:1});
var p = brd.create('curve',[function(phi, suspendUpdate){
                             var kk, aa, bb;
                             if (!suspendUpdate) {
                               aa = a.Value();
                               bb = b.Value();
                               kk = 2*k.Value()+1;
                             }
                             var co = Math.cos(kk*phi*0.5);
                             return aa*co*co+bb;
                            },[0,0], 0,Math.PI*2], {curveType:'polar', strokeWidth:6, strokeColor:'#ad5544'});
brd.unsuspendUpdate();
