Difference between revisions of "Trochoid"

From JSXGraph Wiki
Jump to: navigation, search
Line 11: Line 11:
 
<script language="JavaScript">
 
<script language="JavaScript">
 
  board = JXG.JSXGraph.initBoard('jsxgbox', {originX: 250, originY: 250, unitX: 25, unitY: 25});
 
  board = JXG.JSXGraph.initBoard('jsxgbox', {originX: 250, originY: 250, unitX: 25, unitY: 25});
 +
board.suspendUpdate();
 
  board.createElement('axis', [[0,0],[1,0]]);
 
  board.createElement('axis', [[0,0],[1,0]]);
 
  board.createElement('axis', [[0,0],[0,1]]);
 
  board.createElement('axis', [[0,0],[0,1]]);
Line 19: Line 20:
 
  var c1 = board.createElement('curve', [x,y,'phi',-Math.PI*4,Math.PI*4],{strokeWidth:3});
 
  var c1 = board.createElement('curve', [x,y,'phi',-Math.PI*4,Math.PI*4],{strokeWidth:3});
 
   
 
   
  var X = function(phi) { return board.D(y)(phi)/(y(phi)*board.D(x)(phi)-x(phi)*board.D(y)(phi)); }
+
  var dualCurve = function(x,y,board) {
var Y = function(phi) { return board.D(x)(phi)/(x(phi)*board.D(y)(phi)-y(phi)*board.D(x)(phi)); }
+
    var X = function(phi) { return board.D(y)(phi)/(y(phi)*board.D(x)(phi)-x(phi)*board.D(y)(phi)); }
  var c2 = board.createElement('curve', [X,Y,'phi',-Math.PI*1,Math.PI*1],{strokeWidth:3, strokeColor:'red'});
+
    var Y = function(phi) { return board.D(x)(phi)/(x(phi)*board.D(y)(phi)-y(phi)*board.D(x)(phi)); }
 +
    return [X,Y];
 +
    }
 +
var dual = dualCurve(x,y,board);
 +
  var c2 = board.createElement('curve', [dual[0],dual[1],'phi',-Math.PI*1,Math.PI*1],{strokeWidth:3, strokeColor:'red'});
 +
board.unsuspendUpdate();
 
</script>  
 
</script>  
 
</html>
 
</html>
 +
 +
[[Category:Examples]]

Revision as of 18:06, 5 February 2009

The Trochoid curve (blue) and its dual curve (red). The equation of the trochoid is

[math]x = a\phi-b\sin(\phi)[/math]
[math]y = a-b\cos(\phi)[/math]