Mate - online symbolic calculator by Tusanga


Calculation
- Getting started
- Expressions
- Statements
- Functions
- Examples
- Questions
Resources

Calculation / Functions

The system has a set of predefined functions pre-loaded. In the following the functions are grouped together in groups containing related functions. Each function is described and syntax as well as examples are listed. Additionally the user can define functions using the function assignment statement.

Functions on scalars       
abs   sign   floor   ceil   trunc   round   float   frac   sqrt   roots   exp   ln   log2   log10   sin   cos   tan   csc   sec   cot   
Functions on intervals       
lower   upper   
Functions on complex numbers       
conj   real   imag   abs   angle   
Functions on sets       
makeset   union   intersect   difference   symdifference   ismember   
Elementary matrix and vector functions       
I   ones   zeros   rand   nrows   ncolums   rot90   fliplr   fliptb   lowertrian   uppertrian   diag   all   exists   
Functions on bit vectors       
bvmake   bvtoint   bvsplit   bvconcat   bvadd   bvsub   bvmul   bvnot   bvand   bvnand   bvor   bvnor   bvxor   
Solving functions       
solve   solveb   solvei   solvef   solvem   inv   pinv   forwardsub   backwardsub   pluq   pldvq   
Symbolic and numeric computation       
diff   difff   int   intf   expand   factor   
Data analysis functions       
cumsum   cumprod   moments   sum   prod   mean   variance   variances   stddev   stddevs   sort   quartiles   max   min   median   geomean   harmean   
Data manipulation functions       
op   nops   subs   subsop   map   
Other functions       
gcd   lcm   space   eval   evalf   tostring   primefactors   


Functions on scalars

Function : abs
Name : Absolute value
Syntax : abs(x)
Description : The abs function returns the absolute value of a number.
Example : abs(-2) == 2

Function : sign
Syntax : sign(x)
Description : The sign function returns minus one if the value of x is less than zero, zero if the value is zero and one if the value is greater than zero.
Example : sign(-10) == -1; sign(0) == 0; sign(200) == 1

Function : floor
Syntax : floor(x)
Description : The floor function rounds the value towards minus infinity. It returns an integer.
Example : floor(2.7) == 2
Example : floor(-2.7) == -3

Function : ceil
Name : Ceiling
Syntax : ceil(x)
Description : The ceil function rounds the value towards plus infinity. It returns an integer.
Example : ceil(2.7) == 3
Example : ceil(-2.7) == -2

Function : trunc
Name : Truncate
Syntax : trunc(x)
Description : The trunc function rounds the value towards zero. It returns the integer part of the value.
Example : trunc(2.7) == 2
Example : trunc(-2.7) == -2

Function : round
Syntax : round(x)
Description : The round function round the value to the nearest integer.
Example : round(2.7) == 3
Example : round(2.3) == 2

Function : float
Syntax : float(x)
Description : The float function converts integers to floating point values.
Example : float(2) == 2.0

Function : frac
Name : Fraction
Syntax : frac(x)
Description : The frac function ignores the integer part of the value and returns the fraction part.
Example : frac(2.4) == 0.4

Function : sqrt
Name : Square root
Syntax : sqrt(x)
Description : The function returns the square root of the value
Example : sqrt(4) == 2

Function : roots
Syntax : roots(x,y)
Description : The roots function returns the y'th root of x.
Example : roots(8,3) == 2

Function : exp
Name : Exponential
Syntax : exp(x)
Description : The function returns the exponential value, that is the e ^ x.
Example : exp(0) == 1

Function : ln
Name : Natural logarithm
Syntax : ln(x)
Description : The function returns the natural logarithm of the value.
Example : ln(e) == 1

Function : log2
Name : Logarithm base 2
Syntax : log2(x)
Description : The function returns the logarithm base 2 of the value.
Example : log2(4) == 2.0

Function : log10
Name : Logarithm base 10
Syntax : log10(x)
Description : The function returns the logarithm base 10 of the value.
Example : log10(1000) == 3.0

Function : sin
Name : Sine
Syntax : sin(x)
Description : The sine function of an angle returns the ratio of the length of the opposite side to the length of the hypotenuse. The angle is assumed to be in radians.
Example : sin(pi/2) == 1.0

