FUNCTIONS VS EXPRESSIONS

In MAPLE, you can work with either expressions or functions. Sometimes one format is easier to work with, and sometimes the other. Below we illustrate how to set up, evaluate, and graph each. First we'll look at expressions, then a function, and then illustrate how to turn an expression into a function.

EXPRESSIONS:

> y:=x^2;

y := x^2

> subs(x=3, y);

9

> plot(y, x=-5..5);

[Maple Plot]

FUNCTIONS:

> f:=x->x^2;

f := proc (x) options operator, arrow; x^2 end proc...

> f(3);

9

> plot(f(x), x=-5..5);

[Maple Plot]

EXPRESSION TO FUNCTION CONVERSION:

> g:=unapply(x^2, x);

g := proc (x) options operator, arrow; x^2 end proc...

> g(3);

9