Difference between revisions of "Matrix multiplication"

From JSXGraph Wiki
Jump to: navigation, search
Line 18: Line 18:
 
   v = b1.createElement('point',[2,2],{style:5,name:'v'});
 
   v = b1.createElement('point',[2,2],{style:5,name:'v'});
 
   w = b1.createElement('point',[-2,1],{style:5,name:'w'});
 
   w = b1.createElement('point',[-2,1],{style:5,name:'w'});
   va = b1.createElement('line',['Ursprung',v],{straightFirst:false, straightLast:false, lastArrow:true});
+
   va = b1.createElement('line',[[0,0],v],{straightFirst:false, straightLast:false, lastArrow:true});
   wa = b1.createElement('line',['Ursprung',w],{straightFirst:false, straightLast:false, lastArrow:true});
+
   wa = b1.createElement('line',[[0,0],w],{straightFirst:false, straightLast:false, lastArrow:true});
 
   b1.unsuspendUpdate();
 
   b1.unsuspendUpdate();
  
 
   b2 = JXG.JSXGraph.initBoard('box2', {originX: 150, originY: 150, unitX: 20, unitY: 20});
 
   b2 = JXG.JSXGraph.initBoard('box2', {originX: 150, originY: 150, unitX: 20, unitY: 20});
/*
 
 
   b2.suspendUpdate();
 
   b2.suspendUpdate();
 
   b2.createElement('axis', [[0,0], [1,0]], {});
 
   b2.createElement('axis', [[0,0], [1,0]], {});
Line 34: Line 33:
 
       function() {return a.Value()*w.X()+b.Value()*w.Y();},
 
       function() {return a.Value()*w.X()+b.Value()*w.Y();},
 
       function() {return c.Value()*w.X()+d.Value()*w.Y();}],{style:7,name:"w'"});
 
       function() {return c.Value()*w.X()+d.Value()*w.Y();}],{style:7,name:"w'"});
   va2 = b2.createElement('line',['Ursprung',v2],{straightFirst:false, straightLast:false, lastArrow:true});
+
   va2 = b2.createElement('line',[[0,0],v2],{straightFirst:false, straightLast:false, lastArrow:true});
   wa2 = b2.createElement('line',['Ursprung',w2],{straightFirst:false, straightLast:false, lastArrow:true});
+
   wa2 = b2.createElement('line',[[0,0],w2],{straightFirst:false, straightLast:false, lastArrow:true});
 
   t = b2.createElement('text',[-6,-2,function(){ return '|'+b2.round(a.Value(),2)+' '+b2.round(b.Value(),2)+'|'+'<br>'+'|'+b2.round(c.Value(),2)+' '+b2.round(d.Value(),2)+'|';}]);
 
   t = b2.createElement('text',[-6,-2,function(){ return '|'+b2.round(a.Value(),2)+' '+b2.round(b.Value(),2)+'|'+'<br>'+'|'+b2.round(c.Value(),2)+' '+b2.round(d.Value(),2)+'|';}]);
 
   b2.unsuspendUpdate();
 
   b2.unsuspendUpdate();
*/
+
 
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 21:08, 28 July 2009


References

The underlying JavaScript code

  b1 = JXG.JSXGraph.initBoard('box1', {originX: 150, originY: 150, unitX: 20, unitY: 20});
  b1.suspendUpdate();
  b1.createElement('axis', [[0,0], [1,0]], {});
  b1.createElement('axis', [[0,0], [0,1]], {});
  a = b1.createElement('slider',[[-5,-2],[5,-2],[-5,1,5]],{name:'a'});
  b = b1.createElement('slider',[[-5,-3],[5,-3],[-5,0,5]],{name:'b'});
  c = b1.createElement('slider',[[-5,-4],[5,-4],[-5,0,5]],{name:'c'});
  d = b1.createElement('slider',[[-5,-5],[5,-5],[-5,1,5]],{name:'d'});

  v = b1.createElement('point',[2,2],{style:5,name:'v'});
  w = b1.createElement('point',[-2,1],{style:5,name:'w'});
  va = b1.createElement('line',['Ursprung',v],{straightFirst:false, straightLast:false, lastArrow:true});
  wa = b1.createElement('line',['Ursprung',w],{straightFirst:false, straightLast:false, lastArrow:true});
  b1.unsuspendUpdate();

  b2 = JXG.JSXGraph.initBoard('box2', {originX: 150, originY: 150, unitX: 20, unitY: 20});
  b2.suspendUpdate();
  b2.createElement('axis', [[0,0], [1,0]], {});
  b2.createElement('axis', [[0,0], [0,1]], {});

  v2 = b2.createElement('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'"});
  w2 = b2.createElement('point',[
       function() {return a.Value()*w.X()+b.Value()*w.Y();},
       function() {return c.Value()*w.X()+d.Value()*w.Y();}],{style:7,name:"w'"});
  va2 = b2.createElement('line',['Ursprung',v2],{straightFirst:false, straightLast:false, lastArrow:true});
  wa2 = b2.createElement('line',['Ursprung',w2],{straightFirst:false, straightLast:false, lastArrow:true});
  t = b2.createElement('text',[-6,-2,function(){ return '|'+b2.round(a.Value(),2)+' '+b2.round(b.Value(),2)+'|'+'<br>'+'|'+b2.round(c.Value(),2)+' '+b2.round(d.Value(),2)+'|';}]);
  b2.unsuspendUpdate();