Math 2524: Activity 1 (Using Excel) Fall 22 Often in a problem situation you will be presented with discrete data rather than a function that gives you the resultant data. You will use Microsoft Excel to analyze and graph data and discover a possible function to fit the data. This is called Mathematical Modeling. You will start by learning to type in the data on a Microsoft Excel spreadsheet and then consider different ways to represent this data graphically. By the end of the semester, you will feel comfortable with data, functions and graphs. Lab #1, Part#1: Work through all examples carefully before trying the Homework! Consider the following data points giving the national defense spending in billions during the period from 197 through 1994: The independent variable for the data has been aligned starting with 197 = to 1994 = 24. {(, 262.9), (2, 219.7), (4, 185.3), (6, 177.8), (8, 177.2), (1, 187.1), (12, 214.3), (14, 241.7), (16, 276.4), (18, 283.3), (2, 272.5), (22, 25.2), (24, 22.1)} To enter the data on your spreadsheet, use the mouse to highlight the cell where you wish to start. You may enter the data in rows or columns. First try entering data in column form. Use the cells A1 and B1 to label your data X and Y. Type in the first x-value (which is ) into cell A2 and then hit the arrow key to move to the next cell or click on the next cell. If you do not like the width of a column you may change it. To do so, highlight the entire column and then go to Format on the main menu bar at the top of the screen. Select Column, then Width. Click the mouse to open a dialog box that will allow you to change the width. Move cursor back to the original cell. If data is known to be linear (the amount of change is always the same) then you can use another technique (Edit-Fill-Series) to enter the data. Click mouse on Edit and then click on Fill and finally on Series. You will now see a dialog box. Now click on Column and Linear and type in the quantity (2) for your Step Value and (24) for your Stop Value and click on OK. The first column now contains the x-values. Now put the y-values into the second column. You will have to type this data cell by cell since it is not linear. Once your table has been typed into the spreadsheet, you will need to look at a graphical representation. This time you will use embedded graphs. To do this, complete the following steps: a) Highlight the data (and labels) in both columns. b) Click on the ChartWizard (The icon looks a bar graph) c) The dialogue box appears automatically. Now choose the xy-scatter chart type for your graph and next choose a chart sub-type with the data points connected by lines and then click next. When you choose the xy-scatter graph the first column of your data is automatically used as the domain or the x-axis values. Click OK twice (once on the current screen and also on the screen for step 2). d) When the third dialogue box appears, you will now label your graph with the title Defense Spending and label the x-axis with years and the y-axis with billions of dollars. ALWAYS clearly label your graphs and axis before turning in homework. You may also wish to click on gridlines tab to add or delete these lines. You can also click on legend tab to remove the legend from your chart. Again click on OK twice to finish your graph. e) If you wish to make some changes to the graph, click on the part of the graph you wish to change and an options box will appear. For instance, click on the y-axis if you wish to change the scale on the y-axis. Repeat the above choosing a different graph or chart representation of your data to see the differences. (After you have chosen the original xy-scatter plot you may choose a smooth curve to represent your graph as a continuous function instead of a set of data points connected by lines. When you finish your graph should look something like the one at the top of the following page. Page 1 of 6
Math 2524: Activity 1 (Using Excel) Fall 22 X Y 262.9 2 219.7 4 185.3 6 177.8 8 177.2 1 187.1 12 214.3 14 241.7 16 276.4 18 283.3 2 272.5 22 25.2 24 22.1 Spending (billions of dollars) 3 25 2 15 1 5 4 8 12 16 2 24 28 years Other Useful Information: When you finish with chart wizard your graph is highlighted. Click the mouse on an empty cell outside the graph and the highlight will disappear. If you leave the highlight on then you will only see a large graph and no data or text when you print. If you wish to delete your graph and start over again, then highlight graph and go to Edit-Cut. If you wish to move the graph around then highlight and click on the white background of the graph and drag. Always go to Print-Preview before you print so you can see what your printout will look like. If your graph is split between two pages you must adjust it. Part #2 Next you will use a function representation to type in the data needed. Consider the function y = x 3 x 2-6x + 1 for -4 x 4 1) In the first column type in the x-values using Edit-Fill-Series technique. Be sure to label your columns. 2) In the second column create the y-values using the formula for the function as follows. In the first cell type in the following: =A2^3-A2^2-6*A2+1 (since the x-values begin in cell A2). Hit return and then drag cell B2 down 9 cells by clicking the handle at the lower right corner of the box. This will give you the desired y-values in column B. 3) Now, as before, use Chart Wizard to create a graph of the data. Your completed graph should resemble the following: X Y -4-46 -3-8 -2 1-1 14 1 1 4 2 2 3 1 4 34 y y=x^3-x^2-6x+1 4 2-2 -4-3 -2-1 1 2 3 4-4 -6 x Now you will learn to use Excel to graph and analyze two functions at the same time. For an example consider the revenue equation R = 2q+2 and the cost equation C=2-2q 2. You will now graph these equations on the same axes and determine the break-even point. Then, by hand, verify your answer. 1) Type in labels q in cell A1, R in cell B1, and C in cell C1. Then type the initial value for q in the cell A2. Next create additional values in column A as before using Edit-Fill-Series. (You may have to come back later and adjust these values in order to show the point of intersection) Page 2 of 6
Math 2524: Activity 1 (Using Excel) Fall 22 2) In cell B2, type in the first equation =2*A2+2. Hit return to move out of cell then move back into the same cell. Then Drag cell as before to see values for column B. 3) In cell C2 type the second equation =2-2*A2^2 and repeat as in step 2) to fill column C. 4) Now graph your data. Highlight the data (including labels) and go to the ChartWizard Icon as before. (Be sure to choose the xy-scatter plot first and be sure to leave the legend on your graph this time since you are plotting more than one equation on the same set of axes.) The break-even point is (9, 38) as you can see from your data points 5) Be sure your graph is carefully labeled. q R C 2 2 1 22 198 2 24 192 3 26 182 4 28 168 5 3 15 6 32 128 7 34 12 8 36 72 9 38 38 1 4 11 42-42 12 44-88 13 46-138 14 48-192 Break-Even 2 15 1 5-5 2 4 6 8 1 12 14-1 -15-2 q R C Part #3 In this part you will see how to use Excel to find a best-fit equation for your data. You will use the following data as an example. Example #1 The national defense spending in the billions for the period from 197 through 1994 is given in the following data already typed into a spreadsheet where the year values represent the number of years after 197. Generate a graph for this data as you did in previous examples using XY-Scatter chart type with unconnected data points. year billions 262 2 219 4 185 6 15 8 177.2 1 185 12 214.3 14 214.7 16 276 18 283 2 272 22 25 24 22 spending (billions of dollars) 3 25 2 15 1 5 5 1 15 2 25 3 year (# of years after 197). You will now try to produce an equation that will come the close to representing this data. First double click anywhere within the chart. Next click on any one of the data points. This should cause all data points to be highlighted. From the top menu bar, click on Chart and then add Trendline. Click on the page tab Type and choose the type of equation that you wish to try to fit to your data. You may wish to try a polynomial of degree (order) 2. Make sure that information appears on your screen and then click on OK to view the results. Page 3 of 6
Math 2524: Activity 1 (Using Excel) Fall 22 spending (billions of dollars) 3 2 1 4 8 12 16 2 24 28 year (# of years after 197) A quadratic model does not appear to be a very good fit so you will want to remove that trendline and try something else. Click on the trendline to highlight it on your chart. Go to Edit-Undo Add Trendline (or Clear Trendline). Your first trendline should disappear and you are ready to try again. Highlight the data points again and click on Chart-Add Trendline to get the dialogue box and this time try a polynomial of degree (order) 3. Click on polynomial and then the arrow button to increase the order to 3 spending (billions of dollars) 3 2 1 4 8 12 16 2 24 28 year (# of years after 197) This fit is much better. To format your trendline, highlight the trendline and click on Format. You will have a variety of patterns, colors, etc. to choose from. You can see that the cubic model is a pretty good fit, but you need to know the equation of the model in order to be able to use the information given. Now you will develop an equation to best-fit our data. Double click on the trendline and click on Chart-Add Trendline-Options. Select Display Equation on Chart and click on OK. You may need to click on your equation and drag it to a location on the graph where it is more visible. Your graph should resemble the following: spending (billions of dollars) 3 2 1 y = -.141x 3 + 3.976x 2-37.5x + 269.36 4 8 12 16 2 24 28 year (# of years after 197) Page 4 of 6
Math 2524: Activity 1 (Using Excel) Fall 22 You should always label your graph carefully, if you have not already done so. To do this now, click on chart area on the graph and click on Chart followed by Chart Options. Make changes on the chart as needed or according to personal preference. Remember, if the equations cannot be seen clearly then click on the equation and drag it to a location where it is more visible. You can also increase the equations size or make it bold, if you wish. Note: When you are in the Trendline option box you will notice a box option for a logarithmic function. If that box is blank or it will not work when you click on it, then you have an independent data point of zero included in your data set and log functions are not defined for zero. If you go back and delete that value from your data set then you can make use of the log function options box. Aligning Data: Often you need to align your data before you find an equation for your model (but not always). This helps obtain an equation that is more readable and easier to work with. Usually you align data when large values (such as years) are used for the domain values. For instance if you have the following data: Year 1983 1985 1989 1992 1997 Number of members 2 3 32 45 5 It is better to align the data in cases such as this. If you do not, often your trendline equation is difficult to work with or confusing. To align the data, first let the first year (1983) be year. Then simply subtract 1983 from each of the following numbers to get the appropriate alignment, as shown in the following table: Year 2 6 9 14 Number of members 2 3 32 45 5 Now you can proceed to find a manageable model for the aligned data. Problems to Turn In: 1. Applications in Business: The demand equation p = 17 4q 2 indicates that as price goes up the demand for the product goes down. The supply equation p = 1 + 6q 2 indicates that as price goes up the supplier will produce more units of the product. The point of intersection is called the point of equilibrium. At this point, the equilibrium price is the price at which the consumers will purchase the entire quantity of units for sale (equilibrium quantity). Graph both equations on the same axes and use the graph and data to guess the point of equilibrium. (Graph over the interval q = to q = 6. Use Edit-Fill Series and a step value of 2). Your graph should be clearly labeled and both the data set and the graph must be shown on the same page (no large single page graphs, please). Leave the legend on your graph since you are plotting more than one equation on the same set of axes. Be sure to clearly answer question (i.e., What is the equilibrium point?) in a complete sentence that identifies both the equilibrium price and the equilibrium quantity. Page 5 of 6
Math 2524: Activity 1 (Using Excel) Fall 22 2. A school band will be selling candy to make money to take a trip during spring break. To purchase the candy for resale, the band must pay $4 fixed cost plus 2 cents per candy bar. They plan to sell the candy bars for $2. each. (For each part, show all work and answer questions in complete sentences appropriate to the context of the problem.) a) Find the cost equation. What is the cost of ordering 3 candy bars? b) Find the average cost equation. What is the average cost when 3 candy bars are ordered? c) Find the revenue equation. What is the revenue when 3 candy bars are sold? d) Find the profit equation. What is the profit when 3 candy bars are ordered and sold? e) Graph the cost, revenue, and profit equations all on one set of axes over the interval [, 1] using a step value of 5. Label your columns carefully and highlight labels and data to graph. Be sure to leave the legend displayed on your graph. 3. A beach nourishment program was started near Jamestown, Virginia, in 192 in order to preserve as much historical land as possible. The amount of sand (in millions of cubic yards) being pumped onto barrier islands is given in the following table: Year 192 193 194 195 196 197 198 199 Amount of Sand 8 21 21 23 3 65 79 96 a) Align your data. b) Graph the data and use Excel s Trendline function to find a linear model for the data. Be sure to label the graph and show the equation. c) Redo finding an exponential model. (This should be a new graph). Again, label graph and show the equation. d) Redo finding a cubic model. (This should be a new graph). Again, label graph and show the equation. e) Which model do you think works best for this data? Why?** **How to find the "Best fit Equation" for your data will be discussed in detail in sec 2.5 Page 6 of 6