LeviCivita | totally anti-symmetric Levi-Civita symbol |
Permutations | get all permutations of a list |
InProduct | inner product of vectors |
CrossProduct | outer product of vectors |
ZeroVector | create a vector with all zeroes |
BaseVector | base vector |
Identity | make identity matrix |
ZeroMatrix | make a zero matrix |
DiagonalMatrix | construct a diagonal matrix |
IsMatrix | test for a matrix |
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 |
SolveMatrix | solve a linear system |
CharacteristicEquation | get characteristic polynomial of a matrix |
EigenValues | get eigenvalues of a matrix |
EigenVectors | get eigenvectors of a matrix |
IsHermitian | test for a Hermitian matrix |
IsOrthogonal | test for an orthogonal matrix |
IsSymmetric | test for a symmetric matrix |
IsSkewSymmetric | test for a skew-symmetric matrix |
IsUnitary | test for a unitary matrix |
IsIdempotent | test whether a matrix is idempotent |
JacobianMatrix | calculate the Jacobian matrix of n functions in n variables |
VandermondeMatrix | calculate the Vandermonde matrix |
HessianMatrix | calculate the Hessian matrix |
WronskianMatrix | calculate the Wronskian matrix |
SylvesterMatrix | calculate the Sylvester matrix of two polynomials |
LeviCivita(list) |
In> LeviCivita({1,2,3}) Out> 1; In> LeviCivita({2,1,3}) Out> -1; In> LeviCivita({2,2,3}) Out> 0; |
Permutations(list) |
In> Permutations({a,b,c}) Out> {{a,b,c},{a,c,b},{c,a,b},{b,a,c}, {b,c,a},{c,b,a}}; |
InProduct(a,b) a . b (prec. 3) |
In> {a,b,c} . {d,e,f}; Out> a*d+b*e+c*f; |
CrossProduct(a,b) a X b (prec. 3) |
In> {a,b,c} X {d,e,f}; Out> {b*f-c*e,c*d-a*f,a*e-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, m) |
m - number of columns
In> ZeroMatrix(3,4) Out> {{0,0,0,0},{0,0,0,0},{0,0,0,0}}; |
DiagonalMatrix(d) |
In> DiagonalMatrix(1 .. 4) Out> {{1,0,0,0},{0,2,0,0},{0,0,3,0},{0,0,0,4}}; |
IsMatrix(M) |
In> IsMatrix(ZeroMatrix(3,4)) Out> True; In> IsMatrix(ZeroVector(4)) Out> False; In> IsMatrix(3) Out> False; |
Normalize(v) |
In> Normalize({3,4}) Out> {3/5,4/5}; In> % . % Out> 1; |
Transpose(M) |
In> Transpose({{a,b}}) Out> {{a},{b}}; |
Determinant(M) |
In> DiagonalMatrix(1 .. 4) Out> {{1,0,0,0},{0,2,0,0},{0,0,3,0},{0,0,0,4}}; In> Determinant(%) Out> 24; |
Trace(M) |
In> DiagonalMatrix(1 .. 4) Out> {{1,0,0,0},{0,2,0,0},{0,0,3,0},{0,0,0,4}}; In> Trace(%) Out> 10; |
Inverse(M) |
In> DiagonalMatrix({a,b,c}) Out> {{a,0,0},{0,b,0},{0,0,c}}; In> Inverse(%) Out> {{(b*c)/(a*b*c),0,0},{0,(a*c)/(a*b*c),0}, {0,0,(a*b)/(a*b*c)}}; In> Simplify(%) 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; |
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> DiagonalMatrix({a,b,c}) Out> {{a,0,0},{0,b,0},{0,0,c}}; In> CharacteristicEquation(%,x) Out> (a-x)*(b-x)*(c-x); In> Expand(%,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}}; |
IsHermitian(A) |
In> IsHermitian({{0,I},{-I,0}}) Out> True; In> IsHermitian({{0,I},{2,0}}) Out> False; |
IsOrthogonal(A) |
In> A := {{1,2,2},{2,1,-2},{-2,2,-1}}; Out> {{1,2,2},{2,1,-2},{-2,2,-1}}; In> PrettyForm(A/3) / \ | / 1 \ / 2 \ / 2 \ | | | - | | - | | - | | | \ 3 / \ 3 / \ 3 / | | | | / 2 \ / 1 \ / -2 \ | | | - | | - | | -- | | | \ 3 / \ 3 / \ 3 / | | | | / -2 \ / 2 \ / -1 \ | | | -- | | - | | -- | | | \ 3 / \ 3 / \ 3 / | \ / Out> True; In> IsOrthogonal(A/3) Out> True; |
IsSymmetric(A) |
In> A := {{1,0,0,0,1},{0,2,0,0,0},{0,0,3,0,0}, {0,0,0,4,0},{1,0,0,0,5}}; In> PrettyForm(A) / \ | ( 1 ) ( 0 ) ( 0 ) ( 0 ) ( 1 ) | | | | ( 0 ) ( 2 ) ( 0 ) ( 0 ) ( 0 ) | | | | ( 0 ) ( 0 ) ( 3 ) ( 0 ) ( 0 ) | | | | ( 0 ) ( 0 ) ( 0 ) ( 4 ) ( 0 ) | | | | ( 1 ) ( 0 ) ( 0 ) ( 0 ) ( 5 ) | \ / Out> True; In> IsSymmetric(A) Out> True; |
IsSkewSymmetric(A) |
In> A := {{0,-1},{1,0}} Out> {{0,-1},{1,0}}; In> PrettyForm(%) / \ | ( 0 ) ( -1 ) | | | | ( 1 ) ( 0 ) | \ / Out> True; In> IsSkewSymmetric(A); Out> True; |
IsUnitary(A) |
A matrix A is orthogonal iff A^(-1) = Transpose( Conjugate(A) ). This is equivalent to the fact that the columns of A build an orthonormal system (with respect to the scalar product defined by InProduct).
In> IsUnitary({{0,I},{-I,0}}) Out> True; In> IsUnitary({{0,I},{2,0}}) Out> False; |
IsIdempotent(A) |
In> IsIdempotent(ZeroMatrix(10,10)); Out> True; In> IsIdempotent(Identity(20)) Out> True; |
variables -- An n dimensional vector of variables
The ijth element of the Jacobian matrix is defined as the derivative of ith function with respect to the jth variable.
In> JacobianMatrix( {Sin(x),Cos(y)}, {x,y} ); Out> {{Cos(x),0},{0,-Sin(y)}}; In> PrettyForm(%) / \ | ( Cos( x ) ) ( 0 ) | | | | ( 0 ) ( -( Sin( y ) ) ) | \ / |
VandermondeMatrix(vector) |
The ijth element of the Vandermonde matrix is defined as i^(j-1).
In> VandermondeMatrix({1,2,3,4}) Out> {{1,1,1,1},{1,2,3,4},{1,4,9,16},{1,8,27,64}}; In>PrettyForm(%) / \ | ( 1 ) ( 1 ) ( 1 ) ( 1 ) | | | | ( 1 ) ( 2 ) ( 3 ) ( 4 ) | | | | ( 1 ) ( 4 ) ( 9 ) ( 16 ) | | | | ( 1 ) ( 8 ) ( 27 ) ( 64 ) | \ / |
var -- An n dimensian vector of variables
The ijth element of the Hessian matrix is defined as Deriv(var[i])Deriv(var[j])function. If the third order mixed partials are continuous, then the Hessian matrix is symmetric.
The Hessian matrix is used in the second derivative test to discern if a critical point is a local maximum, local minimum or a saddle point.
In> HessianMatrix(3*x^2-2*x*y+y^2-8*y, {x,y} ) Out> {{6,-2},{-2,2}}; In> PrettyForm(%) / \ | ( 6 ) ( -2 ) | | | | ( -2 ) ( 2 ) | \ / |
var -- A variable to differentiate with respect to
The Wronskian matrix is created by putting each function as the first element of each column, and filling in the rest of each column by the ( i-1)-th derivative, where i is the current row.
The Wronskian matrix is used to verify if n functions are linearly independent, usually solutions to a differential equation. If the determinant of the Wronskian matrix is zero, then the functions are dependent, otherwise they are independent.
In> WronskianMatrix({Sin(x),Cos(x),x^4},x); Out> {{Sin(x),Cos(x),x^4},{Cos(x),-Sin(x),4*x^3}, {-Sin(x),-Cos(x),12*x^2}}; In> PrettyForm(%) / \ | ( Sin( x ) ) ( Cos( x ) ) / 4 \ | | \ x / | | | | ( Cos( x ) ) ( -( Sin( x ) ) ) / 3 \ | | \ 4 * x / | | | | ( -( Sin( x ) ) ) ( -( Cos( x ) ) ) / 2 \ | | \ 12 * x / | \ / |
In> Determinant( WronskianMatrix( {x^4,x^3,2*x^4 + 3*x^3},x ) ) Out> x^4*3*x^2*(24*x^2+18*x)-x^4*(8*x^3+9*x^2)*6*x +(2*x^4+3*x^3)*4*x^3*6*x-4*x^6*(24*x^2+18*x)+x^3 *(8*x^3+9*x^2)*12*x^2-(2*x^4+3*x^3)*3*x^2*12*x^2; In> Simplify(%) Out> 0; |
SylvesterMatrix(poly1,poly2,variable) |
poly2 -- polynomial
variable -- variable to express the matrix for
The Sylvester matrix is closely related to the resultant, which is defined as the determinant of the Sylvester matrix. Two polynomials share common roots only if the resultant is zero.
In> ex1:= x^2+2*x-a Out> x^2+2*x-a; In> ex2:= x^2+a*x-4 Out> x^2+a*x-4; In> SylvesterMatrix(ex1,ex2,x) Out> {{1,2,-a,0},{0,1,2,-a}, {1,a,-4,0},{0,1,a,-4}}; In> Determinant(%) Out> 16-a^2*a- -8*a-4*a+a^2- -2*a^2-16-4*a; In> Simplify(%) Out> 3*a^2-a^3; |
The above example shows that the two polynomials have common zeros if a=3.