Constants, Variables and Keywords

Math Processor allows names to have meaning and/or values. Following are a few terms that Math Processors assigns special meaning to:


A constant is a name that represents a fixed value which cannot be changed. For example PI represents the value of the mathematical constant of the same name. You can always get a list of all the constants by invoking the constants function. Names and values of all the constants are defined below:

PI/pi The mathematical constant PI.
NaN Not a number.
true The Boolean value True.
false The Boolean value False.


A variable is a named piece of information Math Processor can store. It can be a text, a number or array of numbers, a Boolean value or array thereof, a matrix, a plot or some other MP object (new object types can be introduced as new versions are released). You can always get a list of currently defined variables by invoking the vars function. A variable can be created by using the assingment operator. Variable names must begin with a letter or an underscore and may not be a keyword (details of keywords follow).

>> radius = 10
>> 10.0000
>> diameter = radius * 2
>> 20.0000
>> circumference = diameter * PI
>> 62.8319


A keyword is a special word which is reserved by Math Processor for some specifc use. A keyword cannot be used as the name of a variable. Currently there are two keywords used by MP, i.e. ans and return. The details are given below.

ans: This keyword always holds the result of the last calculation that produced numeric or Boolean data. So you can always use this keyword to refer to the result of the previsous calculation.

>> 2 + 6
>> 8.0000
>> ans ^ 2
>> 64.0000

return: This keyword is used to return values from a User Define Function. For more details please refer to User Defined Functions