Register Login



Directives

A directive is a command to Math Processor engine to carry out specific tasks. Directives mostly control the engine's behavior and state. A directive may also expect one or more arguments. Furthermore, an add-on or GUI component can also implement directives related to the job they perform.

The following directives are defined in this section:

01. load 02. postfix 03. remove 04. removeall
05. reset 06. resetall

Explanation of each of these is as under:

load

Allows to load a text file containg Math Processor commands. Can be used in two forms.

  1. Pass the path of the file to be loaded as a paramter to the directive.
  2. Call without parameters to get an Open File Dialogue to select a file.

The given path can be full as well as relative. Path should be put inside quotes when it contains spaces and folder names. Following are a couple of examples showing the use of this directive:

>> load example.txt
>> load "Examples/plot.txt"
>> load "C:\\Examples\\plot.txt"
>> load "C:/Examples/plot.txt"

Please note that in the third example, each backslash ('\') had to be escaped with an additional backslash. You can avoid escaping by just using the forward slash (/) as path seperator. For further information on saving MP commands in text files, please refer to Batch Processoing.

postfix

Shows postfix conversion of infix expression. The postfix form is not checked for errors in the infix expression (i.e. infix should be error-free to get error-free postfix equivalent).

Remember that Math Processor uses variable length arguments for many of its functions. For this purpose, number of arguments is made part of postfix conversion while processing functions.

>> postfix 2+6*9
>> 2 6 9 * +
>> postfix sum(3, 4, 6 + -9)
>> 3 4 6 9 u- + 3 sum

In the second example, the number 3 before 'sum' in the postfix form tells about the number of arguments passed to this function. The prefix 'u' in 'u-' signifies that this operator is unary (i.e. only to be applied to a single operand) as opposed to the subtration operator.

remove

Removes the passed variable name(s) from defined variable list. If any of the names passed is not either a variable or is constant, it is ignored.

Examples:

>> remove a
>> remove b c d

removeall

Removes all variables and user defined functions from defined variable list. Constants and inbuilt functions are unaffected.

reset

Resets the passed variables to NaN (Not a Number). If an argument is not a defined variable or is constant, it is simply ignored.

resetall

Resets all the variables to NaN (Not a Number).