Trochoid: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
:<math>y = a-b\cos(\phi)</math> | :<math>y = a-b\cos(\phi)</math> | ||
< | <jsxgraph box="jsxgbox" width="550" height="500"> | ||
board = JXG.JSXGraph.initBoard('jsxgbox', {boundingbox:[-10,10,10,-10], axis:true}); | |||
board.suspendUpdate(); | |||
var a = board.create('slider', [[1,-1],[8,-1],[-5,1,5]], {style:6,name:'a'}); | |||
var b = board.create('slider', [[1,-2],[8,-2],[-5,1,5]], {style:6,name:'b'}); | |||
var x = function(phi) { return a.Value()*phi-b.Value()*Math.sin(phi); } | |||
var y = function(phi) { return a.Value()-b.Value()*Math.cos(phi); } | |||
var c1 = board.create('curve', [x,y,-Math.PI*4,Math.PI*4],{strokeWidth:3}); | |||
var dualCurve = function(x,y,board) { | |||
var X = function(phi) { return board.D(y)(phi)/(y(phi)*board.D(x)(phi)-x(phi)*board.D(y)(phi)); } | var X = function(phi) { return board.D(y)(phi)/(y(phi)*board.D(x)(phi)-x(phi)*board.D(y)(phi)); } | ||
var Y = function(phi) { return board.D(x)(phi)/(x(phi)*board.D(y)(phi)-y(phi)*board.D(x)(phi)); } | var Y = function(phi) { return board.D(x)(phi)/(x(phi)*board.D(y)(phi)-y(phi)*board.D(x)(phi)); } | ||
return [X,Y]; | return [X,Y]; | ||
} | |||
var dual = dualCurve(x,y,board); | |||
var c2 = board.create('curve', [dual[0],dual[1],-Math.PI*1,Math.PI*1],{strokeWidth:3, strokeColor:'red'}); | |||
board.unsuspendUpdate(); | |||
</ | </jsxgraph> | ||
===References=== | ===References=== | ||
* [http://en.wikipedia.org/wiki/Trochoid http://en.wikipedia.org/wiki/Trochoid] | * [http://en.wikipedia.org/wiki/Trochoid http://en.wikipedia.org/wiki/Trochoid] | ||
* [http://en.wikipedia.org/wiki/Dual_curve http://en.wikipedia.org/wiki/Dual_curve] | * [http://en.wikipedia.org/wiki/Dual_curve http://en.wikipedia.org/wiki/Dual_curve] | ||
===The underlying JavaScript code=== | ===The underlying JavaScript code=== | ||
<source lang=" | <source lang="javascript"> | ||
board = JXG.JSXGraph.initBoard('jsxgbox', {boundingbox:[-10,10,10,-10], axis:true}); | |||
board.suspendUpdate(); | |||
var a = board.create('slider', [[1,-1],[8,-1],[-5,1,5]], {style:6,name:'a'}); | |||
var b = board.create('slider', [[1,-2],[8,-2],[-5,1,5]], {style:6,name:'b'}); | |||
var x = function(phi) { return a.Value()*phi-b.Value()*Math.sin(phi); } | |||
var y = function(phi) { return a.Value()-b.Value()*Math.cos(phi); } | |||
var c1 = board.create('curve', [x,y,-Math.PI*4,Math.PI*4],{strokeWidth:3}); | |||
var dualCurve = function(x,y,board) { | |||
var X = function(phi) { return board.D(y)(phi)/(y(phi)*board.D(x)(phi)-x(phi)*board.D(y)(phi)); } | var X = function(phi) { return board.D(y)(phi)/(y(phi)*board.D(x)(phi)-x(phi)*board.D(y)(phi)); } | ||
var Y = function(phi) { return board.D(x)(phi)/(x(phi)*board.D(y)(phi)-y(phi)*board.D(x)(phi)); } | var Y = function(phi) { return board.D(x)(phi)/(x(phi)*board.D(y)(phi)-y(phi)*board.D(x)(phi)); } | ||
return [X,Y]; | return [X,Y]; | ||
} | |||
var dual = dualCurve(x,y,board); | |||
var c2 = board.create('curve', [dual[0],dual[1],-Math.PI*1,Math.PI*1],{strokeWidth:3, strokeColor:'red'}); | |||
board.unsuspendUpdate(); | |||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Curves]] | [[Category:Curves]] |
Revision as of 07:37, 9 June 2011
The Trochoid curve (blue) and its dual curve (red). The equation of the trochoid is
- [math]\displaystyle{ x = a\phi-b\sin(\phi) }[/math]
- [math]\displaystyle{ y = a-b\cos(\phi) }[/math]
References
The underlying JavaScript code
board = JXG.JSXGraph.initBoard('jsxgbox', {boundingbox:[-10,10,10,-10], axis:true});
board.suspendUpdate();
var a = board.create('slider', [[1,-1],[8,-1],[-5,1,5]], {style:6,name:'a'});
var b = board.create('slider', [[1,-2],[8,-2],[-5,1,5]], {style:6,name:'b'});
var x = function(phi) { return a.Value()*phi-b.Value()*Math.sin(phi); }
var y = function(phi) { return a.Value()-b.Value()*Math.cos(phi); }
var c1 = board.create('curve', [x,y,-Math.PI*4,Math.PI*4],{strokeWidth:3});
var dualCurve = function(x,y,board) {
var X = function(phi) { return board.D(y)(phi)/(y(phi)*board.D(x)(phi)-x(phi)*board.D(y)(phi)); }
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.create('curve', [dual[0],dual[1],-Math.PI*1,Math.PI*1],{strokeWidth:3, strokeColor:'red'});
board.unsuspendUpdate();