Section 1.6 Session: creating simple functions

> restart;

> x:=2.1; <- Assign x a value

[Maple Math]

We can define an expression to square x by:

> fe:=x^2; <- fe is an expression that gives the square of x which at present has the value 2.1.

[Maple Math]

We might also try:

> fe2(x):=x^2; <- fe2 is also an expression but it looks like a function.

[Maple Math]

Now: compare fe to fe2 when we give x a new value:

> x:=3.5;

[Maple Math]

> fe; <- fe does not change.

[Maple Math]

> fe2(x); <- fe2 does not act like x squared.

[Maple Math]

> fe2(2.0); <- the argument is shown but no evaluation as a function takes place.

[Maple Math]

> evalf(fe2(x)); <- even using evalf does not help.

[Maple Math]

> f:=x->x^2; <- Here is one way to define a function. The arrow is a minus sign followed by a greater than sign: ">".

The "x" used in its definition is a dummy argument.

[Maple Math]

> f(x); <- f maps x to the square of x (but x still has the value 3.5).

[Maple Math]

> f(t); <- It maps t to the square of t

[Maple Math]

> f(2.5); <- It maps any number into the square of that

number

[Maple Math]

>