 Application Center - Maplesoft

# Algebra module 4: functions

You can switch back to the summary page by clicking here.

0104.mws

Module 1 : Algebra

104 : Functions

_________________________________________________________________________________________

A. Function Notation

_________________________________________________________________________________________

FUNCTION DEFINITION

The way you define functions in Maple is slightly different that what you might expect. This underscores the fact that a function is more than just a formula. The concept of a function is a process that takes one number (x, the independent variable ) is transforms it into another (y, the dependent variable) , often by way of a formula. Maple reinforces the idea of the transformation by its notation.

> f := x -> 3*x^2 + x + 7; Here is another function - this time a linear function

> g := x -> 12*x - 31; FUNCTION EVALUATION

Once you have defined the function, you can evaluate it with large and small numbers, fractions, and irrational numbers.

> f(1); f(10000);  > f(4/5); f(7+3/11);  > f(sqrt(17)); f(.00004);  You can even evaluate the function with other variables, expressions, or functions.

> f(a); f(R - T);  > f(x-3); f( f(x) );  A1 Define the function g(x) : = x/(x-3) and evaluate it

A. Determine the value of g(0), g(4), g(2), and g(3).
B. Why didnt you get an answer for g(3)?
C. Evaluate g(2.9999) and g(3.0001), and make a guess about g(3);
D. g(1,000,000) (Remember : Do not type commas in numbers in Maple)

_________________________________________________________________________________________

B. Domain & Range

_________________________________________________________________________________________

There are several ways to see what a function does to a finite set of numbers. Here we define a domain of integers, and then apply the function to each member of the domain using the map command.

- Here we define a function

> f := x -> 3*x^2 + x + 7; - a domain consisting of a sequence,

> Domain := [ k \$ k = -10..10 ]; - and create a range by applying or 'mapping' the function to the domain

> Range := map ( f, Domain); An even nicer way to view what a function does to see how it transforms different numbers at once. To do this, we will create an array where we can see the domain and range at the same time.

- The value of k from 1 to 10 will be the x values.

> array( [[ k,f(k) ] \$ k = 1..10] ); It may be easier for you to see the entire array at once, if you change the viewing size by going to the VIEW menu, and select ZOOM FACTOR, then 75%. There are also key commands to change the zoom setting.

B1. Define the function f(x) = 1/x2, copy and paste the map and array commands above and re-execute them to see the affect of this function.

B2.

A. Create an array for the functions x4, (x-1)4, (x-2)4 for the domain of numbers :
-8, -7, ...-2,-1,0,1,2,...,7,8 by defining f(x) = x4 and using the command
> array( [[ f(k), f(k-1), f(k-2) ] \$ k = 8..8] );
B. How are the numbers in the first two columns related?
C. How are the numbers in the last two columns related?
D. Can you guess what the numbers of the form (x-3)^4 would look like?

_________________________________________________________________________________________

C. Function Operations and Composites

_________________________________________________________________________________________

You can also combine functions algebraically in a number of ways. First we define two functions, f(x) and g(x) to use in our unethical experiments.

> f := x -> 1 +2/x; > g := x -> x/(x-3); First, we'll compute the sum of the functions. We are using the simplify command to simplify the result. The % key is a shortcut for the most recently computed result.

What you see in the output is the original and the simplified version of the sum of f(x) and g(x).

> f(x) + g(x); simplify(%);  Now, we look at the sum, difference, product, and quotient of two functions. These operations are performed exactly the same way that you would do them with numbers using the +,-,*, and / keys for add, substract, multiply and divide. the way we are doing it in Maple here is slightly more complicated but the output is much nicer.

> f(x) + g(x): % = simplify(%); > f(x) - g(x): % = simplify(%); > f(x) * g(x): % = simplify(%); > f(x) / g(x); % = simplify(%);  We can also compute a "linear combination" of functions.

> 7*f(x) + 12*g(x): % = simplify(%); ...and even compositioned of the functions.

> f(g(x)): % = simplify(%); > g(f(x)): % = simplify(%); > f(f(x)): % = simplify(%); > g(g(x)): % = simplify(%); C1 Define the functions f(x) = 3x2 + x + 7 and g(x) = (x+1)/(x-2), then compute and simplify

A. f(x) + g(x) B. f(g(x)) C. 20g(x) + 1/f(x)
D. g(f(x)) E. f (f(x) + g(x) ) F. f(g( f(x) ))
G. g( 1/f(x) ) H. f(x+3) - f(x-3) I. (g(x+h) -g(x) )/h
J. (f(x)-f(a))/(x-a) K. (f(g(x)) f(g(a)) ) / (x - a)

_________________________________________________________________________________________

D. Vertical Line Test

_________________________________________________________________________________________

When you are looking at the graph of a relation, the way to determine if its a function or not is to use the "Vertical Line Test" : If any vertical line crosses the graph in two or more places, the relation is not a function. The following commands are a little more advanced. Don't worry about understanding all of the Maple, concentrate on the mathematical meaning of the graph you see.

> expr := 4*x^2 - 3*y^2 + y^3 = 1; > with(plots):

> plots[display](
implicitplot( expr ,x=-2..2, y=-2..4,color = blue, thickness = 2),
implicitplot( {seq(x = k/4, k=-8..8)}, x=-2..2, y= -2..4, color = red)); Clearly this relation is not a function because there are vertical lines which cross the graph in more than one point!

D1. . Highlight and copy the commands above, then paste them at a new > prompt for each of the three questions below. Then change the formula to the formulas listed below. Which of these relations appear to represent the graph of a function?

A. expr := 4*x^2 + 2*y^2 - y^3 = 1;
B. expr := 4*x^2 + y^2 - y^3 = 1;
C. expr := x^3 - x + 2*y^3 = 1;

_________________________________________________________________________________________

E. Horizontal Line Test

_________________________________________________________________________________________

Some functions have a special property where each x value has a unique y value not shared by any other x values.

These functions are called "one-to-one". When you look at the graph of a function, you can tell if its one-to-one if it passes the "Horizontal Line Test": If any horizontal line crosses the graph in two or more places, the function is not one-to-one.

> f := x -> x^3 - 3*x^2 + x -1; > plots[display]( plot( f(x), x= -2..4, y=-7..7, color = blue, thickness=2),
plot( {seq( k/2, k = -10..10)}, x= -2..4, y=-7..7, color =red)); Although this is the graph of a function, its not one-to-one because various horizontal lines cross the graph in 3 places!

E1. Highlight and copy the block of code above, then paste it at a new > prompt for each of the three questions below. Change each function to the function listed below. Which of these functions appear to be the one-to-one functions?

A. f(x) = xsin(x) B. f(x) = 1/(x+1) C. f(x) =-2-x D. f(x) = x|x|

>