| Dot, . | get dot product of tensors |
| InProduct | inner product of vectors (deprecated) |
| CrossProduct | outer product of vectors |
| Outer, o | get outer tensor product |
| ZeroVector | create a vector with all zeroes |
| BaseVector | base vector |
| Identity | make identity matrix |
| ZeroMatrix | make a zero matrix |
| Diagonal | extract the diagonal from a matrix |
| DiagonalMatrix | construct a diagonal matrix |
| OrthogonalBasis | create an orthogonal basis |
| OrthonormalBasis | create an orthonormal basis |
| Normalize | normalize a vector |
| Transpose | get transpose of a matrix |
| Determinant | determinant of a matrix |
| Trace | trace of a matrix |
| Inverse | get inverse of a matrix |
| Minor | get principal minor of a matrix |
| CoFactor | cofactor of a matrix |
| MatrixPower | get nth power of a square matrix |
| SolveMatrix | solve a linear system |
| CharacteristicEquation | get characteristic polynomial of a matrix |
| EigenValues | get eigenvalues of a matrix |
| EigenVectors | get eigenvectors of a matrix |
| Sparsity | get the sparsity of a matrix |
| Cholesky | find the Cholesky Decomposition |
Dot(t1,t2) t1 . t2 |
In> Dot({1,2},{3,4})
Out> 11;
In> Dot({{1,2},{3,4}},{5,6})
Out> {17,39};
In> Dot({5,6},{{1,2},{3,4}})
Out> {23,34};
In> Dot({{1,2},{3,4}},{{5,6},{7,8}})
Out> {{19,22},{43,50}};
|
Or, using the "."-Operator: |
In> {1,2} . {3,4}
Out> 11;
In> {{1,2},{3,4}} . {5,6}
Out> {17,39};
In> {5,6} . {{1,2},{3,4}}
Out> {23,34};
In> {{1,2},{3,4}} . {{5,6},{7,8}}
Out> {{19,22},{43,50}};
|
InProduct(a,b) |
This function is superceded by the . operator.
In> {a,b,c} . {d,e,f};
Out> a*d+b*e+c*f;
|
CrossProduct(a,b) a X b |
In> {a,b,c} X {d,e,f};
Out> {b*f-c*e,c*d-a*f,a*e-b*d};
|
Outer(t1,t2) t1 o t2 |
In> Outer({1,2},{3,4,5})
Out> {{3,4,5},{6,8,10}};
In> Outer({a,b},{c,d})
Out> {{a*c,a*d},{b*c,b*d}};
|
Or, using the "o"-Operator: |
In> {1,2} o {3,4,5}
Out> {{3,4,5},{6,8,10}};
In> {a,b} o {c,d}
Out> {{a*c,a*d},{b*c,b*d}};
|
ZeroVector(n) |
In> ZeroVector(4)
Out> {0,0,0,0};
|
BaseVector(k, n) |
n -- dimension of the vector
In> BaseVector(2,4)
Out> {0,1,0,0};
|
Identity(n) |
In> Identity(3)
Out> {{1,0,0},{0,1,0},{0,0,1}};
|
ZeroMatrix(n) ZeroMatrix(n, m) |
m -- number of columns
In> ZeroMatrix(3,4)
Out> {{0,0,0,0},{0,0,0,0},{0,0,0,0}};
In> ZeroMatrix(3)
Out> {{0,0,0},{0,0,0},{0,0,0}};
|
Diagonal(A) |
In> Diagonal(5*Identity(4))
Out> {5,5,5,5};
In> Diagonal(HilbertMatrix(3))
Out> {1,1/3,1/5};
|
DiagonalMatrix(d) |
In> DiagonalMatrix(1 .. 4)
Out> {{1,0,0,0},{0,2,0,0},{0,0,3,0},{0,0,0,4}};
|
OrthogonalBasis(W) |
In> OrthogonalBasis({{1,1,0},{2,0,1},{2,2,1}})
Out> {{1,1,0},{1,-1,1},{-1/3,1/3,2/3}};
|
OrthonormalBasis(W) |
In> OrthonormalBasis({{1,1,0},{2,0,1},{2,2,1}})
Out> {{Sqrt(1/2),Sqrt(1/2),0},{Sqrt(1/3),-Sqrt(1/3),Sqrt(1/3)},
{-Sqrt(1/6),Sqrt(1/6),Sqrt(2/3)}};
|
Normalize(v) |
In> v:=Normalize({3,4})
Out> {3/5,4/5};
In> v . v
Out> 1;
|
Transpose(M) |
In> Transpose({{a,b}})
Out> {{a},{b}};
|
Determinant(M) |
In> A:=DiagonalMatrix(1 .. 4)
Out> {{1,0,0,0},{0,2,0,0},{0,0,3,0},{0,0,0,4}};
In> Determinant(A)
Out> 24;
|
Trace(M) |
In> A:=DiagonalMatrix(1 .. 4)
Out> {{1,0,0,0},{0,2,0,0},{0,0,3,0},{0,0,0,4}};
In> Trace(A)
Out> 10;
|
Inverse(M) |
In> A:=DiagonalMatrix({a,b,c})
Out> {{a,0,0},{0,b,0},{0,0,c}};
In> B:=Inverse(A)
Out> {{(b*c)/(a*b*c),0,0},{0,(a*c)/(a*b*c),0},
{0,0,(a*b)/(a*b*c)}};
In> Simplify(B)
Out> {{1/a,0,0},{0,1/b,0},{0,0,1/c}};
|
Minor(M,i,j) |
i, j - positive integers
In> A := {{1,2,3}, {4,5,6}, {7,8,9}};
Out> {{1,2,3},{4,5,6},{7,8,9}};
In> PrettyForm(A);
/ \
| ( 1 ) ( 2 ) ( 3 ) |
| |
| ( 4 ) ( 5 ) ( 6 ) |
| |
| ( 7 ) ( 8 ) ( 9 ) |
\ /
Out> True;
In> Minor(A,1,2);
Out> -6;
In> Determinant({{2,3}, {8,9}});
Out> -6;
|
CoFactor(M,i,j) |
i, j - positive integers
In> A := {{1,2,3}, {4,5,6}, {7,8,9}};
Out> {{1,2,3},{4,5,6},{7,8,9}};
In> PrettyForm(A);
/ \
| ( 1 ) ( 2 ) ( 3 ) |
| |
| ( 4 ) ( 5 ) ( 6 ) |
| |
| ( 7 ) ( 8 ) ( 9 ) |
\ /
Out> True;
In> CoFactor(A,1,2);
Out> 6;
In> Minor(A,1,2);
Out> -6;
In> Minor(A,1,2) * (-1)^(1+2);
Out> 6;
|
MatrixPower(mat,n) |
n -- an integer
In> A:={{1,2},{3,4}}
Out> {{1,2},{3,4}};
In> MatrixPower(A,0)
Out> {{1,0},{0,1}};
In> MatrixPower(A,1)
Out> {{1,2},{3,4}};
In> MatrixPower(A,3)
Out> {{37,54},{81,118}};
In> MatrixPower(A,-3)
Out> {{-59/4,27/4},{81/8,-37/8}};
|
SolveMatrix(M,v) |
v -- a vector
In> A := {{1,2}, {3,4}};
Out> {{1,2},{3,4}};
In> v := {5,6};
Out> {5,6};
In> x := SolveMatrix(A, v);
Out> {-4,9/2};
In> A * x;
Out> {5,6};
|
CharacteristicEquation(matrix,var) |
var -- a free variable
In> A:=DiagonalMatrix({a,b,c})
Out> {{a,0,0},{0,b,0},{0,0,c}};
In> B:=CharacteristicEquation(A,x)
Out> (a-x)*(b-x)*(c-x);
In> Expand(B,x)
Out> (b+a+c)*x^2-x^3-((b+a)*c+a*b)*x+a*b*c;
|
EigenValues(matrix) |
It first determines the characteristic equation, and then factorizes this equation, returning the roots of the characteristic equation Det(matrix-x*identity).
In> M:={{1,2},{2,1}}
Out> {{1,2},{2,1}};
In> EigenValues(M)
Out> {3,-1};
|
EigenVectors(A,eigenvalues) |
eigenvalues -- list of eigenvalues as returned by EigenValues
In> M:={{1,2},{2,1}}
Out> {{1,2},{2,1}};
In> e:=EigenValues(M)
Out> {3,-1};
In> EigenVectors(M,e)
Out> {{-ki2/ -1,ki2},{-ki2,ki2}};
|
Sparsity(matrix) |
In> Sparsity(Identity(2)) Out> 0.5; In> Sparsity(Identity(10)) Out> 0.9; In> Sparsity(HankelMatrix(10)) Out> 0.45; In> Sparsity(HankelMatrix(100)) Out> 0.495; In> Sparsity(HilbertMatrix(10)) Out> 0; In> Sparsity(ZeroMatrix(10,10)) Out> 1; |
Cholesky(A) |
In> A:={{4,-2,4,2},{-2,10,-2,-7},{4,-2,8,4},{2,-7,4,7}}
Out> {{4,-2,4,2},{-2,10,-2,-7},{4,-2,8,4},{2,-7,4,7}};
In> R:=Cholesky(A);
Out> {{2,-1,2,1},{0,3,0,-2},{0,0,2,1},{0,0,0,1}};
In> Transpose(R)*R = A
Out> True;
In> Cholesky(4*Identity(5))
Out> {{2,0,0,0,0},{0,2,0,0,0},{0,0,2,0,0},{0,0,0,2,0},{0,0,0,0,2}};
In> Cholesky(HilbertMatrix(3))
Out> {{1,1/2,1/3},{0,Sqrt(1/12),Sqrt(1/12)},{0,0,Sqrt(1/180)}};
In> Cholesky(ToeplitzMatrix({1,2,3}))
In function "Check" :
CommandLine(1) : "Cholesky: Matrix is not positive definite"
|