On Plotting Piecewise Defined Functions

David Bowers, Suffolk College, Ipswich, UK

A poster display provided for the Derive/TI-92 Days Leeds in 1996

 

INTRODUCTION

The method of piecewise graph plotting in 2D and 3D using DERIVE and TI-92 is outlined below.

We have found that students at sixth form level (16 years old) and beyond enjoy activities based on defining and plotting such graphs. Although it is seen as a "fun" task, it reinforces basic knowledge such as the equations of lines, curves, planes and surfaces, and important concepts such as the domain and range of a function.

A typical activity would involve giving the student a "shape" which has to be reproduced by working out a suitable piecewise defined function and plotting it. Thus the student is motivated to revise the results of coordinate geometry, such as the equation of the line passing through two given points, the equation of a circle with given centre and radius, the effect of varying the coefficients of parabolae, hyperbolae, etc. They can then extend these results into three dimensions.

The graph on the screen provides instant confirmation to the student that the function has been correctly defined (or not!). It is our experience that students then need little encouragement to embellish their creations, and produce ever more adventurous designs.

 

GRAPHING PIECEWISE DEFINED FUNCTIONS WITH DERIVE

TWO DIMENSIONS

Consider

y = 1 ,     x < 2
y = x - 1 ,    2 £  x

This can be authored using the IF expression, which has syntax:

IF ( condition , then , else )

Here, authoring and plotting

IF ( x < 2 , 1 , x - 1 )

will give the required graph:

 

Now consider a more complicated graph:

y = x ,     0 £ x < 2
y = 2 ,     2 £ x < 4
y = Ö (4 - (x - 4)2) ,     4 £ x < 6
y = 0 ,     otherwise

It is possible to author this using nested IF expressions:

IF(0 £ x < 2 , x , IF(2 £ x < 4 , 2 , IF(4 £ x < 6 , Ö (4 - (x - 4)2) , 0 ) ) )

However, it may be more convenient to make use of the CHI function.

CHI(a , x , b) simplifies to 1 if a < x < b and 0 otherwise

Thus CHI(a , x , b) * f(x) defines the function f(x) on (a , b) only.

So the graph of the function above can be generated by authoring and plotting

CHI(0,x,2) * x    +    CHI(2,x,4) * 2    +    CHI(4,x,6) * Ö (4 - (x - 4)2)

Note: There may be "gaps" due to the fact that the CHI function excludes the endpoints of the interval. This can sometimes be overcome by changing Options Accuracy in the Plot window.

 

 

THREE DIMENSIONS

A simple but effective starting point to introduce 3D graphs is the idea of a cylindrical "tower" of height 3 (say) and base radius 2 (say), taking z = 0 as "ground level". This has the piecewise defined function:

z = 3 ,     x2 + y2 < 4
z = 0 ,     otherwise

This can be achieved by authoring and plotting

IF ( x2 + y2 < 4 , 3 , 0 )     or     CHI ( 0 , x2 + y2 , 4 ) * 3

 

The simple tower can be embellished by adding a moat and a dome:

z = -1 ,     -12 < x + y < -8
z = 4 ,     x2 + y2 £ 25
z = 4 + Ö (9 - x2 - y2) ,     x2 + y2 £ 9
z = 0 ,     otherwise

The corresponding nested IF expression for DERIVE would be:

IF(x2+y2£ 9 , 4 + Ö(9-x2+y2) , IF(x2+y2£ 25 , 4 , IF(-12<x+y<-8 , -1 , 0)))

giving the following picture: (NB Eye is at x: -100 , y: -30 , z: 18)

 

 

GRAPHING PIECEWISE DEFINED FUNCTIONS WITH TI-92

It should be noted that TI-92 uses the syntax

WHEN ( condition , then , else ) rather that IF( . . . ) with DERIVE.

Also, the CHI function is not available, making nested WHENs necessary.

Since it is assumed that the reader may be less familiar with TI-92 than with DERIVE, all steps are given here in full.

 

EXAMPLE 1 (the first 2D plot given above)

Press [MODE] , and ensure Graph . . . . . . FUNCTION. [enter]

Press green keys [¨ ] Y = . This opens the Plots list.

Complete the definition of your function:

y1(x) = when ( x < 2 , 1 , x - 1 ) [enter]

Press green keys [¨] WINDOW and enter xmin=-3, xmax=6, ymin=-1,ymax=6

Press green keys [¨] GRAPH

 

EXAMPLE 2 (to plot the simple 3D tower as above)

Press [MODE] and select Graph . . . . . 3D

Press green keys [¨ ] Y = . This opens the 3D plot list.

Complete the definition of your function:

z1(x,y) = when ( x2 + y2 < 4 , 3 , 0 )

Press green keys [¨ ] GRAPH

Just as with DERIVE, 3D plotting takes time . . .

The first display can probably be improved. Press [¨ ] WINDOW and experiment with changing the parameters.

 

FOR YOU TO TRY !

Here are some piecewise defined plots.

Try to reproduce them (or improve them . . )

 


© David Bowers 1996