Mathematical functions of one or more variables can be defined in Maple. The function can be evaluated at either numerical or symbolic expressions. For example
> f:=x->sin(x)/x;
sin(x)
f := x -> ------
x
> f(2.0);
.4546487134
> f(t);
sin(t)
------
t
Functions can be graphed with the plot command which
has the following syntax.
That means, that the function will be drawn on the interval
to
.
Try this now
> plot(f,-12..12);
An example of a function in two variables
> g:=(x,y)->(x^2-y^2)/(x^2+y^2);
2 2
x - y
g := (x,y) -> -------
2 2
x + y
> g(1,2);
-3/5
> g(1,x);
2
1 - x
------
2
1 + x
Functions of two variables can be graphed with the plot3d command
> plot3d(g, -1..1, -1..1);
The examples above are plots of functions. The other possibility is to graph an expression. The syntax and examples for plotting expressions is
> plot( sin(x)/x, x=-12..12 ); > plot3d( (x^2-y^2)/(x^2+y^2), x=-1..1, y=-1..1 );