Boolean
Boolean is the simplest of all variable types, it can only be either
true or
false.
Complex
This is the common type for numbers, both the real part and the imaginary part can be either
an exact ratio of two arbitrary sized integers or a floating point value.
When speed is wanted one should type numbers as 2.0 and not 2, because this forces
Ump to use floating points for the value and not a ratio.
To be able to write a complex number the constant
i is defined as sqrt(-1).
String
This variable type contain a text string that can be evaluated as a mathematical expression.
It's created by typing for instance s = "text number one" s2 = "text number two"
These String's can later be merged by typing s3 = s + s2 equals to "text number onetext number two"
A number can also be merged with a String. s + 342.567 equals to "text number one342.567"
It's also possible to extract parts of a String.
s3[5] equals to "n"
s3[5,14] equals to "number onetext"
It's also possible to replace a part of a string with another string.
s3[5,14] = "#1 string" sets s3 to "text #1 string number two
To create a mathematical expression type f = "3 * sin(pi*x)"
To evaluate this just type f(0.7) which will equal to 3 * sin(pi*0.7)=2.42705
"x^2 + y"(3,4) gives you the answer 3^2 + 4 = 13.
Matrix
This variable type handles matrices of Complex elements and several functions are builtin in Ump.
A matrix is created using hard brackets[] or by using
matrix.
First is one bracket pair around the whole matrix,
then one bracket pair around every row in the matrix.
The elements on one row is separated by ,
E.g. [[5,8+6][3,0][7*x,1]] creates a matrix with three rows and two columns
i.e. a 3x2-matrix.
By typing a hard bracket directly after a matrix one can get/set a specific element.
m = [[1,2][3,4]]
m[1,1] equals 1, m[2,1] equals 3 ... m[row,column]
m[1,1] = 7 gives you a m-matrix which is [[7,2][3,4]]
Matrices is also used when a
color or
coordinate should be specified.
Array
The most common usage of arrays is when a function needs more than one argument.
An array of variables are then created and sent
to the function which then extracts the variables from the array.
To create an array use
array or
just divide a round bracket pair with ,
E.g. a = (300, pi, "a string") a[1] then equals pi
To change one variable inside an Array you just types a[1] = "the new important variable"
Picture
As the name suggest this variable type handles pictures.
See function
picture how to create.