Tutorial:JMathLab/6 Commands and Operators
From HandWiki
Commands and Operators
Commands are used for setting modes and options. In contrast to functions, arguments my be supplied without parenthesis. Only one command per text input is allowed.
format
short long
display format for floatingpoint numbers: 5 digits, all digits or in BASE with COUNT digits.
syms
Declare symbolic variable. In some cases, one should assume that the code contains symbolic evaluation (like "rat" function). In this case you can keep this keyword but comment it out:
<jc lang="math"> syms x a=x*2 printf("%f",a) </jc>
clear
Clear a given variable from memory
who
Shows variables in the memory
path
Print all available functions
Operators
This table shows operators. Operations are executed according to their precedence (prec), and, if these are equal, in order.
Function | Syntax | Prec | Order |
---|---|---|---|
Addition | x + y | 4 | left-right |
Subtraction | x - y | 4 | left-right |
Scalar Multiplication | x .* y | 3 | left-right |
Vector/Matrix Multiplication | x * y | 3 | left-right |
Scalar Division | x ./ y | 3 | left-right |
Matrix Division (right) | x / y | 3 | left-right |
Matrix Division (left) | x \ y | 3 | left-right |
Scalar Exponentiation | x .^ y |
1 | left-right |
Vector/Matrix Exponentiation | x ^ y |
1 | left-right |
Range | x:y:z | 5 | left-right |
Assignment | x = z | 10 | right-left |
Assignment | x += z | 10 | right-left |
Assignment | x -= z | 10 | right-left |
Assignment | x /= z | 10 | right-left |
Assignment | x *= z | 10 | right-left |
Preincrement | ++x | 10 | left-right |
Predecrement | --x | 10 | left-right |
Postincrement | x++ | 10 | right-left |
Postdecrement | x-- | 10 | right-left |
Adjunct | x' | 1 | right-left |
Factorial | x! | 1 | left-right |