Functions are either read or created.
f=x*y
really means that f(x,y)=x*y
for all x
and y
. Here x
and y
refer
to the coordinates in the domain represented by the triangulation.
g=sin(x*y); f=exp(g);
.
x, y, iv, t
:
nx, ny, ib, region
.
Most usual functions can be used:
max, min, abs, atan, sqrt, cos, sin, tan, acos, asin, one, cosh, sinh, tanh, log, exp
one(x
y<0)+ for instance means 1
if x
y<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
.