|
Topics with
|
Topic 5 – Functions: Defining, Evaluating and Graphing
Material
originated in 2000 by Seattle Central Community College Let’s begin. Section 1: Defining and Clearing a Function in Maple Take note of the syntax here. It is absolutely
necessary to type the "arrow"
- > made by typing a
"minus sign" and a "greater than" symbol. Maple will not
define a function if you type f(x):=cos(Pi*x)+3
; Below is a comparison of an expression and a function.
Note the difference in syntax and how Maple returns the output for
each. Functions always require an arrow when typing in; Maple
should also have an arrow in its output.
Always check the output for the arrow to confirm that you have in
fact defined a function. Practice
Problem 1
Once you have defined a function, Maple will remember
that function during your entire working session. If you want to overwrite the function with a new definition,
you simply retype the definition. For
example, if you want to replace the function f(x) above with ln(cos 5x),
type: We can confirm the current value for the function
f(x) : If you want to clear the function f(x) without
redefining it, type: It's always a good idea to clear your functions when
you start a new problem. Alternatively you can use restart to clear everything
from memory. Section 2: Evaluating a Function If more than one function is involved, composing
functions is easy to do. Practice
Problem 2 s(2),and
s(t-3) and s(t) - s(3) and simplify your results. Don't forget the arrow
notation!
> s(2); > s(t - 3);
> simplify
(%);
> s(t)
- s(3);
> simplify(%);
Notice that if you define a function, there is no need
to evaluate the function using the "subs" command like you do with
expressions. Section 3: Solving Equations involving Functions Once
your function is defined, you can solve equations with functions either
exactly or approximately: Section 4: Graphing a Function Several functions can be graphed simultaneously just at
we did for expressions. Consider
the function
Practice
Problem 3
> h:=x->x+1;
>
plot([g(x),h(x)],x=-5..5,y=-20..20);
> plot([g(x),h(x)],x=1..2,y=1..4);
b) An estimated value for the point of intersection is
(1.5, 2.4). c) > xval:=fsolve(g(x)=h(x),x);
The solution to g(x)=h(x) is the x-coordinate of the
point of intersection of g(x) and h(x). To find the corresponding
y-coordinate of the intersection point evaluate either g(x) or h(x) at this
value.
> h(xval);
The solution found by fsolve( ) is the exact value of the estimated point of intersection in part b). It is a solution to the system of equations. |