The computer program DERIVE can be used to plot data sets, fit function models to data, solve equations, simplify algebraic expressions, and perform many other useful mathemtaical tasks quickly and (almost) painlessly.
The present page presents an introduction to authoring and plotting algebraic expressions and data sets, solving equations and simplifying algebraic expressions, and fitting a selected function model to a data set.
Authoring Expressions and Solving EquationsIf you are working in DOS:
From the DOS prompt (e.g., the E: or C: prompt), type DERIVE.
If you are working in WINDOWS95, click on the DERIVE icon.
If you are working on the VHCC network, get the Learning Lab personnel to show you how to get the E: prompt. (You shut down and restart the computer, and a menu comes up; you choose the menu item that has to do with math/physics, and that gets you the E: prompt).
The program will load and you will see the initial DERIVE screen.
Near the bottom of the screen you will see the Command Line selections. Note that the highlighted selection is Author. Make this selection either by typing the letter A or by striking the Enter key (the Enter key will execute the highlighted command).
You will be prompted to type in an expression. Type in the equation 2x + 3 = 7 and use the Enter key to send this expression into the Algebra window above the Command line. The equation will appear as expression #1.
Suppose you wish to solve the equation. You could of course solve it by adding -3 to both sides then multiplying by 1/2. The result is clearly x = 2. Let DERIVE solve the equation for you. Look for the soLve command. You will notice that the L is capitalized. Type L and the result x=2 will appear in the Algebra window.
Now solve the equation (x-2)(x+3) = 0, as follows:
Choose Author, and enter the equation.
Look at the equation. Note that if x=-3, the equation is true. For what other obvious value of x is the equation true? Is it possible for any other value of x to make the equation true? Record your responses to these questions in your notebook.
Now choose soLve. You will get two expressionsNote that DERIVE gives you the solutions you should have expected.
Author and solve the equation (x-2)(x+3) = 2x + 3. The solutions will be in radical form, which doesn't tell you much about just where the numbers should lie on the graph.
Highlight each solution in the Algebra window. Then use approX (type X) to see the decimal approximation of each number. Whenever DERIVE gives you an answer other than a decimal number (e.g., long fractions, radicals, etc.) when you need a decimal number you can understand, highlight each solution and type X to approximate it.
You can set DERIVE to automatically approximate answers by choosing Options then Precision, then Approximate. However, if you do so, you will have to give DERIVE a guess for the lower and upper limits of the solution, and you will only get one solution. This is fine, as long as you know approximately where the solutions are.
Do this. Choose Options (just type O), select Precision (type P) then select Approximate (type A). You will be asked to enter significant digits. The default value is 6; if the number doesn't read 6, make it 6. You could choose another number of significant digits, depending on how precise an answer you need.
The number of significant digits is the number of digits from the first nonzero digit in a number to the last. For example `pi = 3.14 to three significant digits, `pi = 3.1416 to five significant digits, and `pi = 3.1415927 to eight significant digits.
Enter to return to the Algebra window. Use the arrow keys to highlight the expression (x-2)(x+3) = 2x + 3, and choose soLve. This time you will be asked for lower and upper bounds on the solutions. The default bound, as you will see, are -10 and 10. So DERIVE will find a solution in this range. However, it will find only one solution. Enter and you will see this solution.
To find the second solution, you have to have an idea where it is. Of course you already know from before that the other solution is between 4 and 5. So you could choose an interval that includes this solution but not the other.
Pick such an interval, and see that you do get the desired solution.
Now run through the following exercise, in which you author and solve the same equation while plotting relevant graphs and using some helpful editing options:
Using the arrow keys, move up to the equation (x-2)(x+3) = 0. You will note that the equation is highlighted.
Using the left and right arrow keys, change the highlight so only the left-hand side (x-2)(x+3) is highlighted.
Plotting the expression
Plot the expression as follows:
Choose the Plot command. You will see a couple of prompts asking you where and how to plot the expression. Strike the Enter key, which chooses the indicated default option in each case, until a graph appears on the right-hand side of the screen. When you see this graph, you are in the Plot window. Look at the command line. You will see that the options are different than before. Note especially the Range, Delete and Plot commands.
Note that the graph window goes from x = -2 on the left to x = 2 on the right, and from y = -3 at the bottom to y = 3 at the top.
Go ahead and choose Plot from the command line. Of course you have already chosen Plot once, but that was in the Algebra window. To see the graph, you have to choose Plot in the Plot window.
You will see part of the graph on the screen. You will probably see that the graph passes through the x axis at x = 2.
Why should the graph of (x-2)(x+3) pass through the x axis at x=2?
Can you see another point where the graph passes through the x axis?
Is it possible that there is such a point somewhere off the screen? If so, where do you think it will be? Why?
To see more of the graph, you can expand the range of the graph. You do this with the Range command. Select the Range command. You will see a line giving the Left, Right, Bottom and Top coordinates of the Plot window. You can use the Tab key to move from number to number, and the backspace or delete key to get rid of unwanted digits. Change the Left and Right coordinates to -5 and 5, and change the Top and Bottom coordinates to -7 and 7.
Before you enter your changes, predict the graph you will obtain when the screen coordinates change, based on the graph you see. Sketch the graph in your notebook and record your prediction of where the graph will pass through the x axis.
Use the Enter key to enter your changes. The graph will be drawn with the new screen ranges.
Where does the graph pass through the x axis?
How does this compare with your prediction?
Why would you expect the graph to pass through the x axis where it does?
Do you think there are any points outside the window where the graph passes through the x axis? Why or why not?
Record your answers in your notebook.
Change the range once more, this time going from -20 on the left to 20 on the right, and -30 on the bottom to 30 on the top. Before you enter your changes, predict what your graph will look like. Include a sketch in your notebook.
Enter the changes and observe the graph. Compare your prediction with the DERIVE graph, and document your comparison.
Make careful note of the following statement: An equation of the form [expression] = 0 , where [expression] is an algebraic expression involving one variable, will have solutions that coincide with the points where the graph of [expression] passes through the x axis. So to get an idea of where a solution is, plot [expression] and estimate where the graph passes through the x axis. If you are trying to find the solutions in the Approximate mode, you should use this strategy to figure out what ranges to use for the approximate solution.
The Intersection of y = (x-2)(x+3) and 2x + 3
Now return to the Algebra window by choosing the default option Algebra. Use the up/down arrows to highlight the equation 2x + 3 = 7, and then use the right/left arrows to highlight just the 2x + 3. Choose Author and use the F3 key to put this expression on the command line, then Enter to place is on its own line.
Predict the value or values of x for which this expression will be 0. Document your prediction in your notebook. Then plot the expression (choose Plot to take you to the Plot window; once in this window choose Plot once more to plot the graph).
Notice that the graph retains the ranges you chose last time you were in the Plot window.
Does the graph of the new expression pass through y = 0 where you expected? Document the agreement or disagreement of the graph with your prediction.
At what x coordinates do the graphs of (x-2)(x+3) and 2x + 3 intersect? How closely do you think you can predict these coordinates from the present graph? Document your answers.
Change the ranges to x = -5 to 5, and y = -7 to 7. Again estimate the x coordinates of the intersection points. How closely can you predict the coordinates of the intersection points from this graph? How much closer is this than before? Document your estimates and answers.
Solving the equation (x-2)(x+3) = 2x + 7
You know that the above equation is a quadratic, and can be solved using the quadratic formula. You will use DERIVE to solve the equation and interpret its results.
You will use the exact solution, so from the Command line of the Algebra window choose Options, Precision and Exact. The enter.
You should now be int the Algebra window. You are going to author the equation (x-2)(x+3) = 2x + 3. Do this as follows:
Look up to the Algebra window to find the number of the (x-2)(x+3) line, and type in the number of this line, using the # sign. For example, if the line is #8, you will type in #8.
Type the = sign.
Type the number of the 2x + 3 line, again using the # sign. Your line will read something like #8 = #9 but when you enter it, it will be expressed as (x-2)(x+3) = 2x+3.
If you haven't entered, go ahead and enter your expression and obtain the equation (x-2)(x+3) = 2x+3.
Next choose soLve to solve the equation. You will get two expressions involving square root signs and fractions. If you know how to solve the equation (x-2)(x+3) = 2x + 3, you know how this notation comes from the quadratic formula. However the radicals are distraction here. You probably would rather see just a couple of decimal numbers. So you are going to ask DERIVE to approximate these expressions.
Highlight the first of the two solutions. Choose approX (type the capitalized letter X). The decimal approximation will appear. Highlight the second expression and approximate it in the same way. Compare these approximations to your estimates. How close did you come? Document your comparison.
It is important to remember to approX any incomprehensible expressions so you can understand the solution.
Simplifying Algebraic ExpressionsAuthor the expression (2x - 3)(4x + 1). On paper, multiply this expression out using the Distributive Law of Multiplication over Addition. Document your result.
Choose Expand from the commands. Be sure that the expression is highlighted, then Enter to expand the expression.
Does the result agree with what you got when you multiplied the expression out?
Now author the expression (x² + 2x - 3)(3x² - 4x + 1). Don't bother multiplying it out. Just go ahead and use DERIVE to expand it. Document your impression of how much work the Expand option could save you. Especially for longer and more complicated expressions.
Plotting a Data Set and Making Predictions from the GraphAn experiment involves letting sand fall from a hole to build a pile. The bigger the pile the more it weighs. The data represents weight vs. the average dimension of the pile.
If you have done the experiment, put in your data from the sand pile experiment. If not, use the numbers given below. Put the data in as follows:
Suppose that the average dimensions of the pile are 3.2, 4.1, 5.3 and 6.1 cm, with weights of 9, 25, 42 and 79 grams. Then the first pile would be represented by the vector [3.2,9].
Don't worry yet about exactly what a vector is. Just think of it as a set of expressions between two brackets [ ] and separated by commas. The other piles would be represented by vectors [4.1,25], [5.3,42], and [6.1,79]. These vectors, of course, correspond to the points you plotted to construct the graph of weight vs. average dimension.
To enter your data, you make a matrix consisting of the four vectors that represent the four piles.
The vector will start with a bracket [ followed by the vector [3.2,9] which represents the first pile and then by a comma. After the comma we have the vector [4.1,25] representing the second pile followed by a comma, then the vectors [5.3,42] and [6.1,79] separated by a comma. This completes the four piles, and all we have to do is end with a bracket ] and we have constructed a vector consisting of four vectors.
Author the vector corresponding to your weight vs. average dimension data set. The vector in the previous paragraph would read [ [3.2,9], [4.1,25], [5.3,42], [6.1,79] ]. If you have done the experiment, your vector will probably look similar to this, but with different numbers and perhaps more or less than four piles represented.
Plot this vector, just as you would plot an expression. Use an appropriate set of ranges, or you might not see the points. For example, the x coordinates of the above data run from 3.2 to 6.1; an x range from 0 to 10 would contain these points with some space on either side. The y values run from 9 to 79, and increase more and more rapidly; a y range from 0 to 150 might leave enough room around the data points to see what is going on.
The graph you get will consist of four points (more or less) similar to those you might have graphed for homework.
Our goal is to predict the weight of a pile with a certain average dimension. Let us say that the average dimension of the pile is to be 16. How can we use DERIVE to predict the weight when the average dimension is 16?
Your Plot window is cluttered up with the graphs from the previous exercises. Use the Delete option in the Plot window to delete all but the last graph. You will be able to figure out what to do from the prompts.
One way you might have predicted the weight when average dimension is 16 would have been to to sketch a curve which approximates the data points. You could then attempt to predict how the curve will continue until the average dimension finally reaches 16. If you could predict the x=16 point on the curve, you could easily see what weight is represented by the point.
Using the 'Fit' command to obtain a function modelIn DERIVE, we can try to 'fit' a given function to our data. At this point in the course, you aren't expected to know for sure what function is appropriate to this situation. However, you do know that the linear function y = mx + b has a straight-line graph, unlike the graph in front of you, while the quadratic function y = ax² + bx + c has a curved graph, more appropriate to this data set. Maybe if the numbers a, b and c are just right, this curved graph would 'fit' the data points.
You could at this point pick three points and solve a set of simultaneous equations to get your quadratic model. However, not only will DERIVE save you all that work, it will find a model that doesn't depend on the three points you choose. In fact it will find a model which is very close to the best possible quadratic model for this data, in the sense of minimizing the average of the squared deviations.
We can easily find out whether some y = ax² + bx + c curve might reasonably represent the data. Be sure you are in the Algebra window and Author the expression
FIT( [x,ax²+bx+c], #**),
where ** stands for the number of the line containing the data vector. For example, if the data vector is in line 19, you would author the expression FIT( [x,ax²+bx+c], #19).
Approximate this FIT(...) expression using the approX command. Make sure the expression is highlighted before typing X for approXimate. Take a good look at the expression you obtain.
Plot this approximated expression. How well does it fit the data points?
Open a window large enough to find the x = 16 point of the graph, and from the graph determine as nearly as possible what y value would correspond to x = 16 if this curve really represented the way the sandpile's weight increases as it grows.
You can also find, for example, the average dimension (x) which corresponds to a given weight (say, 55):
Author and plot the equation y = 55, and estimate the value of x for which the graphs cross. This will be the value of x for which y is 55.
Set the approximated expression equal to 55 (highlight the expression, choose Author, use the F3 key; then just type in the right-hand side = 55 to complete the equation.
Choose soLve to find the value(s) of x for which the equation is solved. These are the x values at which the graphs cross. (Remember to use the approX command if the solutions you get are incomprehensible.)
Finally, Author the expression consisting of the previous simplified expression minus 55. Plot this expression and note where is passes through the x axis. What is the significance of these x values, and why should a plot of this expression go through the x axis at these values?
Repeat this exercise, except using the 'cubic' function ax^3 + bx² + cx + d instead of the quadratic ax²+bx+c. Does the curve fit the data points better, or not as well? By how much does the prediction differ from the previous prediction?
Try fitting each of the following functions:
y = a x²
y = a x^3
y = a x^4
y = a x^5
y = a x^1.5
y = a x^2.5
y = a x^3.5
y = a x^4.5
What kind of functions are these?
Remember to use the Delete command if the graph gets too cluttered. In case you have to replot your data points, remember the line number of your data vector. You can go to the line and highlight it, or you can at any time re-author the data set using the line number.