next up previous contents index
Next: Building functions Up: Functions Previous: Functions   Contents   Index

Functions and scalars

Functions are either read or created.

Most usual functions can be used:

max, min, abs, atan, sqrt,
cos, sin, tan, acos, asin, one,
cosh, sinh, tanh, log, exp
one(xy<0)+ for instance means 1 if xy<0+ and 0 otherwise.

Operators:

and, or, < , <=, < , >=, ==, +, -, *, /, ^
x^2 means x*x

Functions created by a program are displayed only if the key word plot() or plot3d() is used ( here plot(f) ).

Derivatives of functions can be created by the keywords dx() and dy() .

Unless precise is set, they are interpolated so the results is also continuous piecewise linear (or discontinuous when precise is set). Similarly the convection operator convect(f,u1,u2,dt) defines a new function which is approximately

Scalars are also helpful to create functions. Since no data array is attached to a scalar the symbol := is useful to create them, as in

 a:= (1+sqrt(5))/2; 
 f= x*cos(a*pi*y);
Here f is a function, a is a scalar and pi is a (predefined) a scalar.

It is possible to evaluate a function at a point as in a:=f(1,0) Here the value of a will be 1 because f(1,0) means f at x=1 and y=0 .


next up previous contents index
Next: Building functions Up: Functions Previous: Functions   Contents   Index
build daemon 2001-10-22