Difference between revisions of "The Multiplication Parabola"

From JSXGraph Wiki
Jump to: navigation, search
Line 11: Line 11:
 
===The underlying JavaScript code===
 
===The underlying JavaScript code===
 
<source lang="xml">
 
<source lang="xml">
</jsxgraph></source>
+
<jsxgraph width="400" height="600" box="box">
 +
var brd = JXG.JSXGraph.initBoard('box', {axis:true, originX: 200, originY: 550, grid:true, unitX: 50, unitY: 50});
 +
var f = brd.createElement('functiongraph',[function(x){return x*x;}],{strokeColor:'black',highlightStrokeColor:'black'});
 +
var a = brd.createElement('glider',[-2,4,f]);
 +
var b = brd.createElement('glider',[3,9,f]);
 +
var g = brd.createElement('line',[a,b],{straightFirst:false,straightLast:false});
 +
var p = brd.createElement('point',[function(){return 0.0;},function(){return -a.X()*b.X();}],{fixed:true});
 +
var t = brd.createElement('text',[-1.5,9,function(){ return '-X(A)*X(B) = '+a.X().toFixed(2)+'*'+b.X().toFixed(2)+' = '+(-a.X()*b.X()).toFixed(2)+' = Y(C)';}]);
 +
</jsxgraph>
 +
</source>
  
 
[[Category:Examples]]
 
[[Category:Examples]]

Revision as of 13:58, 19 June 2009

The underlying JavaScript code

<jsxgraph width="400" height="600" box="box">
var brd = JXG.JSXGraph.initBoard('box', {axis:true, originX: 200, originY: 550, grid:true, unitX: 50, unitY: 50});
var f = brd.createElement('functiongraph',[function(x){return x*x;}],{strokeColor:'black',highlightStrokeColor:'black'});
var a = brd.createElement('glider',[-2,4,f]);
var b = brd.createElement('glider',[3,9,f]);
var g = brd.createElement('line',[a,b],{straightFirst:false,straightLast:false});
var p = brd.createElement('point',[function(){return 0.0;},function(){return -a.X()*b.X();}],{fixed:true});
var t = brd.createElement('text',[-1.5,9,function(){ return '-X(A)*X(B) = '+a.X().toFixed(2)+'*'+b.X().toFixed(2)+' = '+(-a.X()*b.X()).toFixed(2)+' = Y(C)';}]);
</jsxgraph>