Conic sections in polar form: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary  | 
				No edit summary  | 
				||
| (11 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
The equation of the curve is  | The equation of the curve is  | ||
:<math>\, r =  \frac{p}{1-\epsilon\cdot cos(\phi+\rho)};</math>  | :<math>\, r =  \frac{p}{1-\epsilon\cdot cos(\phi+\rho)};</math>  | ||
<html>  | |||
<p id="ausgabe">   | |||
</p>  | |||
</html>  | |||
<jsxgraph board="brd" width="600" height="500">  | <jsxgraph board="brd" width="600" height="500">  | ||
var brd = JXG.JSXGraph.initBoard('jxgbox',{axis:true,  | var brd = JXG.JSXGraph.initBoard('jxgbox',{axis:true,boundingbox: [-12, 10, 12, -10]});  | ||
var p = brd.  | var p = brd.create('slider',[[2,8],[6,8],[0,3,6]]); brd.createElement('text',[1,8,'p:']);  | ||
var eps = brd.  | var eps = brd.create('slider',[[2,7],[6,7],[-6,0.5,6]]); brd.createElement('text',[1,7,'ε:']);  | ||
var len = brd.  | var len = brd.create('slider',[[2,6],[6,6],[0,2,6]]); brd.createElement('text',[1,6,'len:']);  | ||
var rho = brd.  | var rho = brd.create('slider', [[2,5],[6,5],[0,0,2*Math.PI]]); brd.createElement('text',[1,5,'ρ:']);  | ||
var f = brd.  | var f = brd.create('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.create('glider', [f], {style:6,name:'G'});   | |||
brd.create('tangent', [q], {dash:3});   | |||
brd.addHook(function(){document.getElementById('ausgabe').innerHTML = (p.Value()).toFixed(1) + "/(1 - (" + (eps.Value()).toFixed(1) + ")*cos(φ+"+(rho.Value()).toFixed(1) +"))";});  | |||
</jsxgraph>  | |||
===The JavaScript code to produce this picture===  | |||
<source lang="javascript">  | |||
var brd = JXG.JSXGraph.initBoard('jxgbox',{axis:true,boundingbox: [-12, 10, 12, -10]});  | |||
var p = brd.create('slider',[[2,8],[6,8],[0,3,6]]); brd.createElement('text',[1,8,'p:']);  | |||
var eps = brd.create('slider',[[2,7],[6,7],[-6,0.5,6]]); brd.createElement('text',[1,7,'ε:']);  | |||
var len = brd.create('slider',[[2,6],[6,6],[0,3,6]]); brd.createElement('text',[1,6,'len:']);  | |||
var rho = brd.create('slider', [[2,5],[6,5],[0,0,2*Math.PI]]); brd.createElement('text',[1,5,'ρ:']);  | |||
var f = brd.create('curve',    | |||
    [function(phi) { return p.Value()/(1-eps.Value()*Math.cos(phi+rho.Value())); }, [1,0], 0,function(){return len.Value()*Math.PI}],         |     [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'}  |     {curveType:'polar', strokewidth:2, strokeColor:'#CA7291'}  | ||
| Line 13: | Line 35: | ||
var q = brd.createElement('glider', [f], {style:6,name:'G'});    | var q = brd.createElement('glider', [f], {style:6,name:'G'});    | ||
brd.createElement('tangent', [q], {dash:3});    | brd.createElement('tangent', [q], {dash:3});    | ||
brd.addHook(function(){  | brd.addHook(function(){document.getElementById('ausgabe').innerHTML = (p.Value()).toFixed(1) + "/(1 - (" + (eps.Value()).toFixed(1) + ")*cos(φ+"+(rho.Value()).toFixed(1) +"))";});  | ||
</  | </source>  | ||
[[Category:Examples]]  | [[Category:Examples]]  | ||
[[Category:Curves]]  | [[Category:Curves]]  | ||
Revision as of 12:56, 7 June 2011
The equation of the curve is
- [math]\displaystyle{ \, r = \frac{p}{1-\epsilon\cdot cos(\phi+\rho)}; }[/math]
 
The JavaScript code to produce this picture
var brd = JXG.JSXGraph.initBoard('jxgbox',{axis:true,boundingbox: [-12, 10, 12, -10]});
var p = brd.create('slider',[[2,8],[6,8],[0,3,6]]); brd.createElement('text',[1,8,'p:']);
var eps = brd.create('slider',[[2,7],[6,7],[-6,0.5,6]]); brd.createElement('text',[1,7,'ε:']);
var len = brd.create('slider',[[2,6],[6,6],[0,3,6]]); brd.createElement('text',[1,6,'len:']);
var rho = brd.create('slider', [[2,5],[6,5],[0,0,2*Math.PI]]); brd.createElement('text',[1,5,'ρ:']);
var f = brd.create('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(){document.getElementById('ausgabe').innerHTML = (p.Value()).toFixed(1) + "/(1 - (" + (eps.Value()).toFixed(1) + ")*cos(φ+"+(rho.Value()).toFixed(1) +"))";});