Power functions: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 11: | Line 11: | ||
// | // | ||
var n = b.createElement('slider',[[-5,-2],[5,-2],[-5,0,5]],{name:'n'}); | var n = b.createElement('slider',[[-5,-2],[5,-2],[-5,0,5]],{name:'n'}); | ||
var m = b.createElement('slider',[[1,-4],[10,-4],[1,10 | var m = b.createElement('slider',[[1,-4],[10,-4],[1,1,10]],{name:'m'}); | ||
b.createElement('curve', [function(t){ return t; }, function(t){ return b.pow(t,n.X()/m.X()); }, "t"],{strokeColor:'#ff0000'}); | b.createElement('curve', [function(t){ return t; }, function(t){ return b.pow(t,n.X()/m.X()); }, "t"],{strokeColor:'#ff0000'}); | ||
b.createElement('text',[-5, 3, function(){ return 'y=x<sup>'+b.round(n.X()/m.X(),3)+'</sup>';}]); | b.createElement('text',[-5, 3, function(){ return 'y=x<sup>'+b.round(n.X()/m.X(),3)+'</sup>';}]); | ||
Line 29: | Line 29: | ||
b.createElement('axis', [[0,0], [0,1]], {}); | b.createElement('axis', [[0,0], [0,1]], {}); | ||
var n = b.createElement('slider',[[-5,-2],[5,-2],[-5,0,5]],{name:'n'}); | var n = b.createElement('slider',[[-5,-2],[5,-2],[-5,0,5]],{name:'n'}); | ||
var m = b.createElement('slider',[[1,-4],[10,-4],[1,10 | var m = b.createElement('slider',[[1,-4],[10,-4],[1,1,10]],{name:'m'}); | ||
b.createElement('curve', [function(t){ return t; }, function(t){ return b.pow(t,n.X()/m.X()); }, "t"],{strokeColor:'#ff0000'}); | b.createElement('curve', [function(t){ return t; }, function(t){ return b.pow(t,n.X()/m.X()); }, "t"],{strokeColor:'#ff0000'}); | ||
b.createElement('text',[-5, 3, function(){ return 'y=x<sup>'+b.round(n.X()/m.X(),3)+'</sup>';}]); | b.createElement('text',[-5, 3, function(){ return 'y=x<sup>'+b.round(n.X()/m.X(),3)+'</sup>';}]); | ||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] |
Revision as of 15:33, 21 January 2009
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/prototype.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<div id="jxgbox" class="jxgbox" style="width:600px; height:400px;"></div>
b = JXG.JSXGraph.initBoard('jxgbox', {originX: 300, originY: 200, unitX: 20, unitY: 20});
b.createElement('axis', [[0,0], [1,0]], {});
b.createElement('axis', [[0,0], [0,1]], {});
var n = b.createElement('slider',[[-5,-2],[5,-2],[-5,0,5]],{name:'n'});
var m = b.createElement('slider',[[1,-4],[10,-4],[1,1,10]],{name:'m'});
b.createElement('curve', [function(t){ return t; }, function(t){ return b.pow(t,n.X()/m.X()); }, "t"],{strokeColor:'#ff0000'});
b.createElement('text',[-5, 3, function(){ return 'y=x<sup>'+b.round(n.X()/m.X(),3)+'</sup>';}]);