Function : cos
Name : Cosine
Syntax : cos(x)
Description : The cosine function of an angle returns the ratio of the length of the adjacent side to the length of the hypotenuse. The angle is assumed to be in radians.
Example : cos(pi) == -1.0

Function : tan
Name : Tangens
Syntax : tan(x)
Description : The tangens function of an angle returns the ratio of the opposite side to the length of the adjacent side. The angle is assumed to be in radians.
Example : tan(pi) == 0

Function : csc
Name : Cosecant
Syntax : csc(x)
Description : The cosecant function of an angle returns the ratio of the length of the hypotenuse to the length of the opposite side. The angle is assumed to be in radians. The functions is the reciprocal of sinus.
Example : csc(pi/2) == 1.0

Function : sec
Name : Secant
Syntax : sec(x)
Description : The secant function of an angle returns the ratio of the length of the hypotenuse to the length of the adjacent side. The angle is assumed to be in radians. The functions is the reciprocal of cosinus.
Example : sec(pi) == -1.0

Function : cot
Name : Cotangens
Syntax : cot(x)
Description : The cotangens function of an angle returns the ratio of the length of the adjacent side to the opposite side. The angle is assumed to be in radians.
Example : cot(pi) == Inf

goto top

Functions on intervals

Function : lower
Name : Lower boundary
Syntax : lower([l..u])
Description : The lower function returns the lower boundary l of an interval.
Example : lower ([2..8]) == 2

Function : upper
Name : Upper boundary
Syntax : upper([l..u])
Description : The upper function returns the upper boundary u of an interval.
Example : upper ([2..8]) == 8

goto top

Functions on complex numbers

Function : conj
Name : Conjugate
Syntax : conj(r+j*i)
Description : The conjugate function of a complex number returns a complex number with same real part and with the imaginary part multiplied with minus one.
Example : conj(2*i) == -2*i

Function : real
Name : Real part
Syntax : real(r+j*i)
Description : The real function returns the real part of a complex number.
Example : real(2+3*i) == 2

Function : imag
Name : Imaginary part
Syntax : imag(r+j*i)
Description : The imag function returns the imaginary part of a complex number
Example : imag(2+3*i) == 3

Function : abs
Name : Absolute value
Syntax : abs(r+j*i)
Description : The abs function returns the absolute value of a complex number, that is distance in the complex plane of the complex number from zero.
Example : abs(3+4*i) == 5

Function : angle
Syntax : angle(r+j*i)
Description : The angle function of a complex number returns the angle in the complex plane between the vector, which goes from zero to the complex number, and the vector from zero to 1.
Example : angle(2+2*i) - pi/4 == 0

goto top

Functions on sets

Function : makeset
Syntax : makeset(V)
Description : The makeset function takes a matrix as argument, eliminates double elements in the matrix and returns the remaining elements as a row vector.
Example : makeset({a,b,c,d,c}) == {a,b,c,d}

Function : union
Syntax : union(V1,V2)
Description : The union function takes two sets in form of matrices and returns the union in form of a matrix. The union includes all elements in either of the two given sets.
Example : union({1,2,3},{3,4,5}) == {1,2,3,4,5}

Function : intersect
Name : Intersection
Syntax : intersect(V1,V2)
Description : The intersection function takes two sets in form of matrices and returns the intersection in form of a matrix. The intersection consists of all elements that occur in both of the two given sets.
Example : intersect({1,2,3},{3,4,5}) == 3

Function : difference
Syntax : difference(V1,V2)
Description : The difference function takes two sets in form of matrices and returns the difference in form of a matrix. The difference consists of all elements that occur in the first set except those that also occur in the latter set.
Example : difference({1,2,3},{3,4,5}) == {1,2}

Function : symdifference
Name : Symmetric difference
Syntax : symdifference(V1,V2)
Description : The symmetric difference function takes two sets in form of matrices and returns the symmetric difference in form of a matrix. The symmetric difference consists of all elements that occur in the first or the latter set except for those that occur in both sets.
Example : symdifference({1,2,3},{3,4,5}) == {1,2,4,5}

