# Numeric Catalog

Math plus ultra is a graphing programable calculator with a large set of functions that features:

• The manipulation of numeric and symbolic expressions.
• The development of customized functions.
• The creation of 2D and 3D graphs, including plots, contours and surfaces.
• Matrix and complex calculus.
• Integration and differentiation of numeric and symbolic functions.

# Algebra

## lsolve

lsolve(L, b)
Solves linear equation systems by using forward substitution and returns a column vector.

## lup

lup(A)
Returns the matrix LU decomposition. It calculates this decomposition with partial pivoting.

## lusolve

lusolve(A, b)
Returns the column vector that solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.

## slu

slu(A, order, threshold)
Returns the LU decomposition of a sparse matrix. It calculates this decomposition with full pivoting.

## usolve

usolve(U, b)
Solves a linear equation system by using backward substitution and returns a column vector.

# Arithmetic

## abs

abs(x)
Returns the absolute value of a number.

Calculates the sum of two or more values.

## cbrt

cbrt(x [, allRoots])
Returns the cubic root of a value.

## ceil

ceil(x)
Rounds a value towards positive infinity.

## cube

cube(x)
Computes the cube of the parameter x.

## divide

divide(x, y)
Computes the division between x and y.

## dotDivide

dotDivide(x, y)
Divide each element of matrix x with its analogous element in matrix y.

## dotMultiply

dotMultiply(x, y)
Multiply each element of matrix x with its corresponding element in matrix y.

## dotPow

dotPow(x, y)
Calculates the power of each element of matrix x with its analogous element in matrix y.

## exp

exp(x)
Calculates the exponent of a value or matrix.

## fix

fix(x)
Rounds a value to the nearest integer towards zero.

## floor

floor(x)
Rounds a value to the nearest integer less or equal to it.

## gcd

gcd(a, b)
Returns the greatest common divisor between two or more values.

## hypot

hypot(a, b, …)
Returns the hypotenuse of a list of values.

## lcm

lcm(a, b)
Returns the least common multiple between two or more values.

## log

log(x [, base])
Returns the logarithm of a number, according to its base. If the base is not provided it calculates the natural logarithm of the value.

## log10

log10(x)
Returns the common logarithm or 10-base logarithm of a value.

## mod

mod(x, y)
Returns the remainder after the division of x by y.

## multiply

multiply(x, y)
Multiply the values x and y.

## norm

norm(x [, p])
Returns the norm of a number, vector or matrix.

## nthRoot

nthRoot(a)
Returns the nth root of a value.

## pow

pow(x, y)
Raises element x to the power of element y.

## round

round(x [, n])
Rounds x to the nearest integer.

## sign

sign(x)
Determines the sign of a value. It could be 1 when x >1, -1 when x < 0 and 0 when x ==0.

## sqrt

sqrt(x)
Returns the square root of an element.

## square

square(x)
Returns the square of an element.

## subtract

subtract(x, y)
Computes the subtraction of x and y.

## unaryMinus

unaryMinus(x)
Negates the value of an element.

## unaryPlus

unaryPlus(x)
Returns the positive value of an element.

## xgcd

xgcd(a, b)
Returns the extended greatest common divisor between two values.

# Bitwise

## bitAnd

bitAnd(x, y)
Returns the bitwise logical operation AND, x & y.

## bitNot

bitNot(x)
Returns the bitwise logical operation NOT of x.

## bitOr

bitOr(x, y)
Returns the bitwise logical operation OR, x | y.

## bitXor

bitXor(x, y)
Returns the bitwise logical operation XOR, x ^ y.

## leftShift

leftShift(x, y)
Returns the left logical shift of x by a y number of bits.

## rightArithShift

rightArithShift(x, y)
Returns the right arithmetic shift of x by a y number of bits.

## rightLogShift

rightLogShift(x, y)
Returns the right logical shift of x by a y number of bits.

# Calculus

## deriv

deriv(f,x)
Returns the point differential of a function f at a point x. It only supports one-dimensional functions. Example: deriv(f(x)=2*x^2+1,10).

## integral

integral(f,a,b)
Calculates a definite integral using the Simpsons rule with adaptative quadrature. Calculates the definite integral of a function f regarding x evaluated from a to b. Example: integral(f(x)=2*x+1,0,10).

## LimL

LimL(f,x)
Calculates the limit of a function f, at a point x approaching from the left. Example: LimL(f(x)=x^2,7).

## LimM

LimM(f,x)
Calculates the limit of a function, f, at a point x approaching from the middle (left and right). Example: LimM(f(x)=x^2,7).

## LimR

LimM(f,x)
Calculates the limit of a function f, at a point x approaching from the right. Example: LimR(f(x)=x^2,7).

# Combinatorics

## bellNumbers

bellNumbers(n)
The Bell numbers count the number of partitions in which a set of n elements can be divided.

