Math 442 Assignment 4 - Spring 2015 Due Friday, February 20th Directions: Your solutions to Problems 1–2 can be hand written. Use LATEX to typeset your solutions to Problems 3–6 and produce the tables for Problems 7–8. You will print your solutions and hand these in on Friday, February 20th in class. 1. Consider a data set of the form {(xk , yk )}nk=1 . In developing our method of least squares regression, we measured the distance between data points and the best fit curve by vertical distance. In the case of a line, we could just as easily have measured this distance by horizontal distance from the line. (a) Find an expression E(m, b) for the total least squares error using the horizontal distance from a best fit line y = mx + b. (b) Find the values of m and b (in terms of xk and yk ) which minimize the total error. (c) For the following data, write a script M-file to fit a line based on vertical distances and a second line based on horizontal distances, and draw both lines along with the data, all on the same plot. (Be sure to label your axes appropriately and include a legend). Turn in a copy of your M-file, the figure it generates. On the figure write the slope and y-intercept for each line. Year Tuition 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2811 2975 3111 3247 3362 3508 3766 4098 4645 5132 Table 1: Average tuition change for public four-year schools. 2. Let φ denote the concentration (in milligrams per cubic centimeter) of insecticide. Let d denote the fraction of the population of houseflies that would be killed by that dosage. The following data relates these two quantities: φ d 0.50 0.75 1.00 1.50 2.00 0.20 0.35 0.53 0.80 0.88 (a) Let x = 1 − d denote the fraction of the population that survives when the concentration of insecticide is φ. Plot the values of − ln(x) against those of φ. Show that the data suggests a model of the form x(φ) = aebφ . (1) (b) Write a script M-file to plot the data from part (a) and the best fit line for this data. (Be sure to label your axes appropriately and add a legend). Use the best fit line to determine the values of a and b for the model in Equation (1). Turn in a copy of your M-file and the figure it generates. (c) Use your answer from part (b) to predict the fraction of houseflies that would be killed if the concentration of pesticide is 1.25 milligrams per cubic centimeter. 1 3. Suppose that a set of n data points {(xk , yk )}nk=1 appears to satisfy the relationship b y = ax + , x for some constants a and b. Find the least squares approximations for a and b. 4. Consider the Malthusian growth equation dx = rx, dt x(0) = x0 . (a) Show that the solution of this initial-value problem is x(t) = x0 ert . (b) Transform your solution into a linear form which could be used for fitting data. 5. Consider the logistic growth equation x dx = rx 1 − , dt K x(0) = x0 . (a) Show that the solution of this initial-value problem is x(t) = Kx0 . x0 + (K − x0 )e−rt (b) Transform your solution into a linear form which could be used for fitting data. 6. Consider the Gompertz growth equation x dx = −rx ln , dt K x(0) = x0 . (a) Show that the solution of this initial-value problem is x(t) = Keln(x0 /K)e −rt . (b) Transform your solution into a linear form which could be used for fitting data. 7. Create a table of population data for the U.S. from 1790–2010 and cite your source(s) for this data in the table caption. Write a MATLAB script M-file to create a scatterplot of this data which includes appropriate labels and a title. Turn in a copy of your M-file and the figure it generates. 8. Create a table of population data (other than the U.S. population size) that you will use for Project 1 and cite your source(s) for this data in the table caption. Write a MATLAB script M-file to create a scatterplot of this data which includes appropriate labels and a title. Turn in a copy of your M-file and the figure it generates. 2