Function : ismember
Syntax : ismember(V,x)
Description : The ismember function evaluates to true if the element x is a member of the set V.
Example : ismember({1,2,3,4,5},12) == false

goto top

Elementary matrix and vector functions

Function : I
Name : Identity matrix
Syntax : I(n)
Syntax : I(r,c)
Description : The identity function evaluates to the identity matrix with side length n, or with row count r and column count c.
Example : I(3) == {1,0,0;0,1,0;0,0,1}
Example : I(3,2) == {1,0;0,1;0,0}

Function : ones
Syntax : ones(n)
Syntax : ones(r,c)
Description : The ones function evaluates to a matrix of ones with side length n, or with row count r and column count c.
Example : ones(3) == {1,1,1;1,1,1;1,1,1}
Example : ones(3,2) == {1,1;1,1;1,1}

Function : zeros
Syntax : zeros(n)
Syntax : zeros(r,c)
Description : The zeros function evaluates to a matrix of zeros with side length n, or with row count r and column count c.
Example : zeros(3) == {0,0,0;0,0,0;0,0,0}
Example : zeros(3,2) == {0,0;0,0;0,0}

Function : rand
Name : Random number(s)
Syntax : rand([l..u])
Syntax : rand(n)
Syntax : rand(n,[l..u])
Syntax : rand(r,c)
Syntax : rand(r,c,[l..u])
Description : The random number function returns one or more random numbers. If a side length n or row count r and column count c is given, a matrix with those attributes is returned. Else a scalar is returned. If an interval is specified, at random numbers lie in that interval. If not, they lie in the interval from zero to one.
Example : rand(4,2,[2..10[)

Function : nrows
Name : Number of rows
Syntax : nrows(M)
Description : The nrows function of a matrix evaluates to the number of rows in that matrix.
Example : nrows({1,2,3;4,5,6}) == 2

Function : ncolums
Name : Number of colums
Syntax : ncolums(M)
Description : The ncolums function of a matrix evaluates to the number of colums in that matrix.
Example : ncolums({1,2,3;4,5,6}) == 3

Function : rot90
Name : Rotate 90 degrees clockwise
Syntax : rot90(M)
Description : The rot90 function of a matrix evaluates to the matrix rotated 90 degrees clockwise.
Example : rot90({1,2;3,4}) == {3,1;4,2}

Function : fliplr
Name : Flip left-right
Syntax : fliplr(M)
Description : The fliplr function of a matrix evaluates to the matrix flipped over a vertical axis.
Example : fliplr({1,2;3,4}) == {2,1;4,3}

Function : fliptb
Name : Flip top-bottom
Syntax : fliptb(M)
Description : The fliptb function of a matrix evaluates to the matrix flipped over a horizontal axis.
Example : fliptb({1,2;3,4}) == {3,4;1,2}

Function : lowertrian
Name : Lower triangular matrix
Syntax : lowertrian(M)
Description : The lower triangular function of a matrix with dimension (r, c) evaluates to the matrix with all elements, where c>r, set to zero and all elements,where r=c, set to one.
Example : lowertrian({1,2,3;4,5,6;7,8,9}) == {1,0,0;4,1,0;7,8,1}

Function : uppertrian
Name : Upper triangular matrix
Syntax : uppertrian(M)
Description : The upper triangular function of a matrix with dimension (r, c) evaluates to the matrix with all elements, where r>c, set to zero.
Example : uppertrian({1,2,3;4,5,6;7,8,9}) == {1,2,3;0,5,6;0,0,9}

Function : diag
Name : Diagonal
Syntax : diag(V)
Syntax : diag(M)
Description : The diagonal function of a vector evaluates to a matrix with the vector a diagonal and all other elements zero. The diagonal function of a matrix evaluates to a vector consisting of the diagonal elements of the matrix.
Example : diag({1,2,3,4}) == {1,0,0,0;0,2,0,0;0,0,3,0;0,0,0,4}
Example : diag({1,2,3,4;5,6,7,8}) == {1,6}

Function : all
Syntax : all(M)
Description : The all function of a matrix evaluates to true if all elements in the matrix evaluates to true
Example : all({false, true, true}) == false

Function : exists
Syntax : exists(M)
Description : The exists function of a matrix evaluates to true if any element in the matrix evaluates to true
Example : exists({false, true, true}) == true

goto top

Functions on bit vectors

Function : bvmake
Name : make bit vector
Syntax : bvmake(n, x)
Description : The bvmake functions converts the integer x to a n-bit bit vector. It can also chomp or extend a bit bvector.
Example : bvmake(6,13) == {0, 0, 1, 1, 0, 1}
Example : bvmake(5,{1, 0, 1}) == {0, 0, 1, 0, 1}
Example : bvmake(2,{1, 0, 1}) == {0, 1}

Function : bvtoint
Name : bit vector to integer
Syntax : bvtoint(V)
Description : The bvtoint function converts a bit vector V to an unsigned integer.
Example : bvtoint({1, 0, 1}) == 5

Function : bvsplit
Name : split bit vector in halves
Syntax : bvsplit(V)
Description : The bvsplit functions splits the given bit vector into halves.
Example : bvsplit({0, 0, 1, 1, 0, 1}) == {{0, 0, 1}, {1, 0, 1}}
Example : bvsplit({0, 1, 1, 0, 1}) == {{0, 1}, {1, 0, 1}}

Function : bvconcat
Name : bit vector concatenation
Syntax : bvconcat(V1,V2)
Description : The bvconcat functions concatenates two bit vectors.
Example : bvconcat({0, 1, 0},{1, 0, 0}) == {0, 1, 0, 1, 0, 0}
Example : bvconcat({0, 1, 0, 0},{1, 0}) == {0, 1, 0, 0, 1, 0}

Function : bvadd
Name : bit vector addition
Syntax : bvadd(V1,V2)
Syntax : bvadd(n,V1,V2)
Description : The bvadd functions adds two bit vectors. The result is n long or as long as the longest of the two bit vectors. The vectors are when needed extended with 0 bits, i.e. as unsigned bit vectors.
Example : bvadd({0, 1, 0},{1, 0, 0}) == {1, 1, 0}
Example : bvadd(6,{0, 1, 0},{1, 0, 1, 0, 0}) == {0, 1, 0, 1, 1, 0}

Function : bvsub
Name : bit vector subtraction
Syntax : bvsub(V1,V2)
Syntax : bvsub(n,V1,V2)
Description : The bvsub functions subtracts two bit vectors. The result is n long or as long as the longest of the two bit vectors. The vectors are when needed extended with 0 bits, i.e. as unsigned bit vectors.
Example : bvsub({1, 0, 0},{0, 1, 0}) == {0, 1, 0}
Example : bvsub(6,{0, 1, 0},{1, 0, 1, 0, 0}) == {1, 0, 1, 1, 1, 0}

Function : bvmul
Name : bit vector multiplication
Syntax : bvmul(V1,V2)
Syntax : bvmul(n,V1,V2)
Description : The bvmul functions multiplies two bit vectors. The result is n long or as long as the concatenation of the two bit vectors. The vectors are when needed extended with 0 bits, i.e. as unsigned bit vectors.
Example : bvmul({0, 1, 0},{1, 0, 0}) == {0, 0, 1, 0, 0, 0}

Function : bvnot
Name : bit vector negation
Syntax : bvnot(V)
Syntax : bvnot(n,V)
Description : The bvnot functions generates the bit vector equivalent to the 'not' operator. The result is n long or as long as the bit vector argument. The argument bit vector is when needed extended with 0 bits, i.e. as unsigned bit vectors.
Example : bvnot({0,1,0}) == {1,0,1}
Example : bvnot(5,{0,1,0}) == {1,1,1,0,1}

Function : bvand
Name : bit vector and
Syntax : bvand(V1,V2)
Syntax : bvand(n,V1,V2)
Description : The bvand functions applies the boolean operator 'and' to the two bit vectors. The result is n long or as long as the longest of the two bit vectors. The vectors are when needed extended with 0 bits, i.e. as unsigned bit vectors.
Example : bvand({1 , 1 , 0 , 0},{1 , 0 , 1 , 0}) == {1 , 0 , 0 , 0}
Example : bvand(6,{1, 1, 0},{1, 0, 1, 0, 0}) == {0, 0, 0, 1, 0, 0}

Function : bvnand
Name : bit vector nand
Syntax : bvnand(V1,V2)
Syntax : bvnand(n,V1,V2)
Description : The bvnand functions applies the boolean operator 'nand' to the two bit vectors. The result is n long or as long as the longest of the two bit vectors. The vectors are when needed extended with 0 bits, i.e. as unsigned bit vectors.
Example : bvnand({1 , 1 , 0 , 0},{1 , 0 , 1 , 0}) == {0 , 1 , 1 , 1}
Example : bvnand(6,{1, 1, 0},{1, 0, 1, 0, 0}) == {1, 1, 1, 0, 1, 1}

Function : bvor
Name : bit vector or
Syntax : bvor(V1,V2)
Syntax : bvor(n,V1,V2)
Description : The bvor functions applies the boolean operator 'or' to the two bit vectors. The result is n long or as long as the longest of the two bit vectors. The vectors are when needed extended with 0 bits, i.e. as unsigned bit vectors.
Example : bvor({1 , 1 , 0 , 0},{1 , 0 , 1 , 0}) == {1 , 1 , 1 , 0}
Example : bvor(6,{0, 1, 0},{1, 0, 1, 0, 0}) == {0, 1, 0, 1, 1, 0}

Function : bvnor
Name : bit vector nor
Syntax : bvnor(V1,V2)
Syntax : bvnor(n,V1,V2)
Description : The bvnor functions applies the boolean operator 'nor' to the two bit vectors. The result is n long or as long as the longest of the two bit vectors. The vectors are when needed extended with 0 bits, i.e. as unsigned bit vectors.
Example : bvnor({1 , 1 , 0 , 0},{1 , 0 , 1 , 0}) == {0 , 0 , 0 , 1}
Example : bvnor(6,{0, 1, 0},{1, 0, 1, 0, 0}) == {1, 0, 1, 0, 0, 1}

Function : bvxor
Name : bit vector exclusive or
Syntax : bvxor(V1,V2)
Syntax : bvxor(n,V1,V2)
Description : The bvxor functions applies the boolean operator 'xor' to the two bit vectors. The result is n long or as long as the longest of the two bit vectors. The vectors are when needed extended with 0 bits, i.e. as unsigned bit vectors.
Example : bvxor({1 , 1 , 0 , 0},{1 , 0 , 1 , 0}) == {0 , 1 , 1 , 0}
Example : bvxor(6,{0, 1, 0},{1, 0, 1, 0, 0}) == {0, 1, 0, 1, 1, 0}

goto top

Solving functions

Function : solve
Name : Symbolic solver
Syntax : solve(x, v)
Syntax : solve(x == y, v)
Description : The solve function finds feasible solutions to the equations x==0 or x==y.
Example : solve(2*x==12,x) == 6

Function : solveb
Name : Boolean solver
Syntax : solveb(b, v)
Syntax : solveb(b, {v1,v2,...})
Syntax : solveb({b1,b2,...},v)
Syntax : solveb({b1,b2,...},{v1,v2,...})
Description : The solveb function finds feasible solutions to the Boolean variables v,v1,v2,... using the requirements stated as Boolean expressions b,b1,b2,...
Example : solveb({b1 or b2, not b1},{b1,b2}) == {false, true}

Function : solvei
Name : Integer solver
Syntax : solvei(b, v==[l..u])
Syntax : solvei(b, {v1==[l1..u1],v2==[l2..u2],...})
Syntax : solvei({b1,b2,...},v)
Syntax : solvei({b1,b2,...},{v1==[l1..u1],v2==[l2..u2],...})
Syntax : solvei(b, v==[l..u], x)
Syntax : solvei(b, {v1==[l1..u1],v2==[l2..u2],...}, x)
Syntax : solvei({b1,b2,...},v, x)
Syntax : solvei({b1,b2,...},{v1==[l1..u1],v2==[l2..u2],...}, x)
Description : Solvei finds integer solutions to the Boolean expressions b,b1,b2 for the variables v,v1,v2 in the given intervals. If an optional expression x is given, the solution(s) where x has it's maximum is returned. A matrix is returned with each row being the values of the variables for one solution. If no solutions are found, NaN is returned.
Example : solvei({x+y < 3, y+z > 2},{x==[0..5], y==[0..10], z==[2..7]})
Example : solvei({x+y < 3, y+z > 2},{x==[0..5], y==[0..10], z==[2..7]}, 2*x+3*z)

Function : solvef
Name : Numeric solver
Syntax : solvef(x, v==[l..u])
Description : The solvef function trys to find a feasible solution to the equation x==0 in the interval [l..u].
Example : solvef(x^2-8*x+12,x==[0..5])

Function : solvem
Name : Matrix solver
Syntax : solvem(M1, M3)
Description : Solvem finds the solution M2 to the equation M1*M2=M3. If M1 is regular, {M2,0} is returned. If the system is over-determined the least square solution M2 is found and {M2, NaN} is returned. If the system is under-determined the minimum norm solution as well as a generating matrix H are found and returned: {M2,H}
Example : solvem({1,2;3,4},{13, 29}`)
Example : A:={1,2,3,4;4,5,6,7}; b:={1,7}`; {x0,H}:=solvem(A,b); A*x0==b; A*(x0+H*{2,3}`)==b

Function : inv
Name : Matrix inversion
Syntax : inv(M)
Description : Inv finds the solution X to the equation M*X=I, where I ist the identity matrix, if M is square and regular. If M is not square and regular, the function returns NaN. In this case the function pinv calculates a pseudoinverse.
Example : inv({1,2;3,4})

Function : pinv
Name : Matrix pseudo-inversion
Syntax : pinv(M)
Description : Pinv finds the solution X to the equation M*X=I, where I ist the identity matrix. The solution can be the inverse or a pseudoinverse.
Example : pinv({1,2,3;4,5,6})

Function : forwardsub
Name : Forward substitution
Syntax : forwardsub(M1,M2)
Description : Forwardsub finds the solution X to the equation M1*X=M2 by performing forward substitution.
Example : forwardsub({1,0;3,1},{2,9}`)

Function : backwardsub
Name : Backward substitution
Syntax : backwardsub(M1,M2)
Description : Backwardsub finds the solution X to the equation M1*X=M2 by performing backward substitution.
Example : backwardsub({1,3;0,1},{9,2}`)

Function : pluq
Name : P-L-U-Q matrix factorization
Syntax : pluq(M)
Description : Pluq returns a rowvector containing then rank followed by the P, L, U and Q matrices. If the matrix is not fullrank, the factorization may not be successfull.
Example : pluq({1,2;3,4})

Function : pldvq
Name : P-L-D-V-Q matrix factorization
Syntax : pluq(M)
Description : Pldvq returns a rowvector containing the rank followed by the P, L, D, V and Q matrices. If the matrix is not fullrank, the factorization may not be successfull.
Example : pldvq({1,2;3,4})

goto top

Symbolic and numeric computation

Function : diff
Name : Differentiation
Syntax : diff(x,v)
Syntax : diff(x,v==y)
Description : The function diff finds the derivative of the expression x with respect to the variable v.
Example : diff(2*x^2-12*x+2,x)
Example : diff(2*x^2-12*x+2,x==1)

Function : difff
Name : Numerical differentiation
Syntax : difff(x,v==y)
Description : The function difff finds the derivative of the expression x with respect to the variable v at v==y numerically.
Example : difff(2*x^2-12*x+2,x==1)

Function : int
Name : integration
Syntax : int(x,v)
Syntax : int(x,v=[l..u])
Description : The function int finds the indefinite integral of the expression x with respect to the variable v. If an interval is given the definite integral is found.
Example : int(2*x^2-12*x+2,x)
Example : int(2*x^2-12*x+2,x==[1..3])

Function : intf
Name : numerical integration
Syntax : intf(x,v=[l..u])
Description : The function int finds the definite integral of the expression x with respect to the variable v in the given interval.
Example : intf(2*x^2-12*x+2,x==[1..3])

Function : expand
Syntax : expand(x)
Description : The expand function expands the expression x so that multiplications and powers are expanded.
Example : expand((x-2)*(x-4))

Function : factor
Syntax : factor(x)
Description : The factor function collects common factor of the expression x.
Example : factor(a*x*b+c*x*d)

goto top

Data analysis functions

Function : cumsum
Name : Cummulated sum
Syntax : cumsum(M)
Description : The cumsum function of a matrix evaluates to a row vector containing the cummulated sum of the matrix elements taken row by row
Example : cumsum({1,2,3,4;5,6,7,8}) == {1,3,6,10,15,21,28,36}

Function : cumprod
Name : Cummulated product
Syntax : cumprod(M)
Description : The cumprod function of a matrix evaluates to a row vector containing the cummulated product of the matrix elements taken row by row
Example : cumprod({1,2,3,4;5,6,7,8}) == {1,2,6,24,120,720,5040,40320}

Function : moments
Syntax : moments(M)
Description : The moments function of a matrix evaluates to a row vector containing the number of elements, sum, mean, variance, skewness and curtosis of the matrix elements.
Example : moments({1.0,2,3,4;5,6,7,8})

Function : sum
Syntax : (M)
Description : The sum function of a matrix evaluates to the sum of the matrix elements.
Example : sum({1,2,3,4;5,6,7,8}) == 36

Function : prod
Name : Product
Syntax : prod(M)
Description : The prod function of a matrix evaluates to the product of the matrix elements.
Example : prod({1,2,3,4;5,6,7,8}) == 40320

Function : mean
Syntax : mean(M)
Description : The mean function of a matrix evaluates to the mean of the matrix elements.
Example : mean({1,2,3,4;5,6,7,8}) == 9/2

Function : variance
Name : Variance of population
Syntax : var(M)
Description : The variance function of a matrix evaluates to the variance of the matrix elements.
Example : variance({1,2,3,4;5,6,7,8}) == 21/4

Function : variances
Name : Variance of sample
Syntax : var(M)
Description : The variances function of a matrix evaluates to the variance of the matrix elements.
Example : variances({1,2,3,4;5,6,7,8}) == 6

Function : stddev
Name : Standard deviation of population
Syntax : std(M)
Description : The stddev function of a matrix evaluates to the standard deviation of the matrix elements.
Example : stddev({1,2,3,4;5,6,7,8}) == sqrt(21/4)

Function : stddevs
Name : Standard deviation of sample
Syntax : std(M)
Description : The stddevs function of a matrix evaluates to the standard deviation of the matrix elements.
Example : stddevs({1,2,3,4;5,6,7,8}) == sqrt(6)

Function : sort
Syntax : sort(M)
Description : The sort function of a matrix evaluates to a row vector containing the sorted matrix elements
Example : sort({5,6,7,8; 1,2,3,4}) == {1,2,3,4,5,6,7,8}

Function : quartiles
Syntax : quartiles(M)
Description : The quartiles function of a matrix evaluates to a row vector containing the minimum, first quartile, the mean, the third quartile and the maximum of the matrix elements.
Example : quartiles({1.0,2,3,4;5,6,7,8}) == {1.0, 5/2, 9/2, 13/2, 8}

Function : max
Name : Maximum value
Syntax : max(M)
Syntax : max(x, y, ...)
Description : The max function of a matrix evaluates to the maximum of the elements.
Example : max({1,2,3,4;5,6,7,8}) == 8
Example : max(1,2,3,4,x) == max(4,x)

Function : min
Name : Minimal value
Syntax : min(M)
Syntax : min(x, y, ...)
Description : The min function of a matrix evaluates to the minimum of the elements.
Example : min({1,2,3,4;5,6,7,8}) == 1
Example : min(1,2,3,4,x) == min(1,x)

Function : median
Name : Median value
Syntax : median(M)
Description : The median function of a matrix evaluates to the the number separating the higher half of the matrix elements from the lower half.
Example : median({1,3,5,7,9}) == 5

Function : geomean
Name : Geometric mean
Syntax : geomean(M)
Description : The geomean function of a matrix evaluates to the geometric mean of the matrix elements.
Example : geomean({1.0,2,3,4;5,6,7,8})

Function : harmean
Name : Harmonic mean
Syntax : harmean(M)
Description : The harmean function of a matrix evaluates to the harmonic mean of the matrix elements.
Example : harmean({1.0,2,3,4;5,6,7,8})

goto top

Data manipulation functions

Function : op
Syntax : op(x,n)
Description : The op function evaluates to the n'th subexpression of the expression x.
Example : op(a+b,2) == b

Function : nops
Syntax : nops(x)
Description : The nops function evaluates to the number of subexpressions in the expression x.
Example : nops(a+b) == 2

Function : subs
Syntax : subs(x1,x2,x3)
Description : The subs function evaluates to the expression x1 with subexpressions x2 exchanged for subexpression x3
Example : subs(a+b+c,b,k) == a+k+c

Function : subsop
Syntax : subsop(x1,n,x2)
Description : The subs function evaluates to the expression x1 with n'th subexpressions has been exchanged for subexpression x2
Example : subsop(a+b+c,2,k) == a+k+c

Function : map
Syntax : map(M,x,v)
Description : The map function evaluates to a matrix of the same dimensions as M, where for each element the expression x has been evaluated after assigning the corresponding element of M to the variable v.
Example : map({1,2,3,4,5},x^2,x) == {1,4,9,16,25}

goto top

Other functions

Function : gcd
Name : Greatest common denominator
Syntax : gcd(x,y)
Description : The gcd functions returns the largest integer, that is a denominator of x as well as y.
Example : gcd(30,36) == 6

Function : lcm
Name : Least common multiple
Syntax : lcm(x,y)
Description : The lcm function returns the smallest integers, that has x and y as denominator.
Example : lcm(30,36) == 180

Function : space
Syntax : space(x, v==[l..u],n)
Syntax : space([l..u],n)
Description : The function space evaluates the expression x for n different evenly distributed values of the variable v in the given interval [l..u] and returns the evaluated values of the x as a row vector. The expression x and the variable v may be omitted. In that case a linear distribuition of the values are assumed.
Example : space(x^2,x==[0..3],4) == {0,1,4,9}
Example : space([0..5],6) == {0,1,2,3,4,5}

Function : eval
Name : Evaluate
Syntax : evaluate(x,n)
Description : The evaluate function evaluates the expression x, i.e. the first argument, depending on the integer n, i.e. the second argument. Setting n = 1 makes the system apply basic rules of arithmetic, n = 2 enables variable substitution as well, n = 3 turns function evaluation on and n = 4 makes certain expression evaluate to a floating point value.
Example : eval(pi,4)

Function : evalf
Name : Evaluate to floating point value
Syntax : evalf(x)
Description : The evalf function is defined as evalf(x) := eval(x,4). Please see description for function eval.
Example : evalf(pi)

Function : tostring
Name : Convert expression to string
Syntax : tostring(x)
Description : Converts an expression to a string.
Example : tostring(2*pi*x)

Function : primefactors
Syntax : primefactors(n)
Description : The primefactors function returns a vector of the primefactors of n.
Example : primefactors(12345) == {1 , 3 , 5 , 823}

goto top

The following abbreviations are used:
x,y Scalar expressions / scalars
r+j*i Complex expression / complex number
[l..u] Interval with lower and upper limit. The interval my be closed [l..u], open ]l..u[ or half-closed.
V, V1, V2 Vectors, i.e matrices with rowcount 1
M, M1, M2 Matrices with rowcount >= 1
v, v1, v2 Variables
b, b1, b2 Expression, that can be evaluated to true or false
n Integer
This free online symbolic calculator and solver enables you to define variables and functions as well as to evaluate expressions containing numbers in any number system from 2 (binary) over 8 (octal), 10 (decimal) and 16 (hexadecimal) to 36, roman numerals, complex numbers, intervals, variables, matrices, function calls, Boolean values (true and false) and operators (and, or, not ...), relations (e.g. greater than) and the if-then-else control structure. Comments are C-style /* */ or //. Plots are available using the plot statement.

Tell a friend - Share - About - Terms of use - Privacy policy - Contact - Impressum - FAQ - Member login
Version 0.3 release 6 Copyright © 1996-2008 by Tusanga. All rights reserved
Last updated: October 16, 2008