Sei sulla pagina 1di 4

1

Piecewise functions

A function is called a piecewise function if it has a different algebraic expression for
different parts of its domain. A domain is a collection of numbers on which the function
is defined. Piecewise functions are defined in pieces because the function behaves
differently on some intervals from the way it behaves on others. The individual pieces of
the function may be linear, polynomial, rational or a combination of these. The parts of
the domain are usually specified in the form of inequalities. Since the conditions are
different on different parts of the domain, we usually have at least two formulas in a
piecewise function.

Some examples of piecewise functions




3
3 1
1
, 4
, 2
, 1
) (
2
>
< s
s

+
=
x
x
x
x
x
x f and
4 1
1 3
3
, 1 2
, 7
, 2 1
) (
< s
< s
<

=
x
x
x
x
x
x g


In order to define the different parts of the domain of a piecewise function, it is important
to know how inequality symbols are used in Maple:
Symbol Syntax in Maple Example Meaning
x > a x > a x > 2
Values of x which are greater
than a
x < a x < a x < 2
Values of x which are less
than a
x >a x > = a x >= 2
Values of x which are greater
than or equal to a
as x < b a<= x and x < b -1<= x and x < 2
Values of x which are greater
than or equal to a and are less
than b.
x = a x <> a x <> 2
Values of x which are not
equal to a




Graphing piecewise functions in Maple
2
Graphing piecewise functions in Maple



Lets now consider the piecewise function defined by


1
1 3
3
, 1 2
, 7
, 2 1
) (
>
< s
<

=
x
x
x
x
x
x g



To graph this piecewise function in Maple, it helps to think of g(x) as follows:


domain
domain
domain
piece
piece
piece
x g
rd
nd
st
rd
nd
st
3
2
1
, 3
, 2
, 1
) (

=


Piecewise functions can be defined in Maple by using the piecewise command.




Thus the above function could be defined in Maple as:

> f:=x->piecewise( , 3
1

domain
st
x < , * 2 1
1

piece
st
x

domain
st
x and x
2
1 3 < <= ,

, 7
2 piece
st
, 1
3

domain
st
x = >

piece
st
x
3
1 * 2 + );
You can ask Maple to display the piecewise function the way it is usually appear in print
by typing the expression f(x);



The syntax is:
piecewise (1
st
domain, 1
st
piece, 2
nd
domain, 2
nd
piece, 3
rd
domain, 3
rd
piece).


3


We are interested in plotting the function
1
1 3
3
, 1 2
, 7
, 2 1
) (
>
< s
<

=
x
x
x
x
x
x g using Maple syntax.

> f:=x->piecewise(x <- 3, 1-2*x, x >=-3 and x<1,7, x >= 1,2*x + 1);


> plot(f, -10..10, discont=true);



We can find the value of the function when x = 3 by typing the syntax below:

> f(-3);


Simple limits and piecewise functions
Limits of piecewise functions and expressions can be computed in Maple by using the limit
command. Some examples using the above function are given below.
> limit(f(x),x=-3); #to find limit as x approaches -3

> limit(f(x),x=1, left); #to find limit as x approaches 1 from the left

> limit(f(x),x=1, right); #to find limit as x approaches 1 from the right

> limit(f(x),x= -infinity); #to find limit as x approaches -infinity

> limit(f(x),x= infinity); #to find limit as x approaches -infinity

4

USE MAPLE TO ANSWER THE FOLLOWING QUESTION

Your name must appear on each printout

Problem 1.

Let
4 1
1 3
3
, 1 2
, 7
, 2 1
) (
< s
< s
<

=
x
x
x
x
x
x g


a) Sketch the graph of g(x). b) Find ) ( lim
3
x g
x





c) Find ) ( lim
3
x g
x
+

d) Find ) ( lim x g
x



e) Find ) ( lim x g
x
f) Find ) ( lim x g
x



g) Find g(-5) , g(-2) , g(1), and g(4).



Problem 2.

Let
3
3 2
2
, 5
,
, 1
) (
2
>
s <
s


=
x
x
x
if
if
if
x
x
x h

a) Sketch the graph of h(x). b) Find ) ( lim
2
x h
x
+



c) Find ) ( lim
2
x h
x
+

d) Find ) ( lim
3
x h
x



e) Find ) ( lim x h
x
f) Find ) ( lim x h
x



g) Find h(-5) , h(-2) , h(3), and h(10).

Potrebbero piacerti anche