The Type System
Each mathematical
object form has a type.
See Mathematical
Objects . The nine types of mathematical objects with their abbreviations,
are:
Expression (ex) Recursively defined as forms constructed from numbers, variables, function statements (where the functions are of expression type), program statements, and indexed vector or matrix statements.
Vector #n (ve #n) (These are input as: [ x1, x2, ..., xn ] with commas separating entries.) Vectors must also specify dimension in
declarations and definitions, by following the vector or ve keyword with the symbol #n. If n is a positive integer, it is the dimension. If n=0, then the dimension
is arbitrary.
Matrix (ma) (These are matrices)
Function (fn) (These have the usual meaning: they take arguments and return values)
Variable (va) (These are names that evaluate to themselves)
String (st) (These are input as: "This is a string")
List (li) (These are input as: list(x1, x2, ..., xn) with commas separating entries.)
Equation (eq) (These are input as: U = V) where U and V are expressions.
Constant (co) (This is a built-in type)
When objects are combined to produce forms, the type is determined by rules that reflect common mathematical conventions. For
example, the type of sin^2+1 is functon. The type of 3*[a,b,c] is vector, the type of [1,2,3]#[a,b,c] is expression (the dot product), and so on.
Functions are defined with explicit or implicit return types. Then function application statements such as f(x,y) automatically have the return type.
For example, if a curve is defined (with implicit vector return type) by:
make c(t) [cos(t), sin(t)], or c(t) := [cos(t), sin(t)] then the type of c(pi) is vector #2.
If the constituents of a form are numbers, variables, strings, program statements, or expressions, then the
form will be of type expression. Thus, polynomial or rational function statements, built-in mathematical
function statements, etc. will generate forms of type expression. On the other hand, if the form contains vector, list, equation or function objects, then the type of the form will be one of the latter, depending on
the actual case.
Expressions and Strings are catch-all category for generic forms.
If a function, command, or program expects an expression argument,
it will accept any type except string.
If a function, command, or program expects a string argument,
it will accept any type at all.
If it expects a list it will accept an equation.
If it expects a vector it will accept a variable.
If it expects a vector of dimension 0, it will accept an expression.
If it expects a constant it will accept an expression.
If it expects an equation it will accept an expression.