﻿﻿﻿ math handbook calculator - Fractional Calculus Computer Algebra System software + + + = ﻿

# Function Reference Source

You can use external function as standard functions by its file name without extension, e.g. abs(x), not abs.txt. You can add your own file to the library. It is loaded auto when it needs.

Complex number functions
arg conj imag = im abs polar real = re rect

Linear algebra functions
abs adj cofactor contract det dot inverse outer transpose unit

Calculus functions
circexp define d eval integral integrate taylor

Polynomial functions
coeff deg eval expand factor leading psolve quotient polyroot

Equation
dsolve lasolve solve psolve nsolve test

Scripting
do for product sum

## abs(x) source

Returns the absolute value of a real number, the magnitude of a complex number, or the vector length.

Returns the adjunct of matrix m. The inverse of m is equal to adj(m) divided by det(m).

## and(a,b,...) source

Logical-and of predicate expressions.

## acos(x) source

Returns the inverse cosine of x, = arccos(x).

## acosh(x) source

Returns the inverse hyperbolic cosine of x, = arccosh(x).

## asin(x) source

Returns the inverse sine of x, = arcsin(x).

## asinh(x) source

Returns the inverse hyperbolic sine of x, = arcsinh(x).

## atan(x) source

Returns the inverse tangent of x,= atan(x).

## atan2(y,x) source

Returns the inverse tangent of y/x, = arctan(y/x).

## atanh(x) source

Returns the inverse hyperbolic tangent of x, = arctanh(x).

## arg(z) source

Returns the angle of complex z.

## besselJ(n,x) source

Returns a solution to the Bessel differential equation (Bessel function of first kind).

## besselY(n,x) source

Bessel function of second kind.

## ceil(x) source

Returns the smallest integer not less than x.

## check(x) source

If x is true then continue, else stop. Use A=B to check that A equals B.

## choose(n,k) source

Returns the number of combinations of n items taken k at a time, = combination(n,k).

## combination(n,k) source

Returns the number of combinations of n items taken k at a time, = choose(n,k).

## circexp(x) source

Returns expression x with circular and hyperbolic functions converted to exponential forms. Sometimes this will simplify an expression.

## clear(x) source

Completely wipes a variable from the environment (while doing x = quote(x) just unassigns it).

## clearall source

Completely wipes all variables from the environment.

## coeff(p,x,n) source

Returns the coefficient of x to the n in polynomial p. The x argument can be omitted for polynomials in x.

## cofactor(m,i,j) source

Let c be the cofactor matrix of matrix m, i.e., tranpose(c) = adj(m). This function returns c[i,j].

## conj(z) source

Returns the complex conjugate of z, = conjugate(x).

## contract(a,i,j) source

Returns "a" summed over indices i and j. If i and j are omitted then 1 and 2 are used. contract(m) is equivalent to the trace of matrix m.

## cos(x) source

Returns the cosine of x.

## cosh(x) source

Returns the hyperbolic cosine of x.

## cross(u,v) source

Returns the cross product of vectors u and v.

## curl(u) source

Returns the curl of vector u.

## d(f,x) source

Returns the partial derivative of f with respect to x.

## d(f,x,n) source

Returns the n-order partial derivative of f with respect to x.

## define(f) source

Returns the definition of f

## deg(p,x) source

Returns the degree of polynomial p(x).

## denominator(x) source

Returns the denominator of expression x.

## det(m) source

Returns the determinant of matrix m.

## dim(a,n) source

Returns the cardinality of the nth index of tensor "a".

## do(a,b,...) source

Evaluates each argument from left to right. Returns the result of the last argument.

## dot(a,b,...) source

Returns the dot or inner product of tensors.

## dsolve(eq,y) source

Returns a solution of differential equation.

## draw(f) source

Draws a graph and plot f(x).

## plot(f,x) source

Plot a graph of f(x). Drawing ranges can be set with xrange and yrange.

## eigenvec(m)

