Precalculus, Lab 4: Linear and Quadratic Models

January 26, 2012

Introduction

In this lab you will use Mathematica to find linear and quadratic models for certain data.  You use this Mathematica notebook as a starting point, adding your own work where appropriate.  This lab is due on Monday.  

Before you begin the lab:

Write your name and your lab partners’ names below:

Names: (Fill in your names here.)

Use Save As to rename this file by adding your name and your collaborators' names at the end of the file name and save the file in the folder labeled "Lab 4", in the Collaborative folder of the Math170 folder, in the Classes folder on the M-drive.

Print a copy of the lab, so that you can are able to refer Problem 1 when you are working on Problems 2 and 3, without  a lot of scrolling up and down.

Print a copy of the hand-out with tables of data, which is posted on the course website.

A few Mathematica tips:

Be patient with yourself as you are learning how Mathematica works!

Save your work to your M-drive often!

Be careful about the syntax: case matters, as does the difference between round parentheses, square brackets, and curly braces.

Ask questions when you’re stuck.

Problem 1: Linear Model for Children’s Weight as a Function of Age

In this problem you will use Mathematica to find a linear model to fit the data in the Table 1.  (See pdf file with table data.)

Enter the data from the table into Mathematica as a list of lists.  I have entered the first three data points for you.  Go ahead and enter the rest of the data points and then press Shift+Enter.

AgeWeightPairs = {{19, 22}, {21, 23}, {24, 25}}

Plot the data points using the Mathematica function ListPlot.  If you have added all the data points to the AgeWeightPairs that was defined in Part 1, then all you need to do is press Shift+Enter to see the scatter plot of the data.

ListPlot[AgeWeightPairs]

You can add labels to the axes of your scatter plot using an option called AxesLabel with the ListPlot command.  For example, the following command will label the axes “Independent Variable” and “Dependent Variable.”

ListPlot[AgeWeightPairs, AxesLabel->{"Independent Variable (units)", "Dependent Variable (units)"}]

Now replace the labels “Independent Variable” and “Dependent Variable” with the appropriate labels for this data set.  Make sure to include units.

We will now use Mathematica to find a formula for the linear function that best fits this data.  To do this we use the Mathematica command LinearModelFit as shown below:

ModelForWeightsByAge = LinearModelFit[AgeWeightPairs,x,x]

The output of this command is a linear function which we have named ModelForWeightsByAge.  Next we use the Plot command to see what the model looks like.

Plot[ModelForWeightsByAge["BestFit"], {x, -10, 10}]

Question: What is the domain of this linear function, as an abstract mathematical function?  What restrictions might we want to impose on the domain, given the real-life situation we are modeling?

Answer: (Fill in your answer here.)

Now we will make a graph that superimposes the linear model onto the scatter plot.

Show[ListPlot[AgeWeightPairs], Plot[ModelForWeightsByAge["BestFit"], {x, 18, 25}], AxesLabel->{"Independent Variable (units)","Dependent Variable (units)"}]

I chose the x-range appropriate for the three data points I entered.  Change the x-range to include the data points you entered as well, and change the axes labels appropriately.

Next we will use our linear model to make some predictions.  To see the value of the linear model at a certain x-value, say for example x=3, we evaluate ModelForWeightsByAge at 3, as follows:

ModelForWeightsByAge[3]

Question: What is the value of the model at x=3, and how does it compare to the actual data?  How close is it?  Is the value larger or smaller than the actual data?

Answer: (Fill in your answer here.)

Question: What weight (include units) does the linear model predict for a child who is 30 months old?

Answer: (Fill in your answer here.)

Write a sentence giving the interpretation of the slope of the linear model in terms of children’s ages and weights.  (Hint: what are the units of the slope?)

Answer: (Fill in your answer here.)

Problem 2: Median Income of US Women

In this problem you will use Mathematica to find a linear model to fit the data in the Table 2.  (See pdf file with table data.)

We can think about the data as a function for income (in dollars) as it depends on the number of years since 1940.  In this case, the independent variable is the number of years since 1940 (not the year).  Enter the numerical data for this function (income as a function of years since 1940) as a list of lists, as in the previous problem.

TimeIncomePairs= {...}

Find the linear model for this data, as in the previous problem.

ModelForIncomeByYear = LinearModelFit[...]

Make a plot of the data and the linear model, with appropriate x-range and appropriate axes labels.

Show[ListPlot[...], Plot[..., {x, 18, 25}], AxesLabel->{"Independent Variable (units)","Dependent Variable (units)"}]

Use the linear model to the median female income in 2015.

ModelForIncomeOverTime[...]

Answer: The linear model predicts that the median female income in 2015 will be (fill in your answer here.)

Write a sentence giving the interpretation of the slope of the linear model in terms of median female income and time.  (Hint: what are the units of the slope?)

Answer: (Fill in your answer here.)

Problem 3: Patent Applications

In this problem you will use Mathematica to find a quadratic model to fit the data in Table 3.  (See pdf file with table data.)

We can think of the data as a function for the number of patent applications (in thousands) as it depends on the number of years since 1980.  Enter the numerical data for this function as a list of lists, as in the previous two problems.

TimePatentsPairs = {...}

Make a scatter plot of the data, with appropriate axes labels.

ListPlot[TimePatentsPairs]AxesLabel->{"Independent Variable (units)", "Dependent Variable (units)"}]

We will now use Mathematica to find a formula for the quadtratic function that best fits this data.  To do this we use the Mathematica command Fit as shown below:

ModelForPatentsOverTime = Fit[TimePatentsPairs,{1,x,x^2},x]

Make a plot of the data and the quadratic model, with appropriate x-range and appropriate axes labels.

Show[ListPlot[...], Plot[..., {x, 18, 25}], AxesLabel->{"Independent Variable (units)","Dependent Variable (units)"}]

Use your graph of the quadratic model to answer the following question.  (You may have to change the x-range.)

Question: According to the quadratic model, in what year will the number of patents reach 450,000?  (Remember that would be 450 on your graph, which shows patents in thousands).

Answer: (Fill in your answer here.)

Finishing up

Once you finish working through the exercises and answering the questions,

Read through your work one more time, to make sure you’ve answered all the questions completely.

Make sure your final lab report is saved in the Lab 4 folder on the M-drive.

Print off a copy to turn in on Monday.