Introduction to Function Plotting with GSP 4 Dr. John Olive The University of Georgia jolive@coe.uga.edu A Workshop for the Vienna International Symposium on the Integration of Technology in Mathematics Education (VISIT-ME), July 10-14, 2002 If you are not familiar with the Geometer’s Sketchpad use the Quick Reference sheet to explore and find out about the Toolbox, Selecting Objects, and Constructing Objects. Creating and Plotting a New Function Select New Function from the Graph menu. The GSP calculator should appear (see Working with Measurements, Calculations, and Functions from the Quick Reference sheet). The calculator is set to enter a function of x -- f(x). The calculator keyboard provides an “x” key. To enter the function x2 simply click on the x key, then on the ^ key and then the numeral 2. The upper portion of the calculator should display the function: f(x)= x2. Now click on the OK key. The function f(x)= x2 should appear in the Sketchpad window (Sketch Plane). With this function highlighted (selected) go to the Graph menu and select Plot Function. A coordinate grid appears with the graph of the function highlighted (selected). Place a point on this graph using the Point tool. Label this point A using the Text tool. (Just click on the point with the text tool. If the label is not A, then double click on the label to change it to A.) Measure the coordinates of point A (select point A and then select Coordinates from the Measure menu). Observe how the coordinates change as you move point A along the graph. Editing a Function To edit your function simply double click on the function expression (not the graph). The function will appear in the GSP calculator. Place the edit cursor in front of the x2 that appears in the editing strip and type a number or press the calculator numeral keys. Remember to also press the * key to indicate multiplication (for example press 0.3* to multiply your function by 0.3). Place the editing cursor after the x2 and press the subtraction (-) key and then create the expression 2*x-4 using the calculator keys. You should now have the following equation: f x = 0.3 x 2 -2 x-4 at the top of the calculator. Click on the OK button to accept your edits. This new function should appear in the Sketch plane and your graph should have changed position and shape. Note that your point A is still on the graph of this new function. Your screen should look like Figure 1 below. Move point A along the graph of this new function and observe its coordinates changing. f x = 0.3 x 2 -2 x-4 6 A: (2.71 , -7.22 ) 4 2 -10 -5 5 10 -2 -4 -6 A -8 -10 Figure 1: Result of editing the function f(x)=x2 to form the function f(x)=0.3x2-2x-4 Using Parameters to Define a Function Right now you have just one particular function graph. The algebraic power of GSP 4 comes from the ability to create a whole family of functions using dynamic parameters. These can be created using the New Parameter option under the Graph menu or by creating directed line segments whose directed length is used for the parameter. We shall first use the New Parameter option to create parameters for the quadratic function. Our quadratic function is in standard form right now. We shall use parameters a, h and k to create a quadratic function in vertex form: f(x)=a(x-h)2+k. Under the Graph menu select New Parameter and change the default label “t[1]” to “a” and its value to 0.5. Repeat to create parameters h and k with values of 1.0 and 2.0 respectively. We shall now use these parameters to construct a new function. Select Plot New Function from the Graph menu (this selection both creates and plots the new function). The function calculator should show g(x) in the upper portion (each new function gets assigned a new letter, starting with f). Click on the parameter value for a (a=0.5). The letter “a” should appear in the editing strip on the calculator. Now press the * key and the open parentheses “(“ key, followed by the “x” key and the “-“ key. You should now have the following expression partially formed in the edit strip: “a*(x-“. Now click on the value for parameter h (h=1.0). The letter h should have been added to your expression. Close the parentheses and then press the ^ key followed by the numeral 2. At this point your expression should be: a*(x-h)^2. Add the value of parameter k to this expression (press the + key and then click on the parameter k). This completes your expression for the vertex form of the quadratic function: g(x)=a(x-h)2+k that you should now see in the top portion of the calculator. [If you do not have this expression in the calculator, then check back on the steps and edit the expression until it is correct.] Click on the OK button to both display the expression and plot the function. Your screen should look like Figure 2 at this point: f x = 0.3 x 2 -2 x-4 A: (-1.04 , -1.59 ) a = 0.50 h = 1.00 k = 2.00 6 4 g x = a x-h 2 +k 2 -10 -5 5 10 A -2 -4 -6 -8 Figure 2: Plotting the vertex form of the quadratic function g(x)=a(x-h)2+k To illustrate that g(x) does have a vertex at the coordinates (h, k) we shall plot the point (h, k). Select the parameters h and k (IN THAT ORDER), then select Plot as (x, y) from the Graph menu. A point should appear at the vertex of the graph of g(x). We can now experiment by changing the parameters of the function g(x). Change the value of parameter a so that it is – 0.5. A very quick way to do this is to select parameter a and press the “-“ key on your keyboard. What happened to the graph of g(x)? Press the “-“ again. Press the “+” key. What happens to the value of the parameter? What happens to the graph of g(x)? Repeat the above experiment selecting the parameters h or k. What happens to the graph of g(x) this time? Figure 3 shows the result of such experiments with changing the parameters. The default step for changing the parameters with the +/- keys is one unit. You can change this step value for any of the parameters. Select parameter a and choose Properties from the Edit menu. Select the Parameter tab on the pop-up window. At the bottom of this dialog box change the “Change by:” value to 0.1 units for Keyboard (+/-) adjustments. Click on the OK button. Now press the + key several times. What do you notice? What happens to the graph of g(x) when a=0.0? f x = 0.3 x 2 -2 x-4 A: (-1.04 , -1.59 ) a = -0.50 h = 3.00 k = 4.00 g x = a x-h 6 4 2 +k 2 -10 -5 5 10 A -2 -4 -6 -8 Figure 3: Result of changing the parameters of g(x). With both of our current quadratic functions, we can only change the graph by changing the function expression (either by editing f(x) or by changing the parameters that control g(x)). For some investigations it would be advantageous to control the graph of the function through direct manipulation of defining points on the graph itself (such as the vertex point). We can do this very easily by using the coordinates of a free point in the plane as the values for the parameters h and k in the expression for g(x). Create a free point in the plane (label it V) and obtain both its abscissa (xV) and ordinate (yV) using the Measure menu. Use these two values and parameter a to create and plot a new function h(x) = a(x- xV)2+ yV. You should have created a parabola with the point V as vertex. Move point V around the sketch plane. What happens to the graph of h(x)? It is also possible to have the parameter a controlled by a point on the quadratic function. One way to do this is to plot a vertical line one unit to the right of point V (calculate xV+1 and plot as a function of y using the function calculator by choosing x=f(y) under equations and then clicking on the calculated value xV+1). Place a free point B on this vertical line and obtain the abscissa (xB) and ordinate (yB) of this point. Calculate the value (yB- yV)/( xB- xV)2 and change the label for this value to b. Use this value b instead of a in the expression for h(x) above. The graph of h(x) = b(x- xV)2+ yV should pass through points V and B. What happens to the graph when you move point B up and down the vertical line? Why does this expression work for constructing a parabola with vertex V passing through point B? Coordinate-based Sliders It is fairly easy to create sliders (dynamic line segments) to provide values that can be manipulated simply by moving the end-point of the slider. In a New Sketch go to the Graph menu and select Define Coordinate System. Create a free point in the sketch and label it A. Select point A and the x-axis and construct a line parallel to the x-axis through point A. Place a free point B on this line. Hide the line through points A and B. Construct a segment between A and B. Select points A and B and measure their abscissa. Calculate xB-xA and re-label this calculation b. Hide the values for xB and xA and turn off the label for point A (click on point A with the text tool). You are now ready to create a slider tool from this construction. Follow the steps below: Select the x-axis, the segment and its two endpoints, and the value labeled b. Click on the last button on the tool bar and hold the mouse button down. Select Create Tool from the sub-menu that appears. Name the tool slider_tool and check the Show Script View box. A window similar to Figure 4 below should appear: Figure 4: Script View window for the Slider_Tool Double click on the first given (1. Straight Object x). Check the box “Automatically Match Sketch Object” in the dialog window that appears. “Straight Object x” should move into the Assuming portion of the Script View window. Save your sketch as “Slider_tool” into the Tool Folder. Your slider_tool will now be available for use whenever you open GSP 4. Creating a Function using Sliders as Parameters Use your slider tool to create four sliders in a new sketch. The coordinate axes will be created automatically. Your Sliders (segments) will have only one end-point labeled. Four measures will appear. Re-label these measures according to the labels on your sliders. So as not to confuse which endpoint is the moveable one you can hide the unlabelled endpoint of each slider. Use the measures of each slider to create and plot a new function: f(x) = ax3+bx2+cx+d. You should have something like figure 5 below. a = 0.42 A b = -1.30 c = -1.15 d = 2.70 6 B C D 4 f x = a x 3 +b x 2 +c x+d 2 -10 -5 5 10 -2 -4 -6 Figure 5: Plot of a cubic function using 4 sliders as parameters. Explore the roles of the four parameters on the cubic function by adjusting each of the sliders. Create a new cubic function using three of the sliders as roots of the function: e.g. g(x) = a(x-b)(x-c)(x-d). Explore how these two cubic functions differ and how they are similar.