Arithmetics of complex numbers: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
===Addition of complex numbers===
===Addition of complex numbers===
<jsxgraph box="box" width="600" height="400">
<jsxgraph box="box" width="600" height="400">
        board = JXG.JSXGraph.initBoard('box', {boundingbox: [-6, 6, 8, -4], axis: true});
board = JXG.JSXGraph.initBoard('box', {boundingbox: [-6, 6, 8, -4], axis: true});
          
          
        var org = board.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
var org = board.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
        var x = board.create('point', [2,2], {style:5,fillColor:'blue',name:'x'});
var x = board.create('point', [2,2], {style:5,fillColor:'blue',name:'x'});
        var y = board.create('point', [-1,-3], {style:5,fillColor:'blue',name:'y'});
var y = board.create('point', [-1,-3], {style:5,fillColor:'blue',name:'y'});
        var xy = board.create('point',  
var xy = board.create('point',  
              ["X(x)+X(y)","Y(x)+Y(y)"], {style:7,fillColor:'blue',name:'x+y'});
    ["X(x)+X(y)","Y(x)+Y(y)"], {style:7,fillColor:'blue',name:'x+y'});
        var ax =board.create('arrow', [org,x], {strokeColor:'blue'});
var ax =board.create('arrow', [org,x], {strokeColor:'blue'});
        var ay =board.create('arrow', [org,y], {strokeColor:'blue'});
var ay =board.create('arrow', [org,y], {strokeColor:'blue'});
        var axy =board.create('arrow', [org,xy], {strokeColor:'red'});
var axy =board.create('arrow', [org,xy], {strokeColor:'red'});
        var ax2 =board.create('arrow', [x,xy], {strokeColor:'blue',strokeWidth:1,dash:1});
var ax2 =board.create('arrow', [x,xy], {strokeColor:'blue',strokeWidth:1,dash:1});
        var ay2 =board.create('arrow', [y,xy], {strokeColor:'blue',strokeWidth:1,dash:1});
var ay2 =board.create('arrow', [y,xy], {strokeColor:'blue',strokeWidth:1,dash:1});
</jsxgraph>
</jsxgraph>


===Multiplication of complex numbers===
===Multiplication of complex numbers===
<jsxgraph box="box2" width="600" height="400">
<jsxgraph box="box2" width="600" height="400">
        brd2 = JXG.JSXGraph.initBoard('box2', {boundingbox: [-6, 6, 8, -4], axis: true});
brd2 = JXG.JSXGraph.initBoard('box2', {boundingbox: [-6, 6, 8, -4], axis: true});
          
          
        var org2 = brd2.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
var org2 = brd2.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
        var x = brd2.create('point', [1,0], {style:4,fillColor:'blue',name:'x'});
var x = brd2.create('point', [1,0], {style:4,fillColor:'blue',name:'x'});
        var y = brd2.create('point', [0,2], {style:4,fillColor:'red',strokeColor:'red',name:'y'});
var y = brd2.create('point', [0,2], {style:4,fillColor:'red',strokeColor:'red',name:'y'});
        var xy = brd2.create('point',  
var xy = brd2.create('point',  
              ["X(x)*X(y)-Y(x)*Y(y)","X(x)*Y(y)+X(y)*Y(x)"], {style:7,fillColor:'green',strokeColor:'green',name:'x*y'});
    ["X(x)*X(y)-Y(x)*Y(y)","X(x)*Y(y)+X(y)*Y(x)"], {style:7,fillColor:'green',strokeColor:'green',name:'x*y'});
        var c = brd2.create('circle',[org2,1],{strokeWidth:1,dash:1});         
var c = brd2.create('circle',[org2,1],{strokeWidth:1,dash:1});         
</jsxgraph>
</jsxgraph>


Line 32: Line 32:
Addition:
Addition:
<source lang="javascript">
<source lang="javascript">
        board = JXG.JSXGraph.initBoard('box', {boundingbox: [-6, 6, 8, -4], axis: true});
board = JXG.JSXGraph.initBoard('box', {boundingbox: [-6, 6, 8, -4], axis: true});
          
          
        var org = board.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
var org = board.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
        var x = board.create('point', [2,2], {style:5,fillColor:'blue',name:'x'});
var x = board.create('point', [2,2], {style:5,fillColor:'blue',name:'x'});
        var y = board.create('point', [-1,-3], {style:5,fillColor:'blue',name:'y'});
