Math 340-220 Projects, Spring 2011 Select one of the 6 projects below. Reports can be turned in by groups of at most two students. Project Report due: Friday, May 6, in class. Project 1: Modelling a Thermostat A model for the heating of a building is provided by a generalization of Newton’s law of cooling: dT = k0 [A(t) − T ] + F (t). dt Here, A(t) is the outside temperature and F (t) is the heat supplied by the furnace. A simple model for a thermostat controlled furnace is F (t) = k1 [Tc − T (t)], where Tc is a fixed reference temperature. The daily fluctuations of the outside temperature about an average temperature A0 can be modelled by A(t) = A0 − B cos(ωt), where B is the amplitude of the fluctuation and ω = 2π/24 (time measured in hours). Thus the temperature oscillates between A0 − B at t = 0 (midnight) and A0 + B at t = 12 (noon). (a) Show that under the assumptions above the differential equation for the temperature T (t) in the building takes the form dT + kT = kTD − k0 B cos(ωt), dt (1) where 1 (k0 A0 + k1 Tc ). k (b) Equation (1) is a linear, nonhomogeneous ODE for T . Apply the method of integrating factors or the method of variation parameters to find the solution to this equation with general initial condition T (0) = T0 . You should get the following result: k = k0 + k1 ; TD = T (t) = e−kt (T0 − TD ) + Tsp (t), where Tsp (t) = TD − k0 B [ω sin(ωt) + k cos(ωt)]. + ω2 k2 Observe that the first term in T (t) is exponentially decaying. After a certain transient time this term will be negligibly small. Then T (t) ≈ Tsp (t) which is called the steady periodic solution. Tsp (t) consists of a constant part, TD , and an oscillating part with zero mean. Typically the goal 1 will be to adjust TD to a prescribed value, e.g. 70o F , which can be achieved by choosing Tc , the reference temperature of the thermostat, as Tc = TD + k0 (TD − A0 ). k1 (b) Typical values of k0 and k1 are k0 between 1/4 and 1/2 and k1 somewhat smaller than 2. Set k = 2, k0 = 0.4 and choose typical winter data: TD = 70, B = 15, A0 = 20 (in o F ). Recall ω = 2π/24. Graph T (t) for a number of initial conditions T0 over a period of 2 days in the same plot. You should see that after about 10 hours the transient part has disappeared. (c) To compare the temperature fluctuations inside and outside, graph (in the same plot) the oscillating parts Tf o (t) = −B cos(ωt), Tf i (t) = − k0 B [ω cos(ωt) + k sin(ωt)] k2 + ω2 over a period of 2 days for the parameter values given in (b). You should see that (1) the amplitude of Tf i (t) is smaller than the amplitude of Tf o (t) and (2) that Tf i (t) lags behind Tf o (t). To quantify this observation, note that Tf i (t) can be written in the form Tf i (t) = −aB cos(ω(t − tlag )), which follows from a well known trig-identity. Compute the attenuation factor a and the time lag tlag (you don’t need a computer for that). Project 2: Modeling the US Population The logistic equation, dP = kP (M − P ), dt models the growth or decay of of a population towards a carrier capacity M . The solution for the initial condition P (0) = P0 is given by P (t) = M P0 . P0 + (M − P0 )e−kM t Table 1 shows the US population (in millions) between 1800 and 1900 and between 1910 and 1990 every 10 years. The left table shows in addition approximate increase rates Pi0 in these years. If the logistic model were correct, P 0 (t)/P (t) = k(M − P (t)), and the given points (xi , yi ) = (Pi , Pi0 /Pi ) would be on a straight line. (a) Find parameters a and b such that the line y = ax + b is the line that gives P11 the best match to the given points. This line is found by minimizing the least square error, i=1 (yi − axi − b)2 . Show in general, given N points (xi , yi ), i = 1 . . . N , that the least square error minimization leads to the following equations for a and b, a= W − XY DY − XW , b= , D − X2 D − X2 2 Year 1800 1810 1820 1830 1840 1850 1860 1870 1880 1890 1900 i 1 2 3 4 5 6 7 8 9 10 11 ti 0 10 20 30 40 50 60 70 80 90 100 Population 5.308 7.240 9.638 12.861 17.064 23.192 31.443 38.559 50.189 62.980 76.212 Slope Pi0 0.166 0.217 0.281 0.371 0.517 0.719 0.768 0.937 1.221 1.301 1.462 Year 1910 1920 1930 1940 1950 1960 1970 1980 1990 Population 92.228 106.022 123.203 132.165 151.326 179.323 203.302 226.542 248.710 Table 1: Us-population in millions during 1800 and 1990. where X= N N N N 1 X 1 X 1 X 1 X 2 xi , Y = yi , W = xi yi , D = xi . N N N N i=1 i=1 i=1 i=1 Apply the formula for a and b to the given data (N = 11). In Matlab you can edit two rowarrays containing the above data, À x=[5.308 7.24 9.638 . . . 76.212]; À pp=[0.166 0.217 0.281 . . . 1.462]; and then get the y-array using À y=pp./x; The commands À X=mean(x);Y=mean(y); À D=mean(x.∗ x);W=mean(x.∗ y); generate the four relevant numbers needed for computing a and b. Create a plot showing the data points and the best straight line. (b) Identifying a = −k and b = kM gives values for the parameters in the logistic equation. Use as initial value the population in 1800. Create a plot showing the solution curve and the actual population data from the table. You should observe reasonable agreement until 1940, but strong disagreement afterwards. Explain if you have any idea what the reason for this disagreement might be. What’s about the carrier capacity? 3 Project 3: Euler’s Method, Period Doubling, and Chaos Consider the logistic equation with fixed parameters and initial condition, dP = 10P (1 − P ), P (0) = 0.1. dt Recall that the exact solution to this initial value problem approaches the limiting population M = 1 when t → ∞. (a) Show that Euler’s method with step size h to approximate the solution to the initial value problem gives Pn+1 = (1 + 10h)Pn − (10h)Pn2 , P0 = 0.1. (2) (b) For h = 0.18, 0.23, 0.25 and 0.3 plot 40 iterates Pn of (2). You should observe that Pn (i) converges to 1 when h = 0.18, (ii) after some iterates jumps between 1.8 and 0.69 when h = 0.23, (iii) jumps between the 4 values 1.23, 0.54, 1.16 and 0.70 when h = 0.25, and (iv) appears to be random (no discernible pattern) when h = 0.3. The transitions from convergence to jumps between 2 values and jumps between 4 values are called period doublings. The behavior observed in (iv) is called chaos. Obviously we can only trust the results of the Euler computation as approximation of the logistic ODE when h = 0.18. The other values of h are too large. Project 4: Spruce Budworm Perform tasks 1-6 of Project 3.5 in the text, p.132. Project 5: Long-Term Behavior of Solutions for Dimension 1 and 2 Perform the tasks described in Project 3.5 in the text for Dimension D=1 and Dimension D=2 (p. 321). Numerical solutions can be generated using pplane6. Project 6: Long-Term Behavior of Solutions for Dimension 3 Perform the tasks described in Project 3.5 in the text for Dimension D=3 (p. 321). Matlab code for computing and plotting solutions will be provided if you choose this project. 4