Contents 1 Excel Basics 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Text And Numbers In A Single Cell . . . . . . . . . . . . . . . . . . . . . . . 1.3 Doing Mathematics In A Single Cell . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 3 2 The 2.1 2.2 2.3 2.4 2.5 Power Of Excel Introduction . . . . . . . . . . . . . . . . . . . . . . . . . Copying Cells, Creating Sequences, Relative Referencing Mixed And Absolute Referencing . . . . . . . . . . . . . Summing And Averaging Rows and Columns . . . . . . . Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5 5 7 8 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 11 13 15 17 4 Product-Sums (Integration) 4.1 Distance Travelled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Sums and Averages of Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Depth of Fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 21 24 24 5 Initial Value Problems 27 6 Linear Regression 29 3 Continuous Mathematical Functions 3.1 Functions of One Variable . . . . . . 3.2 Horizontal Beams . . . . . . . . . . . 3.3 Simple Harmonic Motion . . . . . . . 3.4 Functions of Two Variables . . . . . i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii 1 Excel Basics Excel Objectives: • Enter and align (left, right, center) text in a cell. • Alter the appearance of text in a cell (bold, italicize, underline, color, font, font size), alter cell background color. • Enter numbers in cells and format the number of decimal places shown. • Perform mathematical computations involving +, −, × and ÷. • Perform mathematical operations involving exponentiation, square root, trig functions and the exponential function. • Enter and compute with percents. 1.1 Introduction Excel is a spreadsheet program, meaning essentially that it is a large table. Each place in the table is called a cell. The columns of the spreadsheet are distinguished from each other by labelling each with a letter of the alphabet, in alphabetical order. (There are more columns than 26, however. After column Z come columns AA through AZ, then BA through BZ, and so on.) The rows are numbered. This setup gives each cell an address, like cell E7, by which we can refer to it. When you open Excel you will see cell A1 has a dark border around it. I will say that cell A1 is selected; a different cell can be selected by putting the cursor, a “white” plus sign, on that cell and left clicking with the mouse. Once we have selected a cell we can enter either words, numbers or formulas into it. These things can be typed either directly into the cell itself, or into the formula bar (marked by the symbol fx ) at the top of the spreadsheet. If we want to change a cell, we can select the cell and completely retype its contents, or we can select it and edit in the formula bar. Sometimes you will want to select a row, column or rectangle of cells; this is done by left clicking the cell at one end (or corner) of the cells to be selected, then dragging the mouse to the other end or corner, keeping the left mouse button down as you go. Above the formula bar is the tool bar, which gives various options for working with the spreadsheet and its entries. Above the tools are the other options for manipulating the spreadsheet, like File, Edit, etc. I will call this the task bar, although I doubt this is common language. 1.2 Text And Numbers In A Single Cell Excel Activity 1.1: This activity will show you how to enter text (words) in a cell, and how to do some modification of the appearance of that text. (a) Put the cursor in cell B4 and left click to select that cell. Note that at the left just above the letter for column A you see B4 in a white “bar” that we’ll call the location bar. (I haven’t found this feature to be particularly useful.) To the right of that you see fx followed by another bar, the formula bar. 1 (b) Type “hi” in cell B4 (when I enclose something to be typed in quotes, don’t include the quotes), and notice that it appears in the formula bar at the same time. Hit Enter and note that the next cell down is then selected. The word “hi” is at the left side of cell B4, because text is always placed to the left side of a cell; we say it is left-justified. (c) Select cell B4 again, then find B I U in the tool bar. Click B and note that this changes the entry in B4 to bold. Click it again to undo the bold, then try I and U. (d) To the right of B I U you will see three sets of horizontal lines. Click each in turn, noting the effect on the word “hi” in cell B4. Excel Activity 1.2: There are many more things that can be done with the entry in a cell, most of which aren’t of much interest to us. Just for fun, though, let’s try a couple more. (a) Enter text in some cell and select that cell. Then find the letter A at the right end of the tool bar, underlined by a red bar. Click the A and note the change in color in the word “hi”. To get other colors, click the small down arrow to the right of the A to see the other choices of colors. Now move to the little can of paint to the left of the A, which is underlined with a yellow bar. Click it to see what it does. Try the down arrow to its right. (b) You should be able to figure out how to change the font style or size. Try it. (c) You will sometimes want to delete portions of a spreadsheet. To do this, simply select the cells you want to delete, then hit Del. Delete something in your current spreadsheet to practice. Excel Activity 1.3: In this activity you will see how to enter and modify numbers in a single cell. (a) Enter the number 3 in cell C3. Note right away that numbers are automatically rightjustified in a cell, whereas text is automatically left-justified. The justification can be changed, of course, in the same way that you did it in the previous activity. (b) Find the icon ←.0 .00 in the tool bar and click on it while cell C3 is selected. Click it again. .00 Then try →.0 . Now enter several other numbers in cells C4 through C6, all with different .00 numbers of places past the decimal, and try ←.0 .00 and →.0 again. NOTE: When you change the number of decimal places shown to less than the number entered, the original number is still stored in that place and used for any computations involving the value in that cell. (c) Now select the cells from C3 to C6. (Remember that to do this you put the cursor in C3, hold down the left mouse button and drag down to cell C6.) Select Format from the top of the tool bar, then Cells. A new window with several tabs at the top will appear, with the tab for Number already selected. Try some of the other tabs, then go back to Number. Select Number under category if it is not already selected, then adjust the number of places past the decimal with the little up and down arrows provided for this. Watch the sample above the bar for the decimal places as you do this. Click OK at some point to select a number of places past the decimal. 2 1.3 Doing Mathematics In A Single Cell Excel Activity 1.4: In this activity you will see how to do computations in a single cell. (a) Go to any empty cell in an Excel spreadsheet and enter “3+5”. (Again, when I use quotes, I intend for you to use only what is IN the quotes, not the quotes themselves.) When you hit enter, you will simply see “3+5” in the cell. Go to two other cells and try “3-5” and “3/5”. There you will end up with “5-Mar”, the fifth of March. Excel takes - and / to mean a date is being given. If you really wanted to enter “3-5” in a cell, you need to format the cell for text, then enter “3-5”. Try this. (b) Suppose that rather than entering “3+5” in a cell, we wanted to actually calculate the sum in a cell. To do this we enter “=3+5”. Try this. All mathematical calculations need to be begun with the = sign. (Actually, you can begin them with + or - as well.) The symbol / is used for divide, and * for multiply. If you ever enter a computation that Excel doesn’t like, the first thing to check is whether you put in the * symbol for (2)(3) + 4 each multiplication. Try 3-5, 3 ÷ 5 and (3)(5). Then try ; do this by hand as 5 well to make sure you are getting the right answer with Excel. (c) Exponentiation is done in Excel with the carat (ˆ) symbol, as on most graphing calculators. Try using it. (d) Now enter 2, 3, 4 and 5 in cells A1, A2, A3 and A4, then select cell C1. Suppose that (2)(3) + 4 we again want to compute , but we wish to do so by retrieving the numbers 5 involved from where we have “stored” them in cells A1 through A4. (There is much reason to do this kind of thing, so bear with me if you haven’t done this before.) To do this we enter “=(A1*A2+A3)/A4” in cell C1; we don’t need to put parentheses around A1*A2 because Excel follows the order of operations. Try this. NOTE: Excel is not case sensitive when referencing cells, so you can use either a4 or A4 to reference that cell in a formula. (After you hit enter, anything like a4 will be changed to A4.) Mathematical notation IS case sensitive, and I expect you to use the correct cases of letters in mathematical formulas and functions. For example, t represents time, whereas T usually represents temperature. Excel Activity 1.5: In this activity you will work with some of the functions that Excel has built in. √ (a) Suppose you want to compute 20 in decimal form, and wish to find out how to do this in Excel. Click Help in the task bar, then select Microsoft Excel Help. You will see some text highlighted in blue under the question “What would you like to do?”. You can either type in “square root” there or click the tab for Index and type “square root” as the keywords. Both should lead you to a description of the square root function. Try using it on a value whose square root you know or can check with your calculator. (b) Use the help function to figure out how to find the cosine of π3 (you’ll need help with both the cosine and pi), then the cosine of 40 degrees. Check both answers with your calculator, making sure you are in the correct mode for each. 3 (c) The one function you may not be able to figure out on your own is the exponential function ex . If you want e2 you type in “=exp(2).” Try this, checking the result with your calculator. Excel Activity 1.6: Here you will see how to work with percentages in Excel. (a) Enter 0.53 in some empty cell. Then select that cell and click the % icon in the tool bar. The value in the cell should change to 53%, the percentage equivalent of the decimal 0.53. (b) You can “pre-format” a cell to get a percentage as well. Select an empty cell and click the % icon again. Of course nothing happens. Now enter 25 into that cell; you will see it appear as a percentage. (c) Enter 80 (not as a percent) in some other cell. Then select an empty cell and enter a formula that multiplies the values in the two cells containing 25% and 80. Note that the result is found correctly. That is, Excel computes (0.25)(80) = 20 rather than (25)(80) = 2000. 4 2 The Power Of Excel Excel Objectives: • Create a sequence in a column or row by copying. • Enter and copy a formula that uses relative referencing. • Enter and copy a formula that uses mixed referencing. • Enter and copy a formula that uses absolute referencing. • Use the sum, average and count features. • Insert new rows (or columns) into a spreadsheet). 2.1 Introduction So far you have simply used Excel as storage for text and a simple calculator. If this were all there was to it, then Excel would not be particularly useful. The real power of Excel is in its ability to repeat things in a way that • is user friendly to accomplish • makes visual inspection of results easy and enlightening You will begin to see some of that in this chapter. 2.2 Copying Cells, Creating Sequences, Relative Referencing Excel Activity 2.1: (a) Suppose that you want the number two in all of the cells from A1 to A50. Well, you certainly don’t want to enter 2 fifty times! Here’s what to do: Enter 2 in cell A1. Click on cell A1, after entering two, to select it. Put the white + sign that is the cursor on the little square (which is called a fill handle) in the lower right corner of that cell. It then becomes an ordinary + sign, indicating that you have “grabbed” the lower right corner of that cell. Then hold the left mouse button down, drag down to cell A50 and let go. The value two should appear in cells A1 through A50. (b) It is rare that we will want the same value in that many cells. Suppose instead that we wanted the numbers 1 through 50 in cells A1 through A50. Enter 1 in cell A1 and 2 in cell A2, then select both of those cells and copy down to cell A50. (c) Try entering 1 in cell A1, 3 in cell A2, and copying both of those cells down. Note what happens. (d) Often we will wish to create something like all values from −2 to 2 by tenths, like −2, −1.9, −1.8, ..., 1.9, 2. Try to get these in the manner you have just seen, but note the following: as you drag the cells to be copied down you will see a small rectangle to the right of the cursor with a number indicating how far you have gone. Stop when that number reaches two. 5 Excel Activity 2.2: In the last exercise you saw how to create a sequence of “evenly spaced” numbers. Often we will wish to create another sequence, based on an already established sequence. You will see some examples of this in this activity. You will also learn how to do what we call relative referencing of cells. (a) Start a new spreadsheet and get the values one through twenty in cells A1 through A20. (b) In cell B1, enter the formula “=A1ˆ2.” What does this do? (c) Copy cell B1 down to cells B2 through B20. Then click on cell B7 and look in the formula bar above the spreadsheet. You should see “=A7ˆ2.” What has happened is that the reference to cell A1 in cell B1 is actually just a reference to the cell to the left of B2. When we copy cell B1 down, the reference for each cell in column B changes to the cell to its left in column A. We say the reference to cell A1 in cell B1 is a relative reference. You will see the other types of references soon. (d) With cell B7 still (or again) selected, right click in the formula bar somewhere to the right of the formula. The reference to A7 in the formula should turn blue, and if you look down in the spreadsheet, there is a blue border around cell A7, where that value is obtained. This will be a very handy feature in the future, so remember it! (I’ll remind you occasionally, too.) (e) As we continue working with Excel, it will be good to learn how to annotate our spreadsheets so that others can look at them and quickly tell what we are doing. Select cells A1 through A3, then select Insert from the task bar. Select Rows and you will get three new rows at the top of the spreadsheet. In cell A1 type “Squares of integers from one to twenty.” In cells A3 and B3 type n and nˆ2, then center them in their cells. You can color the text in any of the cells that you just annotated, or fill their backgrounds. A simple thing you can do to make this more readable is to simply bold the text you added. Save this spreadsheet as “squares.” (f) Suppose that we wanted to find the sum 1 + 2 + 3 + · · · + n of the numbers from one to n, for all choices of n from one to thirty. If you were doing this by hand you wouldn’t want to add 1 + 2 + 3 + · · · + 23 after you had just done 1 + 2 + 3 + · · · + 22. Instead, you would just take your sum up to 22, which you have already computed, and add 23 to it. You should use this idea when making your spreadsheet. Begin by getting the numbers from one through thirty in cells A1 through A30. Enter 1 in cell B1, which indicates the sum up to 1. Now in cell B2 you want to take the sum up to 1, which is in cell B1, and add the next value of 2, which is in cell A2. So your formula in B2 should be =B1+A2. Copy this down, then select some cell in column B with a value in it and right click in the formula bar. This should show you that the value in that cell is the sum up to the previous integer, plus the integer you are currently on (which is in column A). Note that the formula is correct because the formula in cell B2 references the cell above it and the cell to the left of it, and the references are relative references. (A reference that is not relative will be coming soon!) (g) Create the sequence of odd numbers in column D, then get the sums of odds in column E, in the same way that you did the sums of all the integers in the previous part. What do you notice about the results? 6 2.3 Mixed And Absolute Referencing Excel Activity 2.3: The objective of this exercise will be to understand mixed referencing by making a “times table”. (a) Put the integers from 1 to 10 in cells A2 through A11, and also in cells B1 through however far you need to go to get up to 10. (Put 1 in B1, 2 in C1, and copy both cells to the right, watching the little “counter” as you drag, stopping when it reads 10.) Make all those values bold. (b) Put a formula in cell B2 that computes the product of the numbers to the left and above it, by referencing those cells. Does it give the correct value? (c) Copy the cell with the formula down to the ten row in the left column. It should be immediately clear that the values are not correct, but while that column is selected (after you let go of the left mouse button), grab the fill handle and drag it across to the right until you get to the ten column. (d) Click on a cell in the body of the table somewhere, and then right click in the formula bar. It will show you that the value in that cell is obtained by taking the product of the values in the cell immediately above, and the cell immediately to the left of, the selected cell. (e) What you really want is the product of the value in column A directly to the left of the selected cell and the value in row 1 directly above the selected cell. Go back and select cell B2, and edit it in the formula bar as follows: in the part of the formula that takes the value from column A, put a $ sign in front of the A. This tells the spreadsheet to always take this value from column A when it is copied. For the part of the formula that takes the value from the first row, put a $ sign in front of the number 1. This means that the value for that part of the formula will always come from row 1, even when the formula is copied. Putting a dollar sign in front of the row or column fixes the row or column in the formula. The act of fixing the row or the column, but not both, is called mixed referencing. (f) Copy the formula down and across again. This should give you the correct values. Click on a cell in the body of the table and right click in the formula bar. You can see that the two values being multiplied are obtained at the edges of the table, as they are supposed to be. If you move to the right one cell, the reference to the number at the top of the table should change, but not the reference at the left. (f) Let’s tidy your table up a little. Insert a couple rows at the top and write in “Multiplication Table” in the top row. Make it colored, or bold (or both), and/or maybe change the background color. Select all cells of the table, including the borders, and center the values in the cells. (Do this by using the center icon in the tool bar or by selecting Format, then Cells then choose the Alignment tab and select center for the horizontal alignment.) Select cells A1 through the bottom of the table and format the row height to 20. Then select from column A to the right side of the table (in any row) and format the columns widths to some value where each cell in the table is roughly square. Select all cells in the table and its borders and format the cells in such a way that the cell entries are vertically centered. Select the title of the table and change the font size to 16, by adjusting the value in the little box in the tool bar to the left of the bold B. 7 (g) Save the table as “Multiplication Table.” Excel Activity 2.4: You will now try to understand absolute referencing by modifying your table from the previous activity. The idea will be to create a table that multiplies the numbers at the two edges, then adds a fixed number that is stored elsewhere in the spreadsheet to every value in the table. That number can then be changed, resulting a change in all the values in the table. (a) Insert two more rows between the title and the table. Starting in cell A3, type “Value added:”. In the first empty cell to the right of that enter the value 3. (b) Go to your formula in cell B6 and modify it to take the product of the column and row values as before, but then add the value 3 by referencing the cell it is stored in. Since we always want to get that value, we don’t want the row OR column to change when the formula is copied. To make this happen, put a $ sign in front of both the column and row where that cell is referenced. A reference like this, that never changes, is called an absolute reference. See if the formula gives the correct value. (c) Copy the formula to all cells in the table. Then change the value 3 to zero. The table should then be the standard multiplication table. When you change the value added to the number one, all values in the table should increase by one, and so on. 2.4 Summing And Averaging Rows and Columns For many applications we will want to add up all the values in a particular row, column, or rectangular portion of a spreadsheet. We will also want at times to average values in a row, column or rectangular portion. In the next activity you will see how these things are done. Excel Activity 2.5: In this exercise you will add a list of numbers “the hard way,” then you’ll see the easy (efficient) way to do it. Even if you already know how to add a list of numbers in Excel, do the “hard” version also; it will reinforce some of the skills you have been developing up to this point. Before beginning, think about how you would add a long list of numbers in your head or on a calculator - you would probably keep a “running sum.” By this I mean you would take the first number and add the second to it, getting the sum of the first two numbers. You’d then add the third number to that sum, obtaining the sum of the first three numbers, and so on. (a) Create a list of 20 random digits between one and nine in column A (cells A1 through A20). (b) In cell B1 put the first number of your list; it is your first running sum. In cell B2, add the second number in your list (using a relative reference!) to the current running sum, which is in cell B1. (c) If you copy cell B2 down to where the last number of the list is to be added to the running sum, you will obtain the sum of all numbers in the list. Do this. (d) Now select all the numbers in your original list and click the AutoSum icon (Σ) in the tool bar. The sum should then appear at the bottom of the list of numbers. (Of course it should agree with the sum you got “the hard way.”) 8 (e) Suppose that you wanted the sum to appear somewhere else in your spreadsheet. Select some random empty cell, then click the Σ icon. “=sum()” will appear in the selected cell. Now select all the values in your list and hit Enter to get the sum to appear in the desired cell. (f) Your list of numbers from this activity will be used in the next activity. If you do not intend to go on immediately, save your file as something like “random list.” Excel Activity 2.6: Summing is just one operation that we might want to do with a list of numbers. Some other things of interest are averaging the numbers in the list, or maybe counting the number of items in the list. (a) Delete everything from your spreadsheet except your original list of twenty numbers. Select the column of numbers again, then click the little down arrow to the right of the Σ icon. A little drop-down menu will appear; select Average. The average will appear at the bottom of your list, in cell A21. (b) Go to cell C1 and click Count in the drop-down AutoSum menu. Then select the numbers in your list (don’t include the average!) and hit Enter. What number appears, and why? (c) Go to cell C3 and click the Σ icon, then select the numbers in your list. (Once again, don’t include the average.) Before the formula is finished, divide the sum by the count for your list - I had to type “/count(” to get this to work, rather than selecting it out of the drop-down menu. What should this do, and did it seem to do it? 2.5 Exercises 2.7. Try creating the same results as you obtained in Excel Activity 2.2(f) using just the sum feature in column B. 9 10 3 Continuous Mathematical Functions Mathematical Objectives: • Understand the difference between parameters and variables in function definitions. • Understand functions of one and two variables. • Understand trace functions of functions of two variables. Excel Objectives: • Tabulate values of a function of one or two variables. • Use built-in mathematical functions. • Graph a function of one variable or a trace of a function of two variables. • Graph a function of two variables as either a surface or a contour plot. Application Objectives: • Determine the end conditions for a beam from a graph modeling the beam’s deflection. or sketch a graph of the deflection of a beam with given end conditions. • Determine the nature of the initial conditions for harmonic motion with a given graph. • Understand what each of the parameters C, a, b and d in the equation y = Ce−at sin(bt+ d) tells us about simple harmonic motion. • Determine whether a given graph modelling harmonic motion is for a system that is undamped, damped, and over-damped. • Understand the model for temperature variation in the ground. 3.1 Functions of One Variable Excel Activity 3.1: In this activity you will get values for the function f (x) = x = 0 to x = 4, by tenths. √ x from (a) Get the sequence 0, 0.1, 0.2, 0.3, ..., 3.9, 4.0 in column A. (b) In column B, next to the value 0 in column A, compute the value of f (0), referencing the cell in column A where the value 0 is stored. Then copy that cell down as far as you have values in column A. These should be the square roots of the values in column A. There should be at least two or three values for which you can check to be sure things worked as they should. (c) Display all values of the function to three places past the decimal. (d) It might be nice to add a little labelling to your table of values. Insert enough rows to get the first values in your table in row 4. Put “f(x) = sqrt(x)” into cell A1 and “x” and “f(x)” into cells A3 and B3. Center these last two in their cells. 11 (e) Save the file, and maybe write down somewhere here in your notes what you have named it. √ Excel Activity 3.2: Now you will see how to graph the function f (x) = x from x = 0 to x = 4. (b) Select all the numerical values in columns A and B. Left click the little Chart Wizard icon, the blue yellow and red bar graph under Window. (c) Select the chart type XY (Scatter) and the last chart sub-type, the one at the lower right. More on the differences between the sub-types later. (d) Click Next and you will see what your graph will look like. There are options to change a few things at this point, but we won’t. Click Next again and you will see yet more options, some of which we will want to use. All can be done after the graph has been completed, however, so click Finish. (e) The graph should appear in your spreadsheet, to the right of the “data”. Move the cursor into the “chart,” as Excel calls it, and note that it changes from a plus sign to an arrow. Put the arrow in the white part outside the graph until you see “Chart Area”, then on the gray, where you should see “Plot Area”. Put it near the x-axis and you should see “Value (X) axis,” then √ repeat for the y-axis.. Finally, put the arrow somewhere on the curve of f (x) = x. You should see something like “Series 1 Point “1.1”” with the coordinates (1.1, 1.21) below it. That indicates the coordinates of the nearest data point from which the graph was drawn. (f) Put the cursor arrow back into the chart area, hold down the left mouse button and move the mouse, noting that this moves the chart around. Let go of the mouse button and move the arrow to where it points at the tiny black square in the middle of the top edge of the chart. It should then change to a tiny up-down arrow. When it does, hold down the left mouse button and move the mouse up or down to stretch the chart vertically. Try the same thing on the left or right edge, and on one of the corners. (g) Now you will start to modify the appearance of your graph a bit. Note first of all that the x-axis extends to 5, whereas our x values only go up to 4. Hold the cursor arrow near the x-axis until you see “Value (X) axis”. Right click and then select Format Axis.... Select the Scale tab, then set the maximum x value at four. Click OK to finish that. (h) Now we’ll label the graph and the axes. Put the cursor arrow in the white part of the chart, until you see “Chart Area”, then right click and select Chart Options (by left clicking it). You will then see that you can add a title and labels on the x and y axes. Title this “Graph of f(x) = sqrt(x),” and label the x-axis with x and the y-axis with y. Click OK to finish. (i) Note that the graph only has horizontal gridlines; we’ll now add some vertical lines. Again select Chart Options, then select the tab for Gridlines. Note that that “Major gridlines” has been selected for the y-axis, but nothing has been selected for the x-axis. Click the “Major gridlines” box for the x-axis and look at the change shown in the graph. Try the “Minor gridlines” for each axis, one at a time, then remove those and finish, leaving only the major gridlines for the x-axis. 12 (j) Let’s get rid of the little thing that says “Series 1”, at the right of the graph. Go to Chart Options yet once more, and select the tab for Legend. Click the box that says “Show legend”, to remove the check there, then click OK. (k) There are two last things we will do. First we will change the x-axis so that it is labelled every 0.5 units, instead of every 1. Put the cursor near the x-axis until you see “Value (X) axis”, then right click and select Format Axis. Change the major unit to 0.5 and finish that. Then modify the y-axis so that the minimum value is −0.5. (l) At this point you can see that the numbers for the x-axis are hard to read because of extending the y-axis down to −0.5. This can easily be fixed. See if you can figure out how to do it by yourself before reading on. If you can’t figure it out, try this: Get to the menu for formatting the x-axis in the same way that just did, then select the tab for Patterns if it is not already selected. Then select the “Low” position for the tick mark labels. (m) Whew! After all that work, save your file. Then check to see that your graph looks like the one below. If not, go back and fix whatever still needs done. 3.3. Use Excel to graph y = − 12 x2 − x + 2.5. 3.2 Horizontal Beams Suppose that we have a horizontal beam of length 10 feet; it might be an I-beam, or maybe it is simply rectangular in cross-section. We put the cross-sectional center of its left end at the origin of an x-y coordinate plane, and the cross-sectional center of its right end at the point (10, 0). The axis of symmetry (the line on which all the cross-sectional centers lie) of the beam then runs along the x-axis from x = 0 to x = 10; see the figure to the left at the top of the next page. 13 Now the beam will deflect (a fancy term for “sag”) in some way, due to any weight it is supporting, including its own weight. The shape it takes will depend on how it is loaded and the manner in which it is supported (we will get into that soon), but one possibility is shown in the figure above and to the right. The axis of symmetry of the beam now follows the graph of a function, which we will call y(x). We will concern ourselves only with how the beam is supported, not how it is loaded. You might just assume that it is only supporting its own weight. We will also work only with situations where the beam is supported at its ends, not at places along the length of the beam. There are two ways of supporting a beam at its ends that we will consider: • Embedded: This is when the end of the beam is supported and held horizontal (probably by “embedding” it in a wall). We will use a diagram like the one to the right to indicate this manner of support, where we show only the axis of symmetry, rather than the entire beam. (Of course a beam could be embedded at an angle other than ninety degrees to the wall, but we will consider only that situation.) • Simply supported: This is when the beam is supported at the end, but is allowed to pivot at that point. That is, it is “hinged.” We will illustrate this condition in the way shown to the right. The way that a beam is supported at its ends will determine the general shape it will take when is sags. For example, a beam that is embedded at both ends will take the shape shown to the right. 3.4. (a) Sketch a diagram showing the deflection (shape) of a beam that is simply supported at the left end and embedded at the right end. (b) Sketch the shape of a beam that is simply supported at both ends. (c) We can also let an end of a beam be “free,” meaning that it is not supported at all. Of course a beam could not be free at both ends! Sketch the shape of a beam that is embedded at the left end and free at the right end. 1 1 3 3.5. Use Excel to graph the function y = − 384 x4 + 24 x − 16 x2 from x = 0 to x = 8. This function models the deflection of an eight foot beam. How are the ends of the beam supported? 14 3.3 Simple Harmonic Motion Suppose that we have a mass hanging on a spring, as shown to the right. In most cases we are not really interested in exactly this situation, but it is a good place to start in understanding the reaction of a car’s shock absorber to a bump in the road, or the movement of a bridge as traffic passes over it, etc. We will let y represent the vertical position of the mass, with zero being where it is when it hangs motionless (we’ll refer to this as the equilibrium position), and the positive direction being up. If we give the mass a sharp hit upward it will begin to vibrate, travelling up, then down past the equilibrium position, back up, and so on. As it does this, the position is a function of time. If we assume, unrealistically, that there is no resistance and if we create a graph with the position on the vertical axis and time on the horizontal axis, the graph is a sine function, as shown below and to the left. Consider now the same mass, but hanging in a tub of oil, which then resists the movement of the mass. In this case the motion will be similar to that for the previous situation, but the oscillations will become smaller and smaller, until they die out altogether. The graph of the motion would be as shown above and to the right. Motion of a mass on a spring like this is called simple harmonic motion. In the case where there is no resistance, the motion is called undamped, and when there is resistance, the motion is damped. There is no such thing as truly undamped motion; the spring itself has some amount of resistance, and there is a very small amount of air resistance as well. There are other ways that we could set the mass in motion. The graph below and to the left represents a situation where the mass is pulled down a bit from equilibrium and let go. The motion is damped. For the graph below and to the right the mass is set in motion by first lifting it a little, then giving it a bit of a shove upward; the motion is undamped. As stated before, the position y of the mass is a function of time t, so we can write y = y(t). Remembering that up is the positive direction and that the velocity at time t is the derivative y 0 (t), for the picture above and to the left we have y(0) < 0 and y 0 (0) = 0. That is, at the starting time t = 0 the mass is below the equilibrium point, and it has zero velocity when it starts out. For the situation above and to the right, y(0) > 0 and y 0 (0) > 0. We call these conditions initial conditions. 15 3.6. (a) Both of the first two graphs on the previous page are for the same initial conditions. Give those conditions in terms of the function y, as just described. (b) Sketch the graph of undamped simple harmonic motion with y(0) = 0 and y 0 (0) < 0. (c) Sketch the graph of damped simple harmonic motion with y(0) < 0 and y 0 (0) > 0, which should be a little different than the graph to the right at the bottom of the previous page. (d) Sketch the graph of damped simple harmonic motion with y(0) < 0 and y 0 (0) < 0, which should be even more different than the graph to the right at the bottom of the previous page. In general, the mathematical equation that models harmonic motion is y = Ce−at sin(bt + d). The values C, a, b and d are constants that vary depending on the mass, spring, damping, and how the mass is set in motion. Once we know those conditions, however, the values of the constants become fixed. Values like this are generally called parameters. The only true variables here are t and y, with y depending on t. Usually the time t would be measured in seconds, and the height y in some length units like inches or centimeters. Excel Activity 3.7: (a) The table to the right is a portion of a spreadsheet for modeling simple harmonic motion. Create such a spreadsheet, with the times going up to 4 seconds. Use fixed referencing in such a way that any change in the parameters results in an immediate change in the y values. Save your file. (b) Create a plot that looks like the one above and to the left. When the values of the parameters are changed to C = 2, a = 0.1, b = 6 and d = 0.5 the appearance of the plot should change to that shown above and to the right. Try to get all gridlines and titles exactly as I have shown them. (To get two lines in the title, I simply obtained the first line as we did before, then added the second line right in the chart itself.) Save again. 16 (c) You can now vary the parameters and see their effects on the motion of the mass via your plot. Recall the concepts of amplitude and period (which is closely related to frequency) from trigonometry. Which of the parameters seems to control amplitude? (d) Which of the parameters controls the period (and, consequently, frequency)? (e) Which parameter controls damping? (f) What is the remaining parameter, and what does it seem to control? 3.4 Functions of Two Variables It is likely that in the mathematics you have taken so far the only functions you have dealt with were functions of one variable, like f (x) = x2 . Many function of interest are functions of more than one variable, however. An example would be the function f (x, y) = x2 − 0.5y 2 of the two variables x and y. To determine the function’s value at any point (x, y), we simply put the values for x and y into the function and evaluate it. For example, f (−0.3, 0.8) = (−0.3)2 − 0.5(0.8)2 = 0.09 − 0.32 = −0.23 In this section you will first obtain values for a function of two variables, then you will graph the function. Finally, you will graph some vertical “slices” through the graph of the function. Excel Activity 3.8: (a) Enter “f(x,y) = xˆ2 - 0.6yˆ2” in cell A1. (b) We will get values for the function by tenths, for −1 ≤ x ≤ 1 and −1 ≤ y ≤ 1. Enter the values of y from y = 1 to y = −1 in column A, starting in cell A4. make sure the values go from positive to negative. If this works the same way for you as it did for me, you will get 1.39E-16 where we would expect zero to be! I can’t explain why this happens - maybe I’ll get it figured out sometime. To fix the problem, format all the cells with numbers in them to have one place past the decimal. (c) Enter the values of x from x = −1 to x = 1 in row 3, starting in cell B3. Note that this arranges the values of x and y in the order they appear in the xy-plane. You will have to format those cells as well to get zero in the right place. Enter “y\x” in cell A3, center all entries horizontally, and make them all bold so that they will stand out from the values that will end up in the body of the table. (d) Enter the formula for the function in cell B4 and copy it down column B to the row containing y = −1. Find the value of f (−1, 0.5) “by hand” (using your calculator, of course!). The result should NOT agree with what you got in the spreadsheet, unless you were thinking ahead. Go to the cell containing the value of f (−1, 0.5) and look at the formula in that cell. Alter your formula in cell B4, copy it again and see if you get the correct value of f (−1, 0.5) now. If not, get some help or try again! (e) Copy all the values of f (x, y) in column B to the right, to where x = 1. Check the value of the function for some point where neither x = −1 nor y = 1 to see if the formula is giving the correct values. If not, fix again. (When you fix it you will have to change the formula in cell B4, then copy both down and across again.) Save your spreadsheet. 17 3.9. You can now determine various things about the function from the values in your table. (a) What is the maximum value of the function for the region −1 ≤ x ≤ 1, −1 ≤ y ≤ 1? Where does that value occur? (b) What is the minimum value, and where does it occur? (c) Does the function increase, or decrease, from (−1, 0.5) to (0, 0.5)? (d) Describe what happens to the values of the function as one travels from (−1, 0) to (1, 0). (e) Describe what happens to the values of the function as one travels from (0, −1) to (0, 1). Excel Activity 3.9: In this activity you will create a graph of the function from Activity 3.8. To do this, we think of the function values f (x, y) as a third variable z, and we plot a graph in three dimensions. The xy-plane is a horizontal plane, and the values of z can be thought of as “elevations” above or below the xy-plane. (a) Select the function values. (Remember that the x and y values ARE NOT function values!) Click the Chart Wizard and select Surface and the first subtype, which is the default. Go ahead and finish the graph; when asked for a location, select “As new sheet,” which will make it Chart 1. Save your file. Take a look at the graph of the surface. The point where x = 0 and y = 0 is called a saddle point; the reason for this should be obvious! The vertical axis gives values of the function, f (x, y). The other two axes are labelled rather strangely. Can you tell by the function values in your table which edge represents x values and which represents y values? Now look at the colors. The part of the surface that is colored light yellow is the part where the function values are between −0.2 and zero and so on, as indicated by the legend to the right. (b) Well, I thought we would be able to change the labelling on the x- and y-axes in the same way that we did for the graph of a function of one variable, but that doesn’t work. So at this point I don’t know how to get the correct numerical values on those two axes! You might take a few minutes and see if you can figure it out. You should also put the pointer area somewhere in either the plot area or chart area, right click and choose the 3-D View option. Play around a bit with what you see there, noting the effect on the graph. (c) Put the pointer in the plot area or chart area and right click again. Select Chart Type..., then choose the subtype in the lower left and click OK. This gives a contour plot of the function, the mathematical version of a topographic map. When you first get it, there are only three colors and not too many contour lines. Here’s the only way I’ve figured out so far to get more contour lines: Change the chart type back to the surface plot you just had, and put the pointer on the labelled vertical axis until you see the little sign saying Value Axis. Right click and select Format Axis..., then change the Major unit to 0.2. Then change the chart type back to the contour plot and you can see the additional contours. 18 Excel Activity 3.10: There are three commonly used ways to try to visualize what a surface in space is doing. You saw two of them in the previous activity - you can get a plot of the surface, or you can get a graph of what we would call contour lines on a topographic map; mathematicians call these lines level curves of the function. The third method is to look at “slices” through the surface, usually in a direction parallel to one of the axes. You will see how to do this in this activity. (a) Find where all the function values for a fixed value of x = 0.8 are; they are in the column where x = 0.8, probably column T. Highlight the function values in this column and select XY (Scatter) for the chart type. Finish as we did for graphs of a function of one variable, using Chart 3 as the location. (b) Since we are looking at the slice where x = 0.8, the independent variable on the horizontal axis should be y, and the variable on the vertical axis is f (x, y), which we often refer to as z. Label those two axes appropriately, and title the whole graph “Slice through f(x,y) = xˆ2 - 0.6yˆ2 at x = 0.8.” Save again. (c) Take a close look at the scale on the horizontal axis and you will see that it is not correct. To fix this, put the cursor somewhere in the chart to where you see Chart Area next to the cursor. Right click and select Source Data ..., then click the tab at the top for Series. Click in the box that says X Values: (which are actually going to be y values, since x is fixed at 0.8), then go back to Sheet 1 and highlight the values for y in column A. Click OK and the save again. (d) Compare all three of your charts and make sure you see what the graph in Chart 3 is showing you. (e) In Chart 4, create the slice through the surface at y = −0.5. Label the graph appropriately and save again. Make sure you also see what this graph is showing you, as compared to the surface plot and contour plot. 19 20 4 Product-Sums (Integration) Mathematical Objectives: • Understand strings or arrays of data as discrete functions. • Compute sums of products for discrete functions of one and two variables. Excel Objectives: • Find averages and sums of strings and arrays of values. Application Objectives: • Compute average values for strings or arrays of data obtained from measurements. • Compute distance travelled, work, volumes under surfaces. 4.1 Distance Travelled The following times and speeds are obtained for the travel of an automobile over a three hour period. Your objective here is to estimate, or approximate, the distance that the car travels during that time period. Time (hours): Speed (mph): 0.0 62 0.5 58 1.0 61 1.5 65 2.0 64 2.5 67 3.0 63 1. Sketch a number line and mark off the times below the line at evenly spaced intervals. Above the line, over each time mark, put the corresponding speed. How many time intervals are there? The idea is simply to find the distance travelled for each time interval, using distance = rate × time, then total up the distances for all the intervals. The only real challenge is to decide what to use for a speed for each interval. One way to get a speed for each interval is to just use the speed at the start of the interval as the speed for the entire interval. For the first interval we would then get a distance of d = 62 mph × 0.5 hour = 31 miles. Continuing, we get Total distance ≈ 62(0.5) + 58(0.5) + 61(0.5) + 65(0.5) + 64(0.5) + 67(0.5) = 188.5 miles The method we used here is called the left endpoint method (since we used the speeds at the left endpoints of the intervals) with n = 6 and ∆t = 0.5. n is the number of intervals that we break the entire time period up into, and ∆t is the length of each interval for which we compute a distance travelled. We could have used n = 3, in which case we would have ∆t = 1.0. 2. Approximate the distance travelled by the right endpoint method (you should be able to guess how this works) with n = 3. Write out how you get your answer in the way that I did above. 21 3. Another method that can be used is the midpoint method, which uses the speed at the midpoint of each interval as the speed for that interval. Note that we cannot do this for n = 6 because we don’t know the speeds at the midpoints of the six smaller intervals. However, we can do it with n = 3; the first interval is then from t = 0 to t = 1 and we know the speed at the midpoint of the interval is 58 mph. That is the speed we use to estimate the distance travelled during the first time interval. Approximate the distance travelled by the midpoint method with n = 3, showing the details as above again. 4. Going back to n = 6, another way to get a speed for the first interval is to average 62 + 58 the speeds at its two ends: speed = = 60 mph. Complete the following to 2 approximate the total distance: ¶ µ 62 + 58 (0.5) + · · · Total distance ≈ 2 We’ll call this the endpoint averaging method. For reasons you’ll see later, it is also called the trapezoidal rule. Excel Activity 4.1: In this exercise you will approximate the distance travelled for a larger set of data, which is stored in an Excel file I e-mailed you, called “Activity 4.1 Data”. (a) Look at the data. The smallest time interval you can use is ∆t = 0.1 hour. Using this ∆t, how many intervals are there? Use the letter n for the number of intervals. (b) We can use any ∆t we want as long as • it is a multiple of 0.1 and • it divides into three hours an even number of times. For each of the following values of ∆t, either give the corresponding value of n or write NP for “not possible.” ∆t = 0.2, 0.3, 0.4, 0.5 (Give your answers by writing both the ∆t and its corresponding n.) (c) Use the left endpoint speed to estimate the distance travelled in the first interval, using ∆t = 0.1. Do this by putting the appropriate formula in cell C5. (d) Copy the formula as far down as needed to get a left endpoint approximation for n intervals. Remember that when doing a left endpoint approximation the last data value is not used! (e) To get the total distance travelled you will need to total the distance approximations for each interval. We will put the total distance travelled in cell C36. Select the cells from C5 down to (and including) cell C36, then click the AutoSum icon Σ. That will sum up all of the cells in column C. (f) Type “Total distance:” in cell B36, make it bold, and widen column B enough so that all of it can be seen. Change the title at the top of the spreadsheet to “Left endpoint, n = ”, where you supply also the value of n. Save your file as your first name followed by 4.1. 22 4.2. Continue with the same file for this exercise. (a) What is the smallest ∆t for which the midpoint method can be used? What will n be in that case? (b) Copy the original data into Sheet 2. To the right of the first speed that you will use for the midpoint method, put a formula to compute the approximate distance travelled during that interval. (c) You will now want to copy your formula for the distance travelled in the first time interval to the other places where the distance needs to be computed, but it will not be every interval. Select your formula and all the cells below it that will be empty. Then copy that block of cells far enough down to get all the midpoint approximations needed. Make sure they are in the correct places, including the last one. (d) Sum up the distances as you did with the left endpoint method; your answer should be relatively close to your answer from the left endpoint approximation. Annotate your table in a manner similar to what you did for Sheet 1 and save your file again. 4.3. In Sheet 3, do a right endpoint approximation with n = 5. Annotate as before and save again. 4.4. Insert a new sheet, Sheet 4. Do the endpoint averaging approximation with ∆t = 0.3. Annotate and save. 23 4.2 Sums and Averages of Arrays Excel Activity 4.5: Enter the values shown to the right into Excel. In this exercise you will see various ways of summing and averaging in Excel, using this data. (a) Select the first row, then click the AutoSum (Σ) icon. What did this do, and where was the result put? Click the Undo icon (right below the word Format on the top tool bar). (b) Select the first column, then click the Σ icon. What did this do, and where was the result put? Click the Undo icon again. (c) Select all the data values, then click the Σ icon. What did this do, and where were the results put? Click the Undo icon. (d) Click on cell D4 and type in “=sum(”. Then select all the data values and hit Enter. What did this do, and where were the results put? Click once in the formula bar and you will see that the blue reference in the formula is boxed in blue in the spreadsheet. Click a blank cell, then cell D4. Now double (left) click cell D4 and you will see the same thing as when you clicked the formula bar. I’ve found that if I don’t hit Enter at this point I sometimes mess up the formula. Click the Undo icon. (e) In cell A5 type “=average(”, then select the cells A1, A2, B1 and B2 and hit Enter. What did this do, and where were the results put? (f) Copy the formula in cell A5 to cells A6, B5 and B6. Then click on cell B6 and click in the formula bar to see what is being done to get the value in that cell. What is being done? 4.3 Depth of Fill The picture below and to the left shows a 3-D cross-sectional picture of a 20 foot by 20 foot volume of dirt with an uneven surface. To the right of it is a map view of the 20 by 20 square, with measured dirt depths at eight points around the edge of the square and one more point at the center. Note that the dashed lines divide the square into four smaller squares. 24 4.6. Our goal in this exercise will be to approximate the volume of dirt under the surface, over the base square. If the surface of the dirt was flat with, say, a depth of 7 feet over the entire square, then the volume of dirt would be length × width × height = 10 feet × 10 feet × 7 feet = 700 cubic feet If the surface was flat over each smaller square, but the depth varied from square to square, we could just compute the volume of the dirt over each smaller square as we did the entire volume above, then add the volumes to get the total volume. Of course the surface of the dirt is not flat anywhere, so we must find some alternative to this plan. (a) We could compute the volume of the dirt in the most northwesterly square by assuming its depth was, say, 8.6 feet, the value in the “upper left” corner. A better idea would be to average the depths at the four corners of that square and use that average as the height by which to compute the volume. Do this using just your calculator; record your results. (b) Repeat for the other three smaller squares, and find your approximation for the total volume, again using your calculator. Record your results. (c) Enter the data (depths at the nine points) in Excel, giving a three by three table. Below that (leave a row or two empty) create a table of the average depths for the smaller squares, using what you learned in Excel Activity 4.5. (d) Below that table, make another table of the approximate volumes of dirt over each square. Total those somewhere in the spreadsheet to find the total estimated volume. Make sure it agrees with what you obtained by hand; if not, find the error in your work. 4.7. Use the “Fill Dirt Data” file you got from me (get it if you don’t have it) for the following. The x and y values are map positions in feet from an origin in the lower left. The data values are depths at grid points. (a) Create a contour map of the surface with 2 foot contour intervals. You will find that your contour map is “upside down” relative to the orientation of the data. I was able to correct this when I did it myself, but I forgot how and can’t figure it out now! If you can find the way to do it, please let me know. (b) What is the size of each map square? how many squares are there in the grid? (c) Create a table of the average depth in each square in Sheet 2. If you can’t figure out how to reference Sheet 1 from Sheet 2, ask me or someone else for help with it. (d) Create a table of the volume over each square in Sheet 3, and get the total volume there. Change this to cubic yards. (Draw a sketch to help you determine how many cubic feet are in a cubic yard - it is not three! 25 26 5 Initial Value Problems Mathematical Objectives: • Understand initial value problems from a discrete viewpoint. Application Objectives: • Model tank mixing, tank draining, Newton’s law of cooling. Consider the following scenario: A closed fluid system (similar to your vehicle’s cooling system) contains fluid that has a certain amount of contaminant in it, and you wish to remove the contaminant. The obvious way to do this is to drain the system and replace the contaminated fluid with uncontaminated. It could be possible, however, that fluid must remain in the system, for whatever reason. In that case one must find a way to remove the contaminant without removing the fluid. One way to do this is to remove contaminated fluid from the system at a certain rate, putting clean fluid in at the same rate. In this way the total volume of fluid is unchanged, but contaminated fluid is slowly replaced by uncontaminated. It is possible to use the theory of differential equations to solve problems of this sort, but you are not expected to have had a course in that subject. In addition, analytical methods cannot always be used to solve problems involving differential equations but, in many cases, there are numerical methods for solving such problems. In this section you see a simple numerical method for tackling problems like the one above. 5.1. Consider this scenario: A 200 gallon tank of water has 25 pounds of salt dissolved in the water. Water is drained from the tank at a rate of four gallons per minute and, at the same time, a 0.05 pounds per gallon solution is pumped in at the same rate of four gallons per minute. We will assume (unrealistically!) that the incoming solution is continually mixed with the solution already in the tank. So what is the “problem” and how do we solve it? Well, our goal is to determine the amount S (in pounds) of salt in the tank at any time t minutes after the process of draining and filling is begun. As you proceed through the following, show clearly how all answers are obtained, including units. (a) What is the initial concentration (pounds per gallon) of salt in the tank? That is, how much salt is in each gallon at time t = 0 minutes? (b) If all of the original solution was replaced completely with the incoming solution, how many pounds of salt would be in the tank? (c) Assuming that the concentration of salt in the tank does not change in the first minute of the process, how much salt will leave the tank in the fluid being drained? (d) How much salt will enter the tank in the first minute via the the incoming fluid? (e) What is the net change of salt in the tank for the first minute? Is it a loss or a gain? Use the appropriate sign for the change, negative if it is a loss, positive if it is a gain. (f) How much salt would be in the tank at the end of the first minute; that is, how much salt is in the tank at time t = 1 minute? 27 5.2. (a) Using your answer to 1(f) you can calculate the concentration of salt in the tank at time t = 1. What is it? (b) Assuming that the concentration remains the same from t = 1 to t = 2, how much salt will leave the tank during that time? (c) How much salt will come into the tank during that minute? (d) What is the net change in salt during that minute? (e) How much salt is in the tank at time t = 2? 5.3. (a) Make a table with the following columns: time, pounds of salt, concentration of salt, salt out, salt in, net change. (b) In the first row of your table enter zero for the time, followed by your answers to 1(a), (c), (d) and (e). (c) Enter one for the time in the next row, and next to it put the amount of salt at one minute, your answer to 1(f). (d) Fill in the rest of the second row with the appropriate values from Exercise 2, and begin filling out the third row with the time and amount of salt. Then finish the third row, fourth row, and begin the fifth. 5.4. (a) Use Excel to create and continue the same table. Carry the time out as far as you think is appropriate, then graph the amount of salt versus time. Add a title and labels on the axes, and make any other helpful modifications. (b) Where do you see the initial 25 pounds of salt on your graph? (c) How does your answer to 1(b) figure into the graph? The above is an example of an initial value problem, which means a situation in which we know • the value of some quantity at some “starting” time (called the initial value), and • some sort of information about the rate at which that quantity is changing. For the above situation there is the initial value of 25 pounds of salt, along with three parameters: the amount of fluid in the tank, the rate ate which fluid is being drained form and put into the tank, and the concentration of salt in the incoming fluid. The graph that you obtained is what we would call a model of the situation. 5.5. Alter your spreadsheet in such a way that the initial amount of salt, volume of the tank, rate at which fluid is drained and filled, and the concentration of salt in the incoming fluid can each be changed, giving the corresponding immediate change in your table. Then set all those values the way they were for the original scenario. (a) What should happen if the incoming solution is pure water? Check to see if your model behaves this way. (b) For both the original model and the change made in part (a) the amount of salt in the tank should decrease over time. What parameter would have to change to make the amount of salt in the tank increase over time? For what values of that parameter would the amount of salt increase over time? Again, check with your model. (c) Put all parameters back as they were originally. What should happen if the rate at which fluid is replaced is increased? Again, check against your model. 28 6 Linear Regression Mathematical Objectives: • Determine the equation of a line containing two points. • Compute the sum of squares of residuals for a line and a set of xy-data points. • Understand the mathematical significance of the regression line for a set of xy-data. Excel Objectives: • Use the Excel regression data analysis tool to find the equation of a regression line. Application Objectives: • Compute the regression line for a set of data. • Interpret the slope and intercept of the regression line. Excel Activity 6.1: For this activity you will need the file Linear Regression Data. (a) Graph the data using the XY (Scatter) chart type, but selecting the first subtype, which is the default. Label the axes with x and y. (b) The data is arranged roughly in a line. Estimate the slope and y-intercept of a line that would pass through the “center” of all the data and enter those values in cells B1 and B2. (c) In the column labelled “predicted y”, enter a formula that will compute the y values that are on the line with your estimated slope and y-intercept, for the corresponding x values in column A. Use the appropriate referencing to compute y = mx + b using the slope and intercept in cells B1 and B2. (d) Now graph the data in the first three columns in the same manner as you did originally. It is not hard to do this, getting the actual y values to show up in dark blue and the predicted y values in pink. (e) The difference between the actual y value and the predicted value for a given x is called the residual. Put a formula in cell D6 that computes the square of the residual for the first x. Copy this formula down to obtain the squares of the residuals for all of the x values. (f) Add up the squares of the residuals. Now the goal of a process called linear regression is to find the line that gives the smallest value for the sum of the residuals. That line is called the regression line or least-squares line. Your goal is to use your spreadsheet to try to find the slope and y-intercept of that line. (g) Start “fiddling” with your slope and y-intercept values, watching the sum of the residuals. How small can you make the sum? 29 There is a mathematical method for finding the slope and intercept that minimize the sum of the squares of the residuals, but it is beyond the scope of this course. However, Excel can do it for us! (h) Click Tools, select Data Analysis, then Regression and OK. (i) Click in the “Input Y Range” box, then select all of your y values. Repeat for x. (j) Excel is about to spew out a bunch of information for you, and you need to tell where to put it. The default is “New Worksheet Ply”, which puts the results in another sheet. To put it in the same sheet, select Output Range and click in the bar to the right. Then click on some cell below all of your data, like cell A29 or so. Check the box for residuals and click OK. (k) Now you see a whole bunch of information. The main thing we want to look at is at the left of the third box down. There you will find the intercept and slope (“X Variable”) of the regression line. put in those values for m and b and note that they give a smaller sum of squares of the residuals than what you obtained by guessing. 30
© Copyright 2026 Paperzz