## catalan

catalan(n)
Enumerates a sequence of natural numbers which is very important in combinatorial mathematics since it appears in several counting problems.

## composition

composition(n, k)
The composition counts of n into k parts.

## stirlingS2

stirlingS2(n, k)
Counts the number of ways in which a set of n labelled objects could be partitioned into k nonempty subsets.

# Complex

## arg

arg(x)
Calculates the argument of a complex number.

## conj

conj(x)
Calculates the conjugate of a complex number.

## im

im(x)
Returns the imaginary part of a complex number.

## re

re(x)
Returns the real part of a complex number.

# Geometry

## distance

distance([x1, y1], [x2, y2])
Calculates the Euclidean distance between two points in 2D or 3D spaces.

## intersect

intersect(endPoint1Line1, endPoint2Line1, endPoint1Line2, endPoint2Line2)
Calculates the point of intersection between two lines for 2D and 3D spaces. Calculates the point of intersection of a line and a plane for 3D space.

# Logical

## and

and(x, y)
Logical operator AND.

## not

not(x)
Logical operator NOT.

## or

or(x, y)
Logical operator OR.

## xor

xor(x, y)
Logical operator XOR.

# Matrix

## concat

concat(a, b, c, … [, dim])
Concatenates two or more matrices according to a specified dimension.

## cross

cross(x, y)
Evaluates the cross product of two vectors in 3D space.

## det

det(x)
Returns the determinant of a matrix.

## diag

diag(X)
Creates a diagonal matrix or returns the diagonal of a matrix. When x is a vector, the function returns a matrix with elements of x on the main diagonal.

## dot

dot(x, y)
Return the dot product between two vectors.

## eye

eye(n)
Returns a 2D identity matrix with size m x n or n x n.

## filter

filter(x, test)
Filters the items in an array or one-dimensional matrix according to a function or regular expression.

## flatten

flatten(x)
Transforms a multidimensional matrix into a single dimensional matrix.

## forEach

forEach(x, callback)
Executes a callback function for each element of the matrix/array.

## inv

inv(x)
Returns the inverse of a square matrix.

## map

map(x, callback)
Creates a new matrix or array with the results of the callback function executed on each item of the array or array.

## ones

ones(m, n, p, …)
Creates a matrix or array filled with ones.

## partitionSelect

partitionSelect(x, k)
Finds the smallest kth element on a 1D matrix and partitions the array around it.

## range

range(start, end [, step])
Returns an array of values created from a range.

## resize

resize(x, size [, defaultValue])
Changes the size of a matrix.

## size

size(x)
Returns a vector whose elements denote the length of x (x can be a matrix or scalar).

## sort

sort(x)
Sort the items in matrix x.

## squeeze

squeeze(x)
Squeeze a matrix by removing its singleton dimensions.

## subset

subset(x, index [, replacement])
Returns a subset of a matrix or string.

## trace

trace(x)
Calculates the trace of a matrix by adding its main diagonal elements.

## transpose

transpose(x)
Returns the transpose of a matrix.

## zeros

zeros(m, n, p, …)
Creates a matrix full of zeros.

# Probability

## combinations

combinations(n, k)
Returns the number of possible combinations of obtaining an unordered subset of k elements from a set of n objects.

## factorial

factorial(n)
Returns the factorial of a value. This function only supports an integer value as input.

## gamma

gamma(n)
Returns the gamma function of a value. It uses Lanczos approximation for small values and an extended Sterling approximation for larger ones.

## kldivergence

kldivergence(x, y)
Computes the Kullback-Leibler divergence between distribution x and distribution y.

## multinomial

multinomial(a)
Calculates the number of ways to choose a1, a2, …, ai unordered outcomes from n possibilities.

## permutations

permutations(n [, k])
Calculates the number of ways an ordered subset of k elements can be obtained from a set of n elements.

## pickRandom

pickRandom(array)
Returns a random value from a 1D array.

## random

random([min, max])
Returns a random value that is restrained between the interval [min max] and follows a uniform distribution.

## randomInt

randomInt([min, max])
Returns a random integer value that is restrained between the interval [min max] and follows a uniform distribution.

# Plot

Adds a f (x) function to the graph list.

Adds a parametric function to the graph list.

Adds a polar function to the graph list.

plot

plot()
Creates a 2D plot with the functions in the plot list.

## plotXY

plotXY(X,Y)
Creates a 2D plot of X vs Y where X and Y are vectors.

## setX

setX(Xmin,Xmax)
Sets the X axis limits for the function plot.

## setY

largerEq(Ymin, Ymax)
Sets the Y axis limits for the function plot.

## surf

surf(f(x,y) = sin(sqrt((x)^2+(y)^2)),-10:0.25:10,-10:0.25:10)
Returns a 3D surface plot.

# Program

## forEach