These functions compute eigenvalues and eigenvectors numerically. Matrix m must be both numerical and symmetric. The eigenval function returns a matrix with the eigenvalues along the diagonal. The eigenvec function returns a matrix with the eigenvectors arranged as row vectors. The eigen function does not return anything but stores the eigenvalue matrix in D and the eigenvector matrix in Q.

Example 1. Check the relation AX = lambda X where lambda is an eigenvalue and X is the associated eigenvector.

```Enter

A = hilbert(3)

eigen(A)

lambda = D[1,1]

X = Q

dot(A,X) - lambda X

Result

-1.16435e-14

-6.46705e-15

-4.55191e-15
```

Example 2: Check the relation A = QTDQ.

```Enter

A - dot(transpose(Q),D,Q)

Result

6.27365e-12    -1.58236e-11   1.81902e-11

-1.58236e-11   -1.95365e-11   2.56514e-12

1.81902e-11    2.56514e-12    1.32627e-11
```

## erf(x) source

Error function of x.

## erfc(x) source

Complementary error function of x.

## erfi(x) source

imag error function of x.

## evaluate(f,x,a) source

Returns f evaluated at x=a.

## exp(x) source

Returns the exponential of x.

## expand(r) source

Returns the partial fraction expansion of the ratio of polynomials r.

## expcos(x) source

Returns the exponential cosine of x.

## expsin(x) source

Returns the exponential sine of x.

## factor(n) source

Factors integer n.

## factor(p,x)

Factors polynomial p of x. The x can be omitted for polynomials in x. The polynomial should be factorable over integers. The argument list can be extended for multivariate polynomials. For example, factor(p,x,y) factors p over x and then over y.

## factorial(x) source

Can be entered as x!

## factorial2(x) source

Can be entered as x!!

## filter(f,a,b,...) source

Returns f excluding any terms containing a, b, etc.

## float(x) source

Converts rational numbers and integers to floating point values. The symbol pi is also converted.

## floor(x) source

Returns the largest integer not greater than x.

## for(do(a,b,...),i,j,k) source

For i starting from the integer j through to the integer k (inclusive of both ends if they are different, see examples): evaluate a, then evaluate b, etc.
j and k must either be integers or evaluate to integers. Either of them can be negative, and they can be equal, e.g.
...if j < k e.g. j = -1 and k = 1 then i goes through the values -1,0,1
...if j > k e.g. j = 1 and k = -1 then i goes through the values 1,0,-1
...if j = k e.g. j = 3 and k = 3 (or j = -3 and k = -3) then i goes through the only value 3 (or -3, respectively)
The index variable is not clobbered i.e. the original value of the index variable is restored after "for" completes.
The following script uses "for" to compute pi to six digits using Viete's formula ( see http://www.pi314.net/eng/viete.php ).
```x=0
y=2
for(do(x=sqrt(2+x),y=2*y/x), k,1,9)
float(y)
```

## gcd(a,b,...) source

Returns the greatest common divisor.

## hermite(n,x) source

Returns the nth Hermite polynomial in x.

## hilbert(n) source

Returns an n by n Hilbert matrix.

## imag(z) source

Returns the imaginary part of complex z, = im(z)

## inner(a,b,...) source

Returns the inner product of tensors. Same as the dot product.

## integral(f,x) source

Returns the integral of f with respect to x.

## integrate(f,x) source

Returns the integral of f with respect to x, which default variable is x. For example, integrate(f) for integral.

## integrate(f,x,n) source

Returns the n-order integral of f with respect to x. For example, integrate(f,x,2) for double integral.

## integrate(f,x,a,b) source

Returns the definite integral of f with respect to x evaluated from "a" to b. The argument list can be extended for multiple integrals (or "iterated integrals"), for example, a double integral (which can represent for example a volume under a surface), or a triple integral, etc. For example, integrate(f,x,2,a,b).

## inverse(x) source

Returns the inverse of function x.

## isprime(n) source

Returns 1 if n is a prime number, returns 0 otherwise.

## laguerre(n,x,a) source

Returns the nth Laguerre polynomial in x. If "a" is omitted then a=0 is used.

## lcm(a,b,...) source

Returns the least common multiple.

Returns the leading coefficient of polynomial p in x.

## legendre(n,x,m) source

Returns the nth Legendre polynomial in x. If m is omitted then m=0 is used.

## log(x) source

Returns the natural logarithm of x.

## lookup(x) source

Returns the contents of x without evaluating x. E.g.
```x = quote(1+2)
printlist(lookup(x)) # gives (add 1 2)
```

## mod(a,b) source

Returns the remainder of the result of "a" divided by b.

## not(x) source

Returns the logical negation of x.

## nsolve(p,x) source

Returns all of the roots, both real and complex, of polynomial p in x. The roots are computed numerically. The coefficients of p can be real or complex.

## numerator(x) source

Returns the numerator of expression x.

## or(a,b,...) source

Logical-or of predicate expressions.

## outer(a,b,...) source

Returns the outer product of tensors. Also known as the tensor product.

## polar(z) source

Returns complex z in polar form.

## poly(p,..,x) source

Returns the values of x such that p(x)=0. The polynomial p should be factorable over integers. Returns a vector for multiple roots. Individual roots can be obtained using component notation, i.e., poly(1,1,x).

## polyroot(p,x) source

Returns the values of x such that p(x)=0. The polynomial p should be factorable over integers. Returns a vector for multiple roots. Individual roots can be obtained using component notation, i.e., r1=polyroot(p,x).

## psolve(p,x) source

Returns all of the roots, both real and complex, of polynomial p in x. The roots are computed numerically. The coefficients of p can be real or complex.

## prime(n) source

Returns the nth prime number. The domain of n is 1 to 10000.

## product(f,k,i,j) source

For k equals i through j evaluate f = prod(). Returns the product of all f.

## quote(x) source

Returns expression x without evaluating it first.

## quotient(p,q,x) source

Returns the quotient of polynomial p(x) over q(x). The last argument can be omitted for polynomials in x. The remainder can be calculated by p-q*quotient(p,q).

## rank(a) source

Returns the number of indices that tensor "a" has.

## rationalize(x) source

Returns x with everything over a common denominator.

## real(z) source

Returns the real part of complex z, = re(z).

## rect(z) source

Returns complex z in rectangular form.

## shape(x) source

Returns a vector with the "shape" of the input tensor, i.e. a vector with an integer for each dimension (representing the size of each dimension). For example vectors are tensors of one dimension, so a vector with one integer (the length of the vector) is returned. Matrixes are 2-dimensional tensors, so a vector with two integers is returned (rows, columns), etc.

## simplify(x) source

Returns x in a simpler form.

## sin(x) source

Returns the sine of x.

## sinh(x) source

Returns the hyperbolic sine of x.

## symbolsinfo source

Returns info about all the variables in the environment.

## sqrt(x) source

Returns the square root of x.

## subst(a,b,c) source

Substitutes "a" for b in c and returns the result.

## sum(f,k) source

the indefinite sum, evaluate f, the default variable is k. Returns the indefinite sum of f.

## sum(f,k,i,j,step) source

For k equals i through j evaluate f, the default step is 1. Returns the sum of all f.

## tan(x) source

Returns the tangent of x.

## tanh(x) source

Returns the hyperbolic tangent of x.

## taylor(f,x,a,n) source

Returns the Taylor expansion of f(x) around x=a. If "a" is omitted then a=0 is used. The argument n is the degree of the expansion.

## test(solution,eq) source

test solution to equation if it return 0.

## transpose(a,i,j) source

Returns the transpose of "a" with respect to indices i and j. If i and j are omitted then 1 and 2 are used. Hence a matrix can be transposed with a single argument, i.e., transpose(a).

## unit(n) source

Returns an n by n identity matrix.

## zeta(x) source

Returns zeta values. ﻿