next up previous contents
Next: Exercise 2 (Variables) Up: Working with Jasymca Previous: Example: Functions

Variables

Variables are declared by supplying a name and value in the format name=value. The name can be any charactersequence. With the exception of the first character it may also contain numbers. The value is any number or expression.
>> x=24+3i
x = 24+3i

Some variables are predefined (like pi). The last previous result of a calculation is stored in the variable ans. All variables are displayed by the command who. Single variables can be deleted by entering clear variable.

It is possible to define variables whose value is a function. In this case the function's name must be preceded by the character $ to suppress evaluation. These variables can be used like the function they stand for. For example, who dislikes the builtin function realpart(x)'s name can shorten it to the Matlab-version:

>> real=$realpart
$realpart
>> real(24+3i)
ans = 24


Subsections

Helmut Dersch
2009-03-15