forEach(a,f(x)=eval(i=i+x))
Executes a callback function for each element of the matrix/array.

## eval

eval(expr) or eval([expr1, expr2, expr3, …])
Evaluates an expression.

## exportVar

exportVar(varName, varValue)
Exports a variable to the global scope.

# Relational

## compare

compare(x, y)
Compares x and y. Returns 1 when x > y, -1 when x < y and 0 when x==y.

## deepEqual

deepEqual(x, y)
Compares two matrices element wise to determine if they are equal.

## equal

equal(x, y)
Checks if two values are equal.

## larger

larger(x, y)
Checks whether value x is larger than value y.

## largerEq

largerEq(x, y)
Checks whether value x is larger or equal to value y.

## smaller

smaller(x, y)
Checks whether value x is smaller than value y.

## smallerEq

smallerEq(x, y)
Checks whether value x is smaller or equal to value y.

## unequal

unequal(x, y)
Checks whether two values are unequal.

# Statistics

## max

max(a, b, c, …)
Calculates the maximum value of a matrix or a list of values.

## mean

mean(a, b, c, …)
Calculates the mean value of a matrix or a list of values.

## median

median(a, b, c, …)
Calculates the median of a matrix or a list of values.

## min

min(a, b, c, …)
Calculates the minimum value of a matrix or a list of values.

## mode

mode(a, b, c, …)
Calculates the mode of a set of numbers.

## prod

prod(a, b, c, …)
Calculates the product of a matrix or set of values.

## quantileSeq

quantileSeq(A,  prob[, sorted])
Compute the prob order quantile of a matrix or a list with values.

## std

std(a, b, c, …)
Calculates the standard deviation of a matrix or set of values.

## sum

sum(a, b, c, …)
Calculates the sum of a matrix or a set of values.

## var

var(a, b, c, …)
Calculates the variance of a matrix or set of values.

# Trigonometry

## acos

acos(x)
Returns the inverse cosine or arccosine of a value.

## acosh

acosh(x)
Returns the hyperbolic arccosine of a value, which is defined as acosh(x) = ln(sqrt(x^2 – 1) + x).

## acot

acot(x)
Returns the inverse cotangent or arc cotangent of a value, which is defined as acot(x) = atan(1/x).

## acoth

acoth(x)
Returns the hyperbolic arc cotangent of a value, which is defined as acoth(x) = atanh(1/x) = (ln((x+1)/x) + ln(x/(x-1))) / 2.

## acsc

acsc(x)
Returns the inverse cosecant or arc cosecant of a value, which is defined as acsc(x) = asin(1/x).

## acsch

acsch(x)
Returns the hyperbolic arc cosecant of a value, which is defined as acsch(x) = asinh(1/x) = ln(1/x + sqrt(1/x^2 + 1)).

## asec

asec(x)
Returns the inverse secant or arc secant of a value.

## asech

asech(x)
Returns the hyperbolic arc secant of a value, which is defined as asech(x) = acosh(1/x) = ln(sqrt(1/x^2 – 1) + 1/x).

## asin

asin(x)
Returns the inverse sine or arcsine of a value.

## asinh

asinh(x)
Returns the hyperbolic arcsine of a value, which is defined as asinh(x) = ln(x + sqrt(x^2 + 1)).

## atan

atan(x)
Returns the arctangent or inverse tangent of a value.

## atan2

atan2(y, x)
Returns the inverse tangent function given two arguments, y/x

## atanh

atanh(x)
Returns the hyperbolic arctangent of a value, which is defined as atanh(x) = ln((1 + x)/(1 – x)) / 2.

## cos

cos(x)
Returns the cosine of a value

## cosh

cosh(x)
Returns the hyperbolic cosine of a value, which is defined as cosh(x) = 1/2 * (exp(x) + exp(-x)).

## cot

cot(x)
Returns the cotangent of a value.

## coth

coth(x)
Returns the hyperbolic cotangent of a value, which is defined as coth(x) = 1 / tanh(x).

## csc

csc(x)
Returns the cosecant of a value, which is defined as csc(x) = 1/sin(x).

## csch

csch(x)
Returns the hyperbolic cosecant of a value, which is defined as csch(x) = 1 / sinh(x).

## sec

sec(x)
Returns the secant of a value, which is defined as sec(x) = 1/cos(x).

## sech

sech(x)
Returns the hyperbolic secant of a value, which is defined as sech(x) = 1 / cosh(x).

## sin

sin(x)
Returns the sine of a value.

## sinh

sinh(x)
Returns the hyperbolic sine of a value, which is defined as sinh(x) = 1/2 * (exp(x) – exp(-x)).

## tan

tan(x)
Returns the tangent of a value.

## tanh

tanh(x)
Returns the hyperbolic tangent of a value, which is defined as tanh(x) = (exp(2 * x) – 1) / (exp(2 * x) + 1).