Power functions: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<html>
<jsxgraph width="600" height="400" box="jxgbox">
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />
b = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox: [-15, 10, 15, -10]});
<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>
<script language="JavaScript">
b = JXG.JSXGraph.initBoard('jxgbox', {originX: 300, originY: 200, unitX: 20, unitY: 20});
b.suspendUpdate();
b.suspendUpdate();
b.createElement('axis', [[0,0], [1,0]], {});
var n = b.create('slider',[[-5,-2],[5,-2],[-5,1,5]],{name:'n'});
b.createElement('axis', [[0,0], [0,1]], {});
var m = b.create('slider',[[1,-4],[10,-4],[1,1,10]],{name:'m'});
//
b.create('functiongraph', [function(t){ return JXG.Math.pow(t,n.Value()/m.Value()); }],{strokeColor:'#ff0000'});
var n = b.createElement('slider',[-5,-2,10,-5,5,0],{name:'n'});
b.create('text',[-5, 3, function(){ return 'y=x<sup>'+(n.Value()/m.Value()).toFixed(3)+'</sup>';}]);
var m = b.createElement('slider',[1.0,-4,9,1,10,1],{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 'x<sup>'+b.round(n.X()/m.X(),3)+'</sup>';}]);
b.unsuspendUpdate();
b.unsuspendUpdate();
</script>  
</jsxgraph>  
</html>
</html>


<source lang="javascript">
<source lang="javascript">
b = JXG.JSXGraph.initBoard('jxgbox', {originX: 300, originY: 200, unitX: 20, unitY: 20});
b = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox: [-15, 10, 15, -10]});
b.createElement('axis', [[0,0], [1,0]], {});
b.suspendUpdate();
b.createElement('axis', [[0,0], [0,1]], {});
var n = b.create('slider',[[-5,-2],[5,-2],[-5,1,5]],{name:'n'});
var n = b.createElement('slider',[-5,-2,10,-5,5,0],{name:'n'});
var m = b.create('slider',[[1,-4],[10,-4],[1,1,10]],{name:'m'});
var m = b.createElement('slider',[1.0,-4,9,1,10,1],{name:'m'});
b.create('functiongraph', [function(t){ return JXG.Math.pow(t,n.Value()/m.Value()); }],{strokeColor:'#ff0000'});
b.createElement('curve', [function(t){ return t; }, function(t){ return b.pow(t,n.X()/m.X()); }, "t"],{strokeColor:'#ff0000'});
b.create('text',[-5, 3, function(){ return 'y=x<sup>'+(n.Value()/m.Value()).toFixed(3)+'</sup>';}]);
b.createElement('text',[-5, 3, function(){ return 'x^'+b.round(n.X()/m.X(),3);}]);
b.unsuspendUpdate();
</source>
</source>
[[Category:Examples]]
[[Category:Examples]]
[[Category:Calculus]]

Latest revision as of 15:43, 20 February 2013

</html>

b = JXG.JSXGraph.initBoard('jxgbox', {axis:true, boundingbox: [-15, 10, 15, -10]});
b.suspendUpdate();
var n = b.create('slider',[[-5,-2],[5,-2],[-5,1,5]],{name:'n'});
var m = b.create('slider',[[1,-4],[10,-4],[1,1,10]],{name:'m'});
b.create('functiongraph', [function(t){ return JXG.Math.pow(t,n.Value()/m.Value()); }],{strokeColor:'#ff0000'});
b.create('text',[-5, 3, function(){ return 'y=x<sup>'+(n.Value()/m.Value()).toFixed(3)+'</sup>';}]);
b.unsuspendUpdate();