Computer Problems for Methods of Solving Ordinary Differential Equations 1. Have a computer make a phase portrait for the system dx/dt = x + y, dy/dt = 2y. Clearly indicate critical points and separatrices. Make sure your phase portrait has enough trajectories to see the behavior in each region, and that it includes arrows showing the directions of the trajectories. In Problems 2 7 you will be given a second order differential equation. Rewrite it as two coupled first order equations. Have a computer draw the phase portrait for those two equations, and use that phase portrait to predict the possible time evolution of the system. A good answer would look like If it starts with x > 5 moving to the right it will move in a positive direction forever. If it starts at x > 5 at rest or moving left slowly enough it will start moving right and continue that way forever. If it starts at x < 5 then... 2. x (t) + 9x(t) = 0 3. x (t) + 5x (t) + 6x(t) = 0 4. x (t) + 5x (t) + 6x(t) = 2 5. x (t) 5x (t) + 6x(t) = 2 6. x (t) + x 3 = 0 7. x (t) + tan(4πx) = 0 8. Inflationary Cosmology According to the theory of inflation, the early universe went through a period during which virtually all of the energy was in the form of a scalar field. You don t need to know what a scalar field is to solve this problem. All you need to know is that in the simplest model of inflation the field φ obeys the differential equation φ + m 2 φ + 12πG( φ 2 + m 2 φ 2 ) = 0. (a) Define v = φ and rewrite this second order equation as two coupled first order equations for φ and v. (b) What is the one critical point for this system? (c) Have a computer draw a phase portrait for the system. You can set the constants G and m equal to 1. There are two separatrices. Where do they begin and end? (In each case one of the answers is at infinity. ) Are they attractive or repulsive? (d) For a typical trajectory, describe the evolution of the system. What happens at early times, middle times, and late times? 9. You re conducting experiments on a flat table. The experiment produces varying amounts of heat in different places, and a series of measurements tells you that T/ x = sin(y 2 + x) + x cos(y 2 + x) and T/ y = 2xy cos(y 2 + x). Sketch the isotherms (curves of constant temperature) on the surface. 1
The two problems below are a set; the first should be done without a computer and the second is a computer-based follow up. 10. Consider a moth flying at speed v across the street towards a streetlight, while a wind blows it along the street at speed s. We put the streetlight at the origin, the moth s original position at (L, 0), and the wind direction as the positive y direction. To set up the equation for the moth s trajectory y(x), start with the simplest case where s = 0, so there is no wind. (a) The moth s horizontal speed is the x-component of its velocity. Write an equation for dx/dt in terms of its speed v and its position (x, y). (b) The moth s vertical speed is the y-component of its velocity. Write an equation for dy/dt in terms of its speed v and its position (x, y). (c) The chain rule says that dy/dx = (dy/dt)/(dx/dt). Based on everything you have written above, write a differential equation for the moth s trajectory y(x). Your answer should only depend on x and y. (d) Solve that differential equation by separation of variables and show that the resulting motion is a straight line toward the origin. Now you ll repeat the process with a nonzero wind speed. This has no effect on the moth s x-velocity and simply adds s to its y-velocity. (e) Redo the calculations until you have a new equation for dy/dx in terms of x, y, v, and s. (f) You should be able to rewrite your equation as a homogeneous differential equation. Do so and then solve to find y(x), using the initial condition that the moth starts at position (L, 0). You may find it helpful to know that ( 1 + x 2) 1/2 dx = ln x + 1 + x 2 + C. (g) Check that your answer to Part (f) includes your answer to Part (d) as a special case. 11. [This problem depends on Problem 10.] Draw graphs of the moth s trajectory for v >> s, v just a little bigger than s, and v << s. Explain why the graphs make sense physically in each of those cases. 2
12. Walk-Through: Differential Equation by Laplace Transform. In this problem you will solve following the differential equation. 3 d2 x dt 2 + 10dx dt 8x = δ(t 5) with initial conditions x(0) = 2, x (0) = 1 (a) Take the Laplace transform of both sides. i. On the right side of the equation, find the Laplace transform. ii. On the left side of the equation, apply the properties of Laplace transforms: first linearity, and then the derivative properties. Use X to represent L[x], and use the values given for x(0) and x (0). (b) Solve your resulting algebra equation to find the function X(s). (c) Use a computer to find the inverse Laplace transform of X(s). Write the function x(t) that solves the original equation. In Problems 13 22 solve the given differential equation subject to the given initial conditions. Use the three-step Laplace transform method modeled in Problem 12 even if other methods would be easier (which they will in some cases). Computers should be used only to find Laplace and inverse Laplace transforms as necessary. 13. x (t) + 9x(t) = 0 with x(0) = 2, x (0) = 5 14. x (t) 9x(t) = 0 with x(0) = 2, x (0) = 5 15. x (t) 6x (t) + 5x(t) = e 5t with x(0) = x (0) = 0 16. y (t) + t 0 y(τ)dτ = e t with y(0) = 0 17. 2y (t) 7y (t) 4y(t) = e t sin t with y(0) = 2, y (0) = 3 18. y (t) + t 0 y(τ)dτ = 1 with y(0) = y (0) = 0 19. 3f (t) f (t) 4f(t) = H(t 3) H(t 4), f(0) = 1, f (0) = 1 20. g (t) 25g(t) = δ(t 1) + 3δ(t 2), g(0) = 7, g (0) = 5 21. h (t) 6h (t) + 8h(t) = [H(t 1) H(t 2)] e t, h(0) = 0, h (0) = 0 22. h (t) 4h(t) = [H(t) H(t π)] sin t, h(0) = 0, h (0) = 0 In Problems 23 26 use the three-step Laplace transform method to solve the given coupled differential equations and initial conditions, using a computer only to find inverse Laplace transforms as necessary. 23. dx/dt = 3x + 5y; dy/dt = x y; x(0) = 4; y(0) = 2 24. dx/dt = 2x + y; dy/dt = 3x + 4y; x(0) = 1; y(0) = 1 25. d 2 x/dt 2 = 5x 3y; d 2 y/dt 2 = 4x 2y; x(0) = 6; y(0) = 2; x (0) = y (0) = 0 26. d 2 x/dt 2 = 10x + 3y; d 2 y/dt 2 = 3x 2y; x(0) = 10; y(0) = 40; x (0) = 30; y (0) = 20 3
27. The inverse Laplace transform of 1 + s/(s 2 + 2s + 2) is a mess, but it has the same qualitative behavior as the inverse Laplace transform of 1/(s 2 + 2s + 2). Check this by asking a computer for the inverse Laplace transform of 1 + s/(s 2 + 2s + 2). Then have the computer plot the inverse Laplace transforms of these two functions on the same plot. In what ways are they similar, and in what ways are they different? (Note: your inverse transform may appear to be complex, but it is real in the domain t 0 which is all that matters.) 28. In this problem you ll solve the differential equation ÿ + ẏ + y = sin(t)/t. Feel free to start by trying to solve it without Laplace transforms if you really want to appreciate why Laplace transforms are sometimes the best method to use. (a) Solve this equation with initial conditions y(0) = ẏ(0) = 1 to find the Laplace transform Y (s). You can use a computer to find L [sin(t)/t] but you should be able to do the rest by hand. (b) Looking at Y (s), explain how you can know that y(t) should oscillate with a decaying amplitude. What is the period of that oscillation? (c) Have a computer take the inverse Laplace transform of your solution Y (s) and plot the resulting function y(t). Check that it is oscillation with a decaying amplitude and check if its period matches your prediction. 29. A 1 kg block is attached to a spring with spring constant k. It experiences a damping force F = bv. Take k = 8 N/m and b = 6 N s/m. (a) Write a differential equation for the position x(t) of the block. Now suppose an 8 N external force is applied to the block for five seconds. Before and after those five seconds the only forces on the block are the spring force and the damping force. (During those five seconds there are three forces on the block: spring, damping, and external.) (b) Write a differential equation for the block that includes all three forces acting on it. (c) Assuming the block is at rest at equilibrium prior to the start of the external force, solve the equation you wrote in Part (b). Your answer will be in the form X(s), the Laplace transform of the position. (d) Without calculating the inverse Laplace transform, does this describe exponential growth, exponential decay, or oscillations? How can you tell? (e) (f) Evaluate the inverse Laplace transform to find the function x(t) that describes the motion of the block. Plot x(t). Describe the behavior of the system during the first five seconds and after the first five seconds. Explain why each of these behaviors make sense in the context of the problem. 4
30. Two coupled pendulums are shown below. The equations describing this system depend on the angles θ 1 and θ 2, the gravitational acceleration g, and the length L of the strings. 2 θ 1 + θ 2 cos(θ 1 θ 2 ) + θ 2 2 sin(θ 1 θ 2 ) + 2 g L sin θ 1 = 0 θ 2 + θ 1 cos(θ 1 θ 2 ) θ 2 1 sin(θ 1 θ 2 ) + g L sin θ 2 = 0 These equations are nonlinear and cannot be solved using the methods in this section. For small oscillations, however, you can assume θ 1, θ 2, and all of their derivatives remain small, and thus approximate this with a set of linear equations. (a) Replace all the trig functions with the linear terms of their Maclaurin series expansions. Then eliminate any remaining nonlinear terms. The result should be two coupled, linear differential equations. (b) Now let θ 1 (0) = α, θ 2 (0) = 2 α, θ 1 (0) = θ 2 (0) = 0. Take the Laplace transform of your ODEs and use them to get simultaneous algebra equations for L[θ 1 (t)] and L[θ 2 (t)]. (c) Solve those algebra equations and then take the inverse Laplace transforms of your answers to find θ 1 (t) and θ 2 (t). (You can do the algebra by hand but it s tedious, so we recommend letting the computer do it for you.) 5
31. The Transfer Function An RLC circuit, a mass on a damped simple harmonic oscillator, and a variety of other systems obey the equation x (t) + a 1 x (t) + a 0 x(t) = f(t). The constants a 1 and a 0 define the properties of the system (e.g. resistors, capacitors, and inductors, or damping force and spring constant). The driving term f(t) represents the external input to the system (e.g. voltage source or external force). You can solve this equation for any particular a 0, a 1, and f(t) with any set of initial conditions. For the homogeneous initial conditions x(0) = x (0) = 0, however, you can also derive a general relation between the input f(t) and the output x(t). (a) Solve this differential equation using Laplace transforms. Your answer will give X(s) as a function of a 0, a 1, and F (s), the Laplace transform of the driving term. (b) The transfer function G(s) is defined as X(s)/F (s), or (roughly speaking) output/input. Calculate G(s) as a function of a 0 and a 1. (The transfer function is more often designated H(s) but we re already using that for the Heaviside function. There just aren t enough letters.) The transfer function only depends on the properties of the system, not on the driving term f(t). The rest of this problem will focus on a 1 kg block attached to a spring with spring constant 3 N/m, with a damping term F d = bv, b = 2 N s/m. (c) Write the differential equation for this system and find its transfer function. We have not told you whether there is an external force or not, because G(s) doesn t depend on it. (d) For each of the following driving forces f e, calculate X(s) from the relation X(s) = G(s)F (s). Then use a computer to calculate the inverse Laplace transform x(t). i. f e = δ(t 1) ii. f e = e 2t iii. f e = sin t 32. The equation x (t) + 5x (t) + 4x = 2 sin(2t) with initial conditions x(0) = x (0) = 0 represents a damped, driven oscillator. (a) Find the solution by using guess and check. (b) Find the solution again by using variation of parameters. (c) Find the general solution a third time by using a Laplace transform. Use a computer only to find the inverse transform at the end (and, if you want, to take an integral in the middle). 6
33. The moon is about 384,000 km from Earth. A body in between the Earth and the moon experiences gravitational pulls in opposite directions from the two bodies. If we place the origin at the center of the Earth then the object s position obeys the differential equation d 2 x dt 2 = 2.98 x 2 +.0366 (3.84 x) 2 measuring distance in 100,000s of kilometers and time in days. (You can do the problem in SI units, but the numbers are messier.) (a) Explain why this equation is only valid for objects in between the Earth and the moon. In other words, how can you tell that it must give incorrect values if the object is at x < 0 (behind the Earth) or at x > 3.84 (beyond the moon)? (b) Find the value of x at which the Earth s and moon s pulls exactly balance. Explain physically why you would expect this equilibrium value to be stable or unstable. (c) Draw a phase portrait for this equation and confirm that there is an equilibrium point where you predicted and that it has the character you predicted. www.felderbooks.com/mathmethods/exercises 7