var y = board.create('point', [-1,-3], {style:5,fillColor:'blue',name:'y'});
        var xy = board.create('point',  
var xy = board.create('point',  
              ["X(x)+X(y)","Y(x)+Y(y)"], {style:7,fillColor:'blue',name:'x+y'});
    ["X(x)+X(y)","Y(x)+Y(y)"], {style:7,fillColor:'blue',name:'x+y'});
        var ax =board.create('arrow', [org,x], {strokeColor:'blue'});
var ax =board.create('arrow', [org,x], {strokeColor:'blue'});
        var ay =board.create('arrow', [org,y], {strokeColor:'blue'});
var ay =board.create('arrow', [org,y], {strokeColor:'blue'});
        var axy =board.create('arrow', [org,xy], {strokeColor:'red'});
var axy =board.create('arrow', [org,xy], {strokeColor:'red'});
        var ax2 =board.create('arrow', [x,xy], {strokeColor:'blue',strokeWidth:1,dash:1});
var ax2 =board.create('arrow', [x,xy], {strokeColor:'blue',strokeWidth:1,dash:1});
        var ay2 =board.create('arrow', [y,xy], {strokeColor:'blue',strokeWidth:1,dash:1});
var ay2 =board.create('arrow', [y,xy], {strokeColor:'blue',strokeWidth:1,dash:1});
</source>
</source>


Line 49: Line 49:


<source lang="javascript">
<source lang="javascript">
        brd2 = JXG.JSXGraph.initBoard('box2', {boundingbox: [-6, 6, 8, -4], axis: true});
brd2 = JXG.JSXGraph.initBoard('box2', {boundingbox: [-6, 6, 8, -4], axis: true});
          
          
        var org2 = brd2.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
var org2 = brd2.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
        var x = brd2.create('point', [1,0], {style:5,fillColor:'blue',name:'x',trace:true});
var x = brd2.create('point', [1,0], {style:4,fillColor:'blue',name:'x'});
        var y = brd2.create('point', [0,2], {style:5,fillColor:'red',strokeColor:'red',name:'y',trace:true});
var y = brd2.create('point', [0,2], {style:4,fillColor:'red',strokeColor:'red',name:'y'});
        var xy = brd2.create('point',  
var xy = brd2.create('point',  
              ["X(x)*X(y)-Y(x)*Y(y)","X(x)*Y(y)+X(y)*Y(x)"], {style:7,fillColor:'green',strokeColor:'green',name:'x*y',trace:true});
    ["X(x)*X(y)-Y(x)*Y(y)","X(x)*Y(y)+X(y)*Y(x)"], {style:7,fillColor:'green',strokeColor:'green',name:'x*y'});
        var c = brd2.create('circle',[org2,1],{strokeWidth:1,dash:1});         
var c = brd2.create('circle',[org2,1],{strokeWidth:1,dash:1});         
</source>
</source>



Revision as of 11:48, 7 June 2011

Addition of complex numbers

Multiplication of complex numbers


The underlying JavaScript code

Addition:

board = JXG.JSXGraph.initBoard('box', {boundingbox: [-6, 6, 8, -4], axis: true});
        
var org = board.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
var x = board.create('point', [2,2], {style:5,fillColor:'blue',name:'x'});
var y = board.create('point', [-1,-3], {style:5,fillColor:'blue',name:'y'});
var xy = board.create('point', 
    ["X(x)+X(y)","Y(x)+Y(y)"], {style:7,fillColor:'blue',name:'x+y'});
var ax =board.create('arrow', [org,x], {strokeColor:'blue'});
var ay =board.create('arrow', [org,y], {strokeColor:'blue'});
var axy =board.create('arrow', [org,xy], {strokeColor:'red'});
var ax2 =board.create('arrow', [x,xy], {strokeColor:'blue',strokeWidth:1,dash:1});
var ay2 =board.create('arrow', [y,xy], {strokeColor:'blue',strokeWidth:1,dash:1});

Multiplication:

brd2 = JXG.JSXGraph.initBoard('box2', {boundingbox: [-6, 6, 8, -4], axis: true});
        
var org2 = brd2.create('point', [0,0], {style:10,visible:true,fixed:true,name:' '});
var x = brd2.create('point', [1,0], {style:4,fillColor:'blue',name:'x'});
var y = brd2.create('point', [0,2], {style:4,fillColor:'red',strokeColor:'red',name:'y'});
var xy = brd2.create('point', 
    ["X(x)*X(y)-Y(x)*Y(y)","X(x)*Y(y)+X(y)*Y(x)"], {style:7,fillColor:'green',strokeColor:'green',name:'x*y'});
var c = brd2.create('circle',[org2,1],{strokeWidth:1,dash:1});

References