Difference between revisions of "Conic sections in polar form"

From JSXGraph Wiki
Jump to: navigation, search
Line 22: Line 22:
 
</html>
 
</html>
  
 +
===The JavaScript code to produce this picture===
 +
<source lang="xml">
 +
<jsxgraph board="brd" width="600" height="500">
 +
var brd = JXG.JSXGraph.initBoard('jxgbox',{axis:true,originX:300,originY:250,unitX:25,unitY:25});
 +
var p = brd.createElement('slider',[[2,8],[6,8],[0,3,6]]); brd.createElement('text',[1,8,'p:']);
 +
var eps = brd.createElement('slider',[[2,7],[6,7],[0,0.5,6]]); brd.createElement('text',[1,7,'&epsilon;:']);
 +
var len = brd.createElement('slider',[[2,6],[6,6],[0,3,6]]); brd.createElement('text',[1,6,'len:']);
 +
var rho = brd.createElement('slider', [[2,5],[6,5],[0,0,2*Math.PI]]); brd.createElement('text',[1,5,'&rho;:']);
 +
var f = brd.createElement('curve',
 +
  [function(phi) { return p.Value()/(1-eps.Value()*Math.cos(phi+rho.Value())); }, [1,0], 0,function(){return len.Value()*Math.PI}],     
 +
  {curveType:'polar', strokewidth:2, strokeColor:'#CA7291'}
 +
  );       
 +
var q = brd.createElement('glider', [f], {style:6,name:'G'});
 +
brd.createElement('tangent', [q], {dash:3});
 +
brd.addHook(function(){$('ausgabe').innerHTML = (p.Value()).toFixed(1) + "/(1 - (" + (eps.Value()).toFixed(1) + ")*cos(&phi;+"+(rho.Value()).toFixed(1) +"))";});
 +
</jsxgraph>
 +
</source>
 
[[Category:Examples]]
 
[[Category:Examples]]
 
[[Category:Curves]]
 
[[Category:Curves]]

Revision as of 18:31, 10 March 2009

The equation of the curve is

[math]\, r = \frac{p}{1-\epsilon\cdot cos(\phi+\rho)};[/math]


The JavaScript code to produce this picture

<jsxgraph board="brd" width="600" height="500">
var brd = JXG.JSXGraph.initBoard('jxgbox',{axis:true,originX:300,originY:250,unitX:25,unitY:25});
var p = brd.createElement('slider',[[2,8],[6,8],[0,3,6]]); brd.createElement('text',[1,8,'p:']);
var eps = brd.createElement('slider',[[2,7],[6,7],[0,0.5,6]]); brd.createElement('text',[1,7,'&epsilon;:']);
var len = brd.createElement('slider',[[2,6],[6,6],[0,3,6]]); brd.createElement('text',[1,6,'len:']);
var rho = brd.createElement('slider', [[2,5],[6,5],[0,0,2*Math.PI]]); brd.createElement('text',[1,5,'&rho;:']);
var f = brd.createElement('curve', 
   [function(phi) { return p.Value()/(1-eps.Value()*Math.cos(phi+rho.Value())); }, [1,0], 0,function(){return len.Value()*Math.PI}],      
   {curveType:'polar', strokewidth:2, strokeColor:'#CA7291'}
  );        
var q = brd.createElement('glider', [f], {style:6,name:'G'}); 
brd.createElement('tangent', [q], {dash:3}); 
brd.addHook(function(){$('ausgabe').innerHTML = (p.Value()).toFixed(1) + "/(1 - (" + (eps.Value()).toFixed(1) + ")*cos(&phi;+"+(rho.Value()).toFixed(1) +"))";});
</jsxgraph>