Matrix multiplication II: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 15: | Line 15: | ||
var va2 = b1.create('arrow',[[0,0],v2],{color:'black', strokeWidth:1}); | var va2 = b1.create('arrow',[[0,0],v2],{color:'black', strokeWidth:1}); | ||
var t = b1.create('text',[-8,5,function(){ return 'Matrix=<br>|'+b1.round(a.Value(),2)+' '+b1.round(b.Value(),2)+'| | var t = b1.create('text',[-8, 5, | ||
function(){ return 'Matrix=<br>|' | |||
+ b1.round(a.Value(),2) + ' ' | |||
+ b1.round(b.Value(),2) + '|<br>|' | |||
+ b1.round(c.Value(),2) +' ' | |||
+ b1.round(d.Value(),2)+'|';}]); | |||
var t2 = b1.create('text',[-8,1, | var t2 = b1.create('text',[-8,1, | ||
Line 25: | Line 29: | ||
);}]); | );}]); | ||
b1.unsuspendUpdate(); | b1.unsuspendUpdate(); | ||
</jsxgraph> | </jsxgraph> | ||
Line 46: | Line 49: | ||
var va2 = b1.create('arrow',[[0,0],v2],{color:'black', strokeWidth:1}); | var va2 = b1.create('arrow',[[0,0],v2],{color:'black', strokeWidth:1}); | ||
var t = b1.create('text',[-8,5,function(){ return 'Matrix=<br>|'+b1.round(a.Value(),2)+' '+b1.round(b.Value(),2)+'| | var t = b1.create('text',[-8, 5, | ||
function(){ return 'Matrix=<br>|' | |||
+ b1.round(a.Value(),2) + ' ' | |||
+ b1.round(b.Value(),2) + '|<br>|' | |||
+ b1.round(c.Value(),2) +' ' | |||
+ b1.round(d.Value(),2)+'|';}]); | |||
var t2 = b1.create('text',[-8,1, | var t2 = b1.create('text',[-8,1, | ||
Line 56: | Line 63: | ||
);}]); | );}]); | ||
b1.unsuspendUpdate(); | b1.unsuspendUpdate(); | ||
</source> | </source> | ||
[[Category:Examples]] | [[Category:Examples]] |
Revision as of 08:17, 25 March 2011
The underlying JavaScript code
var b1 = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-10,10,10,-10], axis:true});
b1.suspendUpdate();
var a = b1.create('slider',[[-5,-2],[5,-2],[-5,1,5]],{name:'a', snapWidth:0.1});
var b = b1.create('slider',[[-5,-3],[5,-3],[-5,0,5]],{name:'b', snapWidth:0.1});
var c = b1.create('slider',[[-5,-4],[5,-4],[-5,0,5]],{name:'c', snapWidth:0.1});
var d = b1.create('slider',[[-5,-5],[5,-5],[-5,1,5]],{name:'d', snapWidth:0.1});
var v = b1.create('point',[2,2],{style:5,name:'v'});
var va = b1.create('arrow',[[0,0],v]);
var v2 = b1.create('point',[
function() {return a.Value()*v.X()+b.Value()*v.Y();},
function() {return c.Value()*v.X()+d.Value()*v.Y();}],{style:7,name:"v'"});
var va2 = b1.create('arrow',[[0,0],v2],{color:'black', strokeWidth:1});
var t = b1.create('text',[-8, 5,
function(){ return 'Matrix=<br>|'
+ b1.round(a.Value(),2) + ' '
+ b1.round(b.Value(),2) + '|<br>|'
+ b1.round(c.Value(),2) +' '
+ b1.round(d.Value(),2)+'|';}]);
var t2 = b1.create('text',[-8,1,
function(){ return "λ = |v'|/|v| = "
+ b1.round(
JXG.Math.Geometry.distance([0,0],[v2.X(),v2.Y()])/
JXG.Math.Geometry.distance([0,0],[v.X(),v.Y()]), 3
);}]);
b1.unsuspendUpdate();