home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / Chip_2002-06_cd1.bin / zkuste / derive / download / Setup.exe / %MAINDIR% / Math / Matrix.dmo < prev    next >
Encoding:
Text File  |  2002-05-15  |  2.1 KB  |  99 lines

  1. ;Generate a table of squares and cubes
  2. VECTOR([x,x^2,x^3],x,1,8)
  3.  
  4. ;Define MATRIX for generating matrices
  5. MATRIX(z,i,m,j,n):=VECTOR(VECTOR(z,j,1,n),i,1,m)
  6.  
  7. ;Generate a 2 by 3 matrix
  8. MATRIX(i-j,i,2,j,3)
  9.  
  10. ;Generate the 3 by 3 identity matrix
  11. IDENTITY_MATRIX(3)
  12.  
  13. ;Element [1,2] of a matrix
  14. [[a,b,c],[1,2,3]] SUB 1 SUB 2
  15.  
  16. ;Row 2 of a matrix
  17. [[a,b,c],[1,2,3]] SUB 2
  18.  
  19. ;Matrix addition and multiplication by scalar
  20. 2*[[a,2],[3,b]]+[[1,3],[a,-b]]
  21.  
  22. ;Dot product (inner product) of two vectors
  23. [2,a,5] . [2*a,3,-1]
  24.  
  25. ;Dot product of two matrices
  26. [[a,b],[c,d]] . [[x],[y]]
  27.  
  28. ;Cross product of two vectors
  29. CROSS([1,2,3],[a,b,c])
  30.  
  31. ;Number of elements of a vector
  32. DIMENSION([a,b,c])
  33.  
  34. ;Number of rows of a matrix
  35. DIMENSION([[1,2,3],[4,5,6]])
  36.  
  37. ;Define OUTER to compute the outer product
  38. OUTER(v,w):=VECTOR([v SUB i],i,DIMENSION(v)) . [w]
  39.  
  40. ;The outer product of two vectors
  41. OUTER([a,b,c],[2,3,4])
  42.  
  43. ;Transpose of a matrix
  44. [[a,b,c],[1,2,3]]`
  45.  
  46. ;Column 3 of a matrix
  47. [[a,b,c],[1,2,3]]` SUB 3
  48.  
  49. ;Determinant of a square matrix
  50. DET([[2,3],[a,b]])
  51.  
  52. ;Try factoring this determinant
  53. DET([[1,a,a,a],[1,x,a,a],[1,a,x,a],[1,a,a,x]])
  54.  
  55. ;Try factoring this determinant
  56. DET([[x,1,1,1,1],[1,x,1,1,1],[1,1,x,1,1],[1,1,1,x,1],[1,1,1,1,x]])
  57.  
  58. ;Sum of the elements on the main diagonal
  59. TRACE([[a,b],[1,2]])
  60.  
  61. ;Matrix inverse
  62. [[a,b],[2,3]]^(-1)
  63.  
  64. ;A matrix dotted with its inverse is an identity matrix
  65. [[a,b],[c,d]] . [[a,b],[c,d]]^(-1)
  66.  
  67. ;Using an inverse matrix to solve the system  a x + b y = e,  c x + d y = f
  68. [[a,b],[c,d]]^(-1) . [[e],[f]]
  69.  
  70. ;Reduce matrices to row echelon form
  71. ROW_REDUCE([[2,4],[3,6]],[[6],[9]])
  72.  
  73. ;Characteristic polynomial of a square matrix
  74. CHARPOLY([[a,b],[b,a]],z)
  75.  
  76. ;Eigenvalues of a square matrix
  77. EIGENVALUES([[a,b],[b,a]])
  78.  
  79. ;Vector algebra simplification
  80. a . (b+c)-(b` . a`)`
  81.  
  82. ;Gradient of an expression
  83. GRAD(x+y^2+z^3)
  84.  
  85. ;Divergence of a vector
  86. DIV([1,2*y,3*z^2])
  87.  
  88. ;Divergence of the gradient of an expression
  89. LAPLACIAN(x+y^2+z^3)
  90.  
  91. ;Curl of a vector
  92. CURL([y^2,2*x*z,0])
  93.  
  94. ;Scalar potential of a vector
  95. POTENTIAL([1,2*y,3*z^2])
  96.  
  97. ;Vector potential of a vector
  98. VECTOR_POTENTIAL([-2*x,0,2*z-2*y])
  99.