# Function Reference

Algebrite v.1.2.0 (latest-stable) / Page revision: 1

Complex number functions`
arg
conj
imag
abs
polar
real
rect
`

Linear algebra functions`
abs
adj
cofactor
contract
det
dot
inv
outer
transpose
unit
zero
`

Calculus functions`
circexp
defint
d
eval
integral
taylor
`

Polynomial functions`
coeff
deg
eval
expand
factor
leading
nroots
quotient
roots
`

Special functions`
besselj
bessely
hermite
laguerre
legendre
`

Scripting`
do
for
product
stop
sum
test
`

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).
Logical-and of predicate expressions.

Returns the inverse cosine of x.

Returns the inverse hyperbolic cosine of x.

Returns the inverse sine of x.

Returns the inverse hyperbolic sine of x.

Returns the inverse tangent of x.

Returns the inverse hyperbolic tangent of x.

Returns the angle of complex z.

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

Bessel function of second kind.

Returns the smallest integer not less than x.

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

Returns the number of combinations of n items taken k at a time.

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

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

Completely wipes all variables from the environment.

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

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

Returns the complex conjugate of z.

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.

Returns the cosine of x.

Returns the hyperbolic cosine of x.

Returns the cross product of vectors u and v.

Returns the curl of vector u.

Returns the partial derivative of f with respect to x. x can be a vector e.g. [x,y].

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, defint(f,x,a,b,y,c,d).

Returns the degree of polynomial p(x).

Returns the denominator of expression x.

Returns the determinant of matrix m.

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

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

Returns the dot or inner product of tensors.

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

`eigenval(`*m*)

`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[1]
dot(A,X) - lambda X
*Result*
-1.16435e-14
-6.46705e-15
-4.55191e-15

Example 2: Check the relation A = Q^{T}DQ.

*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

Error function of x.

Complementary error function of x.

Returns f evaluated at x=a.

Returns the exponential of x.

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

Returns the exponential cosine of x.

Returns the exponential sine of x.

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.

Can be entered as x!

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

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

Returns the largest integer not greater than x.

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)

Returns the greatest common divisor.

Returns the nth Hermite polynomial in x.

Returns an n by n Hilbert matrix.

Returns the imaginary part of complex z.

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

Returns the integral of f with respect to x.

Returns the inverse of matrix m.

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

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

Returns the least common multiple.

Returns the leading coefficient of polynomial p in x.

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

Returns the natural logarithm of x.

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

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

Returns the logical negation of x.

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.

Returns the numerator of expression x.

Logical-or of predicate expressions.

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

Returns complex z in polar form.

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

Evaluate expressions and print the results. The "style" of printing is the same as "printcomputer".
Useful for example for printing from inside a "for" loop.

Evaluate expressions and print the results. The expressions are laid out spacially, as if printed with a teletype. Useful for consoles and where fancy latex output can't be visualised.
Useful for printing from inside a "for" loop.

Evaluate expressions and print the results. The style of printing is "computer-frendly", all symbols and operations are printed.
Useful for printing from inside a "for" loop.

Evaluate expressions and print the results, as latex.
Useful for printing from inside a "for" loop.

Evaluate expressions and print the results. Each list of the expression tree is fully laid out. Useful to have an accurate idea of the internal representation.
Useful for printing from inside a "for" loop.

Evaluate expressions and print the results, with some human-friendly shortcuts such as omitting the product signs.
Useful for printing from inside a "for" loop.

For i equals j through k evaluate f.
Returns the product of all f.

Returns expression x without evaluating it first.
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).

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

Returns x with everything over a common denominator.

Returns the real part of complex z.

Returns complex z in rectangular form.

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=roots(p,x)[1].

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.

Returns x in a simpler form.

Returns the sine of x.

Returns the hyperbolic sine of x.

Returns info about all the variables in the environment.

Returns the square root of x.

In a script, it does what it says.

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

For i equals j through k evaluate f.
Returns the sum of all f.

Returns the tangent of *x*.

Returns the hyperbolic tangent of *x*.

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.
If "a" is true then b is returned
else if c is true then d is returned, etc.
If the number of arguments is odd then the last argument is returned
when all else fails.
Use A=B to test that A equals B.

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).

Returns an n by n identity matrix.

Returns a null tensor with dimensions i, j, etc.
Useful for creating a tensor and then setting the component values.

Prints out version.