Vous êtes sur la page 1sur 641
Differential Equations TTL rel ee Martha L. Abell James P. Braselton Differential Equations with Mathematica Martha L. Abell James P. Braselton Department of Mathematies and Computer Science Georgia Southern University Statesboro, Georgia @ Ons AP PROFESSIONAL A Division of Harcourt Brace & Company Boston San Diego New York London Sy sydney ‘Tokyo Toronto “This book is printed on acid-free paper) Copyright © 1993 by Academic Press, Ine All rights reserved. No part of this pubtication may be reproduced or transmitted in any form or by any means, electronic ‘or mechanical, including photocopy, recording, or ‘any information storage and retrieval system, without permission in viking from the publisher. Mathematica sa registered trademark of Wolfram Research, Ine Macintosh isa registered trademark of AppleComputr, Ine. AP PROFESSIONAL 1300 Boylston Street, Chestnut Hill, MA 02167, An Imprint of ACADEMIC PRESS, INC. ADivision of HARCOURT BRACE & COMPANY ‘United Kingdom Eton published by ACADEMIC PRESS LIMITED 24-28 Oval Road, London NW I /DX ibrary of Congress Cataloging-in-Publication Data Abell, Martha L, date, Differential equations with Mathematica / Martha L, Abell, James P. Braselton, p. cm. Includes bibliographical ref ISBNO-12-041539-9 1. Differential equations—Data processing. 2. Mathematica (Computer file) I. Brasclion, James P, date. I. Tite. QA371.5.D37A24 1993 93.9134 515'.35' 02855369—de20 cP. sees and inde. Printed in the United States of America 93 94 95 96 97 EB 9876543 Contents Preface ix Chapter 1: Introduction to Differential Equations 1 1.1 Purpose 1 1.2 Definitions and Concepts 1 1.3 Solutions of Differential Equations 4 1.4 Initial and Boundary Value Problems 5 Chapter 2: First Order Ordinary Differential Equations 8 2.1 Separation of Variables & 2.2 Homogeneous Equations 14 2.3 Exact Equations 21 2.4 Linear Equal 26 2.5 Some Special First-Order Equations 35 2.6 Theory of Firs-Onler Frpations. 50 Chapter 3: Applications of First Order Ordinary Differential Equations 54 3.1 Orthogonal Trajectories 54 32.Direetion Fields 60 3.3 Population Growth and Decay 63 3-4 Nowion's Law of Cooling 71 3.5 Free-Falling Bodies 75 ions 90 Chapter 4: Higher Order Differential Equ: 4.1 Preliminary Definitions and Notation 90 4.2 Solutions of Homogencous Equations with Constant Coefficients 97 4.3 Nonhomogeneous Equations with Constant Coefficients: ‘The Annihilator Method 108 4.4 Nonhomogeneous Equations with Constant Coefficients: Variation of Parameters 117 4.5 Ordinary Differential Equations with Nonconstant Coefficients: Cauchy-Euler Equations 135 4.6 Oudinary Differential Equations with Nonconstant Coefficients: Exact Secvnd-Order, Autonomous, and Equidimensional Equations 142 Contents iv Chapter 5: Applications of Higher Order Differential Equations 160 5.1 Simple Harmonie Motion 160 5.2Damped Motion 166 5.3 ForeedMotion 179 SALRCCircuits 196 5.5 Deflection ofaBeam 199 5.6 The Simple Pendulum 203 Chapter 6: Power Series Solutions of Ordinary Differential Equations 216 6.1 PowerSeries Review 216 6.2 Power Series Solutions about Ordinary Points 225 6.3 Power Series Solutions about Regular Singular Points 245 Chapter 7: Applications of Power Series 272 7.1 Applications of Power Series Solutions to Cauchy-Euler Equations 272 7.2The Hypengeometrie Equation 280 7.3 The Vibrating Cable 290 Chapter 8: Introduction (o the Laplace Transform — 294 8.1 The LaplaceTransform: Preliminary Definitions and Notation 294 8.2 Solving Ordinary Differential Equations with the Laplace Transform 309 8.3 Some Special Equations Delay Equations. Equations with Nonconstant Coefficients 321 Chapter 9: Applications of the Laplace Transform 339 9.1 Spring-Mass Systems Revisited 339 9.21-R-CCircuits Revisited 351 93 Population Problems Revisited 356 914The Convolution Theorem 361 9.5 Ditlerential Equations Involving Impulse Functions 370 Chapter 10: Systems of Ordinary Differential Equations 378 10.1 Review of Matrix Algebra and Calculus 378, 10.2Pictiminaty Definitions and Notation 391 10.3 Homogeneous Linear Systems with Constant Coefficients 394. 10.4 Variation of Parameters 419 10.5 Laplace Transforms — 430 Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Contents 10.6 Nonlinear Systems, Linearization, and Classification of Equilibrium Points 441 Chapter 11: Applications of Systems of Ordinary Differential Equations 462 11.1 L-R-CCireuits with Loops 462. 11.2 Diffusion Problems 477 11.3 Spring-Mass Systems 489 11.4 Population Problems 496 11.5 Applications Using Laplace'Transforms 510 Chapter 12: Fourier Series and Applications to Partial Differential Equations 528 12.1 Orthogonal Functions and Sturm-Liouville Problems 528 122 Introduction to Fourier Series 532 12:3 The One-Dimensional Heat Equation 552 12.4 The One-Dimensional Wave Equation 559 12.5 Laplace's Equation 563 12.6 The Two-Dimensional Wave Fauation ina ireular Region $70 Appendix: NumericalMethods 583 Buler’s Method 583 The Runge-Kutta Method 590 Systems of Differential Equations $08 Error Analysis 606 Glossary of Mathematica Commands —_ 608 Selected References 625 Index 627 Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Preface Mathematica’s diversity makes it particularly well-suited to performing many of the calculations encountered when solving elementary ordinary differential equations. In some cases, Mathematica'’s built-in functions can immediately solve a differential equation; in other eases, Mathematica can be used to perform the calculations encountered when solving a differential equation. Since one goal of the traditional differential equations course is fo introduce the student to basic methods and algorithms and for the student to gain proficiency in them, nearly every topic covered includes typical examples solved by both traditional methods and Marhematica. Consequently, we Teel that we have addressed one issue frequently encountered when nplementing computer assisted instruction. In addition to the above, Differential Equations with Mathematica uses Mathematica to establish well-known algorithms for solving elementary differential equations. All Mathematica calculations were completed using Versions 2.0 and 2.1 of Mathematica. If you are using an earlier or later version of Mathematica, your results may not appear in a form identical to those found in the book: some commands in Versions 2.0 and 2.1 are not available in earlier versions af Mathematica; in lator versions some commands will certainly be changed, new commands added, and obsolete commands removed. In general, however, the text is computer independent. Al people who have access to Mathematica can use this text with equal success, keeping in mind that results may not physically look identical to those illustrated in the text, In addition, the following conventions are used! EXAMPLE denotes examples primarily completed by traditional methods although ‘Mathematica may be used to perform some calculations; and EXAMPLE denotes examples primarily completed using Mathematica although traditional methods may be illustrated concurrently or used to perform some calculations In addition to a comprehensive Index, the end of the text includes a Glossary of Mathematica commands used in the text, and a list of mathematical and Mathematica relerences. Appropriate uses of Differential Equations with Mathematica include: 1 a handbook which addresses some ways to use Mathematica for computation of explicit or ‘numerical solutions ofa variety of familiar ordinary differential equations; ancl 2) asupplement or beginning courses in ordinary and/or partial differential equations. Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Preface viii Adequate prerequisites to using this text successfully would include basic familiarity with ‘Mathematica and a standard tnrst-year calculus course, In most cases, commands used m the text are briefly discussed when first introduced; a glossary of commands is included at the end of the text. We have enjoyed working on Differential Equations with Mathematica and wish to express our hanks (0 the folks who have supported us and made our work easier 0 do, In particular, we'd like to thank our editor, Charles Glaser, and production editor, Elizabeth Tustian, at Academie Press in addition to Brad Hom of Wolfram Research, Inc all of whom have been most helpful during this project. Martha L. Abell James P. Braselton November, 1992 Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 1: Introduction to Differential Equations $1.1 Purpose The purpose of is twofold. Fist, we inuoduve and briefly discuss in a very standard manner all topies typically covered in an undergraduate course in ordinary differential equations as well as some supplementary topics such as Laplace tansforms, Fourier series, and partial differential equations which are not. Second, we ilustrate how Mathematica is used to enhance the swudy of differentia equations novonly by eliminating the computational difficulties, butalsoby overcoming, the visual limitations associated with the solutions of differential equations. In each chapter, we first briefly present the material in a manner similar «0 most differential equations texts and then illustrate how ‘Mathematica can be used to solve some typical problems. For example, in Chapter 2, we introduce the topic of first-order equations. So as not to trivialize the subject, we do not simply make Use ofMathematica commands such as DSolve which solve the differential equations for us. Instead, we show how to solve the problems by hand and then show how Mathematica can be used to perform the sume solution procedures. In Chapter 3, we discuss some applications of first-order equations. In this chapter, since we are experienced and understand the methods of Solution covered inChapter 2, we make use of DSoLve and simitar commands to obtain the desired solutions. In doing so, we are able o emphasize the applications themselves as opposed to becoming bogged down in the calculations. You will notiee that throughout a ‘majority of Differential Equations with Mathematica even numbered chapters introduce a particular topi ‘while odd numbered chapters cover some applications of the topic ofthe previous chapter. The advantages of using Mathematica inthe study of differential equations are numerous, but perhaps the st useful i that of being able to produce the graphics associated with solutions of differential equations. This is particularly beneficial in the discussion of applications since many phy’ ations are modeled with differential equations. For example, when we solve the problem of the motion of a pendulum, we can actually watch the pendulum move. The same is true for the motion of a mass attached (0 the end of a spring as well as many other problems. In having this ability, the study of differential equations becomes ‘much mote meaningful as well as interesting. §1.2 Definitions and Concepts A differential equation is an equation which contains the derivative or differentials of one or more dependent variables with respect to one or more independent variables. If the equation contains only ordinary derivatives (of one or more independent variables) with respect to a single independent variable, then the equation is called an ordinary differential equation. OEXAMPLE 1.1 Determine which ofthe following are examples of ordinary differential equations. Differential Equations with Mathematica by Martha L. Abell and James P. Braselton Chapter 1: Introduction to Differential Equations 2 dy 2st, yy Me ue ary, (©) (y—thdatavon(yly—1, (@) B= AH, (0) B= 0 Gr uray (0 (9th rncinhty a Ba B 8, ey" P—nly=0, (9 Cea Fe try +(x?-n')y=0, () noe The equations in parts (a), (b) (¢) andl (@) are ordinary differential equations. The equations in parts (a) and (f) are not since they contain partial derivatives. Some of these equations are well-known, The ‘equations in parts (() snd (F) are the heat equation sind the wave equation, respectively, and will he solved in Chapter 12, Also, the equation in part (e) is Bessel’s equation which will be solved in Chapter 6 and discussed in other chapters as well. Ifthe equation contains partial derivatives of one or more dependent variables, then the equation is called a ‘partial differential equation, CEXAMPLE 1,2 Determine which of tho following are examples of partial differential equations. au _ au aa udu ) du au uta Fe. Ham, suan, T+ TL0, ah Ha Se All of these equations are partial differen Laplace's equation and will bedi 1 equations. Infact, the equation in part (c) is known as, sussed in detail in Chapter 12, Differential equations can be categorized into groups of equations which may be solved in similar ways. The first level of classification, distinguishing ordinary and partial differential equations, was discussed above. We extend this classification system with the following definition, The highest decivative in the differential equation is called the order of the equation. QEXAMPLE 13 oe «(=r Ow Y cos(y)” ONG, {(b) th, 1 Uy woven ly Dale + xeosty dy. Solution: Differential quai \s withMarhemarica by Martha L. Abell and James P. Braselton (Chapter 1: Introduction to Differential Equations 3 (a) The order of this equation is first-order since it only includes one first order derivatives (b) This, {equation is classilied as second order since the highest order derivative 1s ot the second order. Hence, Laplace's equation is a second order partial differential equation; (c)This equation is first order since we can solve for dy/dx; (d) This equation is classilied as first order since the highest order derivative isthe first derivative. Raising that derivative to the fourth power does not affect the order of the equation; (e) ‘Again, we have a first order equation since the highest order derivative isthe first derivative. ll The next level of classification is based on the following definition: A linear ordinary differential equation (of order n) is of the form a) EE +0, (0) EE rota (a) EE a, (0) +0, C0y = 108) Whore the funetions af), jaOsLns and 1) are given. If the equation does not meet the requirements ofthis equation, then the equation is said to benoninear. A similar dassification is followed for partial differential equations QEXAMPLE 14 Determine which of the following differential equations are linear, wg @ They eu S40 © Baxy (09D + xeostyey = 1 *Xssinx)=0 Solution: (a) This equation is linear since the nonlinear term x’ is the function f(x) in the general formula above: (b)This equation is also linear. Using u as the dependent variable name does not affect the linearity; (0 Solving for $¥ wehave $¥= II. Since te right-hand side of ths equation isa function et siheoqtion ot (Th otic often iy adh neta ono x. Hence, this equation is nonlinear. (e) This equation is linea. The term x is merely the coefficient Tuncuion. 1) This equation, know as the pendulum equation because st models the motion of a pendulum, is nonlinear since it involves a function of x, the dependent variable in this case. This function is costx), i Differential Equations with Marhematica by Martha L. Abell and James P. Braselton (Chapter 1: Introduction to Differential Equations 4 $1.3 Solutions of Differential Equations ‘When faced with a differential equation, the goal is to determine solutions to the equation. Henee, we state the following definition, A solution of a differential equation ona given interval isa function which is continuous on the interval and has all the necessary derivatives which are present in the differential equation such that when substituted nto the equation yields an identity for all values on the interval CUEXAMPLE 15 ‘Verify that the given function isa solution tothe comesponding differential equation. (a) Ba3y, y(x)= (6) $160 =0, us) =e) © y"42y +y=0, y(x)=xe* Salut (@) Differentiating we have $= 30%. Hence, $Y =3y (b) Two derivatives are required in this case. gu = ~4sin(ax) and ad —400s(4x). Therefore, fu 20 4u=—4eos(4x)-+-4eos(4x) =0, o (4x) + 4c0s(4x) (© Differentiating with the Product Rule we find that y'=e* and y" =—2e* +xe, Hence, yiedy ty =2e"+xe*+2(e*—xe")+xe*= 0. Ml In the example above, the solution is given as a function of the independent variable, In these eases, the solution is said 10 be explicit In solving some differential equations an explicit solution cannot be eiermnined. In this ease, de solution is said wo beimpligit QEXAMPLE 16 ‘Verify that the given implicit solution satisfies the differential equation, Differential Equations with Marhematica by Martha L. Abell and James P. Braselton (Chapter 1: Introduction to Differential Equations 5 Solutio, ety! Day + 5x=0 a Differential Equation: 3 Solution: dh oe wehave nine Gy weh Using implicit differentiation with the implicit solution to det dy=4x— dy _of,..4¥) ay 4x¢2y%~afy+x2)45=0, s0 Yon ax) Hence, the given implicit solution ax 2y-2x syeninnl satisfies the differential equation, il Most differential equations have more than one solution, We illustrate this property in the following example, QEXAMPLE 1.7 Verify that the given solution which depends on an arbitrary constant satisfies the differential equation. (a) Solution: y =C sin x (b) Solution: y =, sin x +C, cos x Dien gui: 22+ 20 Dit aio: 2+ Solution: S eos xand <> 4 (odineeiaing we bin & Cains. Teo, dx? ey dx? y (Similarly, we have 8Y =, c05x — ©, sinxand TY = -¢, sinx —C, cos x. Substitating imo ak x the differential equation, we have 1 sinx —C, COs x+C, sinx+C, cosx=0. ax $14 Initial and Boundary Value Problems In many applications of differential equations, we are not only presented a differential equation but one ot ore auxiliary conditions as well. The nurnber ofthe conditions typically equals the order ofthe equation For example, if we consider the first-order equation which models the exponential eouith af a population Differential Equations with Marhematica by Martha L. Abell and James P. Braselton (Chapter 1: Introduction to Differential Equations 6 ax, at ‘whore x1) represents the population atime t. The solution of this equation is x(t) = ke. Since this solution depends on an arbitrary constant, we call this thegeneral solution. However, in. problem such as this, we, usually know the initial population. Therefore, we must determine thc one solution which satisfies the given ial condition. Suppose that (0) = 10, then substitution into the general solution yields k = 10. Therefore the solution to the initial value problem dx at x(0)=10 x(1) = 10e% Notice tha this first-order equation requires one auxiliary condition to eliminate the unknown coetticient im the general solution. GEXAMPLE 18 The general solution to the first-order equation which determines the velocity of an object of mass m= 1 subjected to ar resistance equivalent to the instantaneous velocity of the object: av at where vt) represents the object’ velocity is vt) = 32-+ ce‘ Ifthe initial velocity ofthe object is (0) = 0, then determine the solution which satisfies this initial condition Solution Substituting into the general solution, we have WO) initial value problem is vit) = 32+ 32e. ~32, and the solution tothe, Since first-order equations involve a single auxiliary condition which is usually referred to as an initial condition, we distinguish between intial and boundary value problems through the following example. CEXAMPLE 1.9 Consider the second order differential equation which models the motion of a mass with m=1 attached 0 the end of a spring with spring constant k = | given by x+x=0, where x(t) represents the distance ofthe, ‘mass from the equilibrium position x =0 at time t. The general solution of this differential equation is xit) = Acosit) + Bsin(t) Since this is a second order equation, we need two auxiliary conditions t0 determine the unknown constants, (a) Suppose that the initial position of the mass is x(0) =0 and the initial velocity X(O) = 1. Then this constitutes an initial value, because we have two auxiliary conditions tthe same value oft, namely t=O. Determine the solution of this initial value problem. (b) On the other hand, suppose that we know the position at wo different values oft such as x(0) and. Differential Equations with Marhematica by Martha L. Abell and James P. Braselton (Chapter 1: Introduction to Differential Equations 7 x(w/2) =A. Since the conditions are given at different values of t, we call this aboundary value ‘problem. Use the given boundary conditions to determine the solution to ths problem, Solution (a) Since we need the first derivative of the general solution, we calculate X(0)=—Asin() + Boos(). Now, substitution yields x(0) = A = Oand, thus, x(0) = B = 1. Hence, the solution is x(t) = sin¢). (b) Substitution niothe general solution givesusx(0) = A = Oand x@v2) 4. Therefore, the solution to the boundary value problem is x() = —4sin(1). Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 2: First-Order Ordinary Differential Equations ‘Mathematica commands used in Chapter 2 include: Apart Evaluate PlotPoints AxesOrigin ExpandAll PlotRange Cancel GraphicsArray PowerExpand Collect InplicitPlot ReplaceAll ContourPlot Integrate Show Contours: NDgelve Simplify ContourShading Nintegrate Solve D Past Table DisplayFunction Partition TableForm Dgolve Plot §21 Separation of Variables {A differential equation that can be written in the form g(y)/= f(x) is called a separable differential equation, Rewriting e(y)y~ f(a) in the Foun 20 =Fes)yictdy g¢y)dy = f(x)dx so that f acy)dy freoax +C,Caconstant CEXAMPLE 2.1 Show that the equation &Y. ax is separable and solve by separation of variables. Solution: oy _ 2: ‘econ =22”=29 ssl ican wien ne em yoy & Tosolvethe equation, integrate both sides and simply Observe that {2 = [8 +6, isthe same as f f& +c, Iyeaay Sx x ‘To evaluate the integral on the left-hand side, let w= - We then obtain 8 Differential Equations with Mathematica by Martha L. Abell and James P. Braselton First-Order Ordinary Differential Equations 9 Bf 85st) =1 0) + Read) = La) reel a 2c (where © = Jandrsubsiting we obain dat —1 5 — Cx the general u =¥ pape. “a dx x EXAMPLE 2.2 We first try to solve the equation with DSolve by defining the equation and then entering the correct command. However, in this case DSolve is unable to solve this nonlinear equation, so we rewrite the equation x48 AF ax. To solve the equation.we must integrate both the 5x46 " * in the form y*costy}dy left- and right-hand sides. = Tabi: — ‘7h ] equationey! Ix)==(27249)/ (Graseee) Ylx1-2 Costy i211) butt f= pe on 282) Sot (=o n ee) ret uel Coe J tsyeite ] Warning” Inverse forotions are being used by Solve, 0 sose solutions ney not be found out afm 2, Deonve(y" [2] 3 = 5x60) viet , rie, #1 Inthe following, we define Uhs tobe y? cos(y) and rhs to be as and then use Integrate to inlegrate Lhs (with respect to y) and xhs (with respect to x). We interpret the result to Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 10 ‘mean that the gencral solution ofthe equation 9° costy)dy— 2" 8 2y cosy) + = 2) sin (y) =x+ Ln (K—3)-I2Ln(x-2)+C. tal thw Yhs-772 Costs 1, rhs=(x"948) ((a42-Sx46) ; altel Integrate(Ihs,7] out 2f= 2y Costy] + (-2 +97) Siniyt tal 8h Tategratetrhe+1 Out 13) E+ 17 Loyl-3 + x) - 12 Loyl-2 + 2) Note that ifthe problem had heen solved by hand, integration hy pars would be used to evaluate x48. x -5x+6 cos yhy aa ati rctons woul be se cute f dx, fet the x48 Apart command can be used to compute the partial fraction decomposition of. val rah Apart ((x°249)/(x°2-Sx46)] Out taf= ssa EXAMPLE 2.3 Solve the equation 2% =p 5 subject to ¥0)=0 &F cosy Solution: Proceeding as in the previous example, we first define the equation and attempt to useDSolve to solve the equation, Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: irst-Order Ordinary Differential Equations u SSS erin —— tal t= equationey: [x ]onxa/ Sert[9-x°2] Expty le} Costyix11) uth tm 2 Pel ype B sarely = tal2lr= BSolve{ (equation,x[0}) Solve: ium: Varning: Inverse fmotions ere being used by Solve, 50 sone solutions my not be foud. Dor tx] x OutfZJ= 2 seotytx: sever ta me pp SUE, 0) 0), Since DSolve is unsuocessTul, we rewnte the equation in the form dx ,detine Ans to bee’ costy), xhs to be ©” cosy) dy = pe ex © ve Integrate to compute {6 cosy, f respectively. inkeli= Tseep ty] Coste]: rhsex"S/Eqrt [9-278] ; MhShon slhs=Integrate[1hs 71 Butta #7 cosy] , 2 sinty! tal l= rhsaIntegrate{rhs x] outa by _ 9 arosintht Go sqrt — sass = ety 7 BP IG! We interpret the results to mean that the general solution of the equation is dx , and name the results sLhs and sz ] | land then use v Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton 12 Chapter 2: First-Order Ordinary Differential Equations Pee ae ercosin+singy)) +6, Therefore, t solve the problem we need to find the value ofc for which y(0}=0. We begin by defining sol to be the general solution of the equation. [msi= SS J i saecineenarnese OutfSf= F cost) | BY siniy) og storys = at) , ? Metin xempeed = te» Py ] (coscy)rsintyy)_ 198i 2 ‘al Te seletion-sot /. oratitty Autf2}= the package ImplicitPlot which Differential Equations wi Plossinl , aint). ‘The equation solution may be graphed with the command ImpLicitPlot whi The resulting value of cis + so we conclude thatthe desired solution is 2 ; ( 9 AreSin(3] = I x sqrt (9 = contained in is located in the Graphies folder (or directory), jth Mathematica by Martha L. Abell and James P. Braselton irst-Order Ordinary Differential Equations Chapter 2: ialel= < esp, a, 3,174 grey =» At oo cpl, $ an 2314 cry heat ea cun ht, However, we can oblain the same results by repeating the established algorithm 10 solve the homogeneous equation, We begin by defining Leq to be the left-hand side of the equation. Note that the symbol Dt [x] corresponds to dx and the symbol Dt [y] corresponds to dy. Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton 18 Chapter 2: First-Order Ordinary Differential Equations alh-= Clear [z,7,0) ant tobe ] Leqone=cepalz x) Dtlx}+cepalz,7 IDt Ly] uit tore ] 4 88 PF) meted 6 O27 18 4 detrt ‘Then set y=ux. Note that by the product rule, dy=udx+xdu. Then set Legtwo to be the value of Legone alter all products, including those of the form (aby, are expanded, on 1 Gulf th Legtwo=Legone//Power Expand //ExpendAl] Out 12} Bnet et x p(x) + ot? Defey ox Bets] + ve x Dee) + wx tee) ‘We then combine together terms that share the factors, 2, Dt [a], or Dt [x] and name the result Leqthree. Note that we can consider Leqthree 10 be equivalent fo the mathematical expression (0 +u)cdu+ (1402? +u!? 44°) dx Wel t3fo= i Leqtaree=collect [leqteo,{u,x,Bt[6] ,BUiz1}] butf13J= col? 5 wy x? attul + ce 2, AY) x ated Atihis point, we must solve the separable equation (uw? +u)x2du-+(14u2° +! 4u/ )xdx-0. Note tha the expression Leqthree, comesponding to (u! 4 u)x’du (14 ui yu pues dx, consists of parts. Namely, the first part of Leqthheee, obtained with the commund Leqtheee [[111, is w*(1/3)x*2Dt[u]; the second part of leqthree, obtained with the command Legthzee[[2]], is (Ltu* (2/3) tur (4/3) +u*2) xDt [ul]. Similarly, cach part of Leqthree is composed of subparts. leqthree [ [1, 2]] yields the second part of the first part of legthree Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 19 which is ; leqthree [2,11] yields the first part of the second part of Legthree which is Leu tal tale J Legthreet [1,21] Buf ttf 2 dltSh= J deqearee({z,111 | Outl t5f= [ 148 oe Since the equation we mUSt solve is equivalent (0 Legtnree=( Legthree [[1, 2] ] and Legthree[ [2,1]] Toatour=Cencea ‘Apert [legthrees, Goghareel{t 21 Regtareel (2.1101 we divide leqthree by ul té)= 17 pepo), net sae el ‘The result is equivalent to noticing that the separable equation (u'®)xdu-+ (1+ 02 +ue +u!)x dx =0 is equivalent wo the equation Adal otsing ha 2eqfourscomposal ops we can avid umecssaryeypngand compu the L Las. uw i uw incguas [Ys daant Ya by tering that = is the product of the frst and second Ww parts of the first part of Leq£oux and is the first part ofthe second partofLeqfour. x Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: irst-Order Ordinary Differential Equations tal te) Cheer [x,4,71 firstaIntegrate[ ‘Leqfour[ [1,1] legfour[{1 211,01 13 ] ] tal Oho Second=Integrate[leqtour{[2,111-2] ues 13 Logix} Henee, the general solution ofthe differential equation wi ain(1 1") at) However, since y=ux, 10 conclude that the general solution of the desired equation is, La(x) , © any constant Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton 7x so we resubstitute for u into the solution and simplify. Finally, we are able Chapter: lab tof ] wr aul tfe : Web 150 J Butf 1Sf= i 8 togtt + 1 : es mnt cotwtiontepi first n~ ‘const Erp [-zoooad ]//Simplisy out + GMI ot 100% v6 S| First-Order Ordinary Differential Equations §2.3 Exact Equations differential equation that can be written in the form M(x,y)dx+N(x.y)My=0 where an _oM ax dy QEXAMPLE 2.7 ‘Show thatthe equation 2xy'dx +(1+3x7y")d ienot exact Soluti ay : since (2xy")=on9*= = is called an exact differential equation, a3 A(t sey"), te equation 2xy°ax + (1+3x°y"}dy =0 isan exact, equation, On the other hand, the equation x*y dx + 9xy* dy =0 isnot exact since 3 OR (oxy?) Note, however, that xy dx + Sxy? dy =0 is separable, ll Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton 0 is exactand that the equation x*y dx + Sxy* dy =0 Chapter 2: First-Order Ordinary Differential Equations 2 QEXAMPLE 28 Solve(2x sin (y)+4e") dx +(x? costy)=1) dy = Osubject to y(0)= 4. Solutic ‘The equation (2x sin (y)+4e*) dx +(x? costy)—1) dy =0 isexaet since Hex sin (y)+4e")=2x cos m= (x? cos(y) =I), Let f(x,y) be a funetion with Bau sin (ye and 2 couy)-1 The, 63) [2x singe asin) +66 i sie B= stonty)=1 and B= stony) +81). e019) x2cos(y) +2"(y) 60 2)= Vand thus g ¥ 1G. Therefore ((x,y)=x2sim(y) y 1 Cand sin (y) y= is the general solution ofthe equation(2x sin (y) + 4e*) dx + (x? eos(y)—1) dy =0. 1 _wesbinin 'sn(4) JC som C= 4 2) z Since our solution requires that y(0) = Thetefo + the desived solution is x? sin(y)— y = In this case, we can graph the resulting solution using the built-in command ContourPLot by observing that the level curve of the graph of the funetion of two variables an sxng)-y+4 cementing ise gph ofan xsigy)-y =} In this case, the equation is graphed on the square[—ax,4r] x [-4x,4n]. The option ContouzShading->False is included to prevent the space between the resulting contours from being shaded: the option Contours-> {0} specifies thatthe contour graphed correspond to zero; and the option PLotPoants->90 Is included to assure that 90 points are sampled so that the result is smoother graph, Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton First-Order Ordinary Differential Equations Chapter: f= Exactequations Vel thn ContaurPlat{z-2 Staly]ars1/2, (x, -aPs APS) (7 ,-4PL, APS, Coatours=> (95. Hiotroints 598, Contour Shading->False] outf tf ~ContourGraphice- EXAMPLE 29 jonof the equation (-1+e%y + yeos(x y)) dx +(L-+e87 x-4x cos (x y))dy Find the general sol Solutic Webeginby defining m(x.y) =I + ey + y cos(x y).n (x, y) = 1 + ex + x cos(x y) and then trying to use DSolve to solve the equation. Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations —== enactEauotions daleh= atx_y_fetateptx glyex Costs 71; Baceycd=tekaplx y]xex Costs 1; blatjon equation-Dsolvel ees Ue] Toate x21] 7° Ce }==0,7021 21 Solve: 14ten: Tirningr Taverse tuctions are being weed by Solve outslf= Beotve(-t + 2° 41D yea ¢ costa le} rte) + Co ETAT ya x cost ria x td os 0, xO, x U Since DSolve is unsuccessful, we show that the equati x rx] isexact since ce 2m On ay Ox ‘nfl ] Bete ayl ylent tater a1 out 42]= ] alear= J stepone-Integrate(a[z,71,2] aut a5= ] BT es sinte 7] Wouse Integrate to compute f m(x,yXlx and name the result stepone, ‘The result means thatthe desired solution i steptwo io be the derivative of stepone + gy] with respect toy. of the form &? — x + sin (xy) + a(y). Therefore, we define Vale ] steptwo=D[steponergi7].7] Outftaf= ] BY xy x cosix vie o'r) Fplsteponet gly) =n. y), weuse the Solve command io fd the value of 29). Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 25 tales h= stepthreonSolve[steptwomn(x 71,5" (711 uth é5Ju at 9» Talore stepfour=Integrate[g'{y] /. stepthree[ {111.71 Outl46/= Y tala: selutinnseteponetctepfonr ut a2f= BY xe ye sinker) In dhis case, we can graph various solutions with the commend Contoure2ot by observing that level of the function e%—x + y +sin (xy) correspond to graphs of €— x + y + sin (xy) = ¢ for various values ofc ‘nsel= ContourFaatfyotetten (=, Pi,25), Sikonten si Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 26 §2.4 Linear Equations Aifferential equation that can be written in the form $Y. + p(x)y =q(x)is called a £ixst=ordex linear differential equation 1 + pla =a0oathen ef" + el" ™ pany =el""q0o). By the Product rule an Funan Theorem of Calets. (eh) J a¢x), Integrating, we abisin ol? 4 (shey) & J vo felt acont diving yo yas y= AOS EXAMPLE 210 Find he gens soluion of «BE 43 =x sin Solutic Se cgunon oy ys + 1 yas wie p= Land (msn) em, dy =n, forx>0, and f(x y)—xQ¥ +y—x sin(x) sox y— [x sin (=ydx. Using he tegration by Parts formula, [uy = wy=y dy with w= and dy =sin(x),weabain = an yet y= fin (dn =n conn [coun =a cota (0) #C gen ion of beeyaaan E4394 sin (x forn> Os osx) ein(x)4C “To graph the solution of the equation for various values of ¢, we first definey (asa function ofc) and then create a table of values of [e] fore =-3, 0, 1,2, 3 and name the resulting table sols. Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations = tncortquotions ——e | ‘Then sols is graphed on the interval [.01,5/2 2. 0 is avoided si x20 hit the option AxesOrigiin=>{0, 0} is includ to gurantee tht the al y- nce the solutions are undefined when the point (0,0). Notice that the solution corresponding to ¢=0 is not unbounded, like the other solutions, near x0. ielshix Plot [Evenuate [soils] ,(x,.01,5/2F), ‘AresOrigin-> (0,0) 1 IK 2 < 6 =| 4 a utS}= oveyhtes Infact even dughy £0} = =*£08248IN00 5, yng wen =x cos(x) + sin(x 9) Liny (01 = Lim = S280) #88209 pf, 105(x) + 00) J =-1+1=0. Consequently, even though Mathematica generates appropriate error messages (which are not completely displayed in tis case) when the PLot command 1s entered, the resulung graph i ore displayed. Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations Def ofnn Lot (y10},(x,0,274)1 Power: :inty: Infinite expression ~- encount ° Intinity: :tndet Indeterminate expression 0. CouplexIntir ‘encountered duit opm Graphics Compare soins of ¢ y= x)joto 0) =O where) =x sin cosand Solution: ‘Mathematicais able wo compute the solution of any first-order linear differential equation 2+ play =a(x) as long asitcan compute the integrals { p(x)dx and [e!""q(x)dx, lieatquitnns lal thm ] BSolvety’[xlep[=] ylx]==ale] -xie 1.2] Outf t= {rb -> S11] + tntegravese™mteretetPls) *] gin), x), ~~~ gintegratelpinl, x] Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton irst-Order Ordinary Differential Equations 29 Chapter 2: Inthis ease, p(x) = 1 and q(x) =x, sin(x), cos(x), and €, ‘To compute each solution, the table €uns is first defined and then the Table and DSolve commands are used to find the solution ofthe differential equation yty=funs[ [i] ] subject 0 y(0)=0 fori= 1, 2,3, and 4, where €uns [ [4] ] represents the ith ‘’loment of the list of functions Funes. ‘The resulting list of functions is named so and is expressed in TableForm tal f= funse(x,$in[x] ,Costx] Exp (x1); wlohe sols=Teblel. D501 ‘Observe thatthe first element ot sos 1 the list: “tx) which can be obtained with the command sols[[1]]. To evaluate the Et for explicit values oF x, we must either reenter the expression or extract it from, sols, One way of extracting the expression~1+2 “+ from the list soLs is (o enter yx] /. sols{[1]] which replaces y [x] by the value ~1+8" or to enter sols [[2,2,21] . ‘To graph cach of the explicit solutions in sols, we must extract the explicit solutions. One way of extracting the solutions is to create a table of values of yLx] where y [x] is replaced by the nule specified in the ith element of sos as done inthe following command, The resulting lis of functions is named toplot for future use, Alternatively, 8018 [[4, 1, 2]] explicitly yields the ith function in the listof solutions sols. Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 30 ‘al zal toploteredtetyl=] /. sots( (4,411,114) ] aut 20 cae eH ya, Ay gta, sate + Sl « i, 28 Finally, each function in topLot is grapiied on the interval [-1, 2 are displayed as a graphics array for easy comparison, 1]. The resulting four graphies objects labtif= (A_JowPIoefLoptot (41), (2,274,274), ‘DisplayFunction->Ideatity]? graphs=Partition[Fable[glt] (2-1,4)1,215 Shoverapasosarrayigrspeel q \e3| 4 . 2 B ag] a 246 os) 2 Ne ig 133 BI Outl 46] ria 00% viol a EXAMPLE 2.12 ay ax Find the general solution of 4x Soluti Inthis case, DSolve computes the general solution of the equation. Differential Equations with Mathematica by Martha L. Ab cll and James P, Braselton Chapter: First-Order Ordinary Differential Equations 3 = hetwio ——"7 al t6f= s0l=DSclvet 2 3ybetederaety iste (1ex-2)aEspte], uf 16] deta > 2 8 at ee Ps copy, Nevertheless, we J mnalso use the general method to directly construct a solution, We begin by computing © “and naming the result int €ac: tal Vahew J orle_}e=4n/cxeaety al t8h- ] stepone=Iatograteforix] £1 butt 8 2 Logit + x") ‘ol t9he J AntteowBxp [stepone]//Steplit7 Tooompue f +(1+x?)'c*dx , we use the fact that int fac = : 1 F from above; for later +x use, we name the resull steptwo. Finally, we are able to construct the general solution L (l+x eres +e _ stepewo + ef4] (1, <2)for(3 2x 1x2) 1 of Wethen name the solution go for later use. Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 2 inleel= } steptwonIntegrate[intfac (16x°2)°2 Expl=] x1 et 20 wiet}: } sole(steptwovoli})/inttec // Simplity wtf 1f= Finally, we will graph the solution for various values of¢ [ 4 ]. The following command creates the {able of functions obtained by replacing ¢ [ 4] by 4 fori =~2, -1,0,1, and 2, The resulting table of fimetions i¢ named seta and is not displayed since a semicolon is placed at the end of the command Wal ee]= ] ] soltab-Teble(sol 4. off1-74,(4,-2,2015 eoltabis graphed on the interval [-1.1] with the commandsPLet and Evaluate, ‘hea]= Plot [Evaluate[sotted] ,(x,-1,1)] ee AMPLE 2.13 Graph the solutionof thecqution 4 5 oy =0°* cos(x) subject to (0) =0 for Solution: sins Matenarcacamotcompus [ XA... paody ecamots sed predic a gsr Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 3 solution ofthe equation i ——== Lineartquations tafe): ] Integrate[x/(2+Sin[x1),2] uth} TotegetelyErargy: #1 However, since the desired solution is given by the formula, x Jzesing Gee *cos(s)ds (x)=. the solution can be numerically calculated for any value of x Iggy using the builtin commandNIntegrate. The following commands define ££ [2] et tobe an approximation of XSL punt] to be mm Soresngy 04 oximation of [Xe #l*e-t casita sion ot [3 wa. ‘and so [x], the desired approximation of the solution, to be — 2 l=] Explif[x]] Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations aa Plot{sol{x) ,(x,-Pi/2,3Pi/2) } oul of= thas domain [-1.5708,4.71239}, and namedaltsol. alle sLtseLemmsonve ((y° [eles 1x 1/(arsiatx1)== Exp(-x] Coste} r10}=-8) .r1x1, (e,-Pi72 3872} uf t= Uiytx) =» TatorpoletingFunation[(-15708, 4.71239), ouspy uM An alternative solution is (0 use the command NDSolve (0 approximate a solution of the equation on the desired interval. In this case, the resulting solution is expressed as an interpolating function, which We can then graph the result Takel= Plot iy[z] /. altsol,(x,-1.57,4.71}1 Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter: $2.5 Some Special First-Order Differential Equations First-Order Ordinary Differential Equations 35 A Bernoulli equation isa nonlinear equation of the form y'+p(x) Ine (0,1),letw=y'*. Then, $= (1-n)y + ‘and substituting into the equation yy" y+pOoy =q0oy" yields ae 4 p(xyy*w = q(soy! multiplying by ma yields dw, fe tO mpaaow= giao. he Hiner equation’ EXAMPLE 2.14 olve (a) y" 2a sit) ana (by y’ +4; im(3x)y" Solve (a) y’ . 10) y+ y= Fsinnyy Solution: Both (a) and (b) are Bernoulli equations with n=3 and 1, respectively, For (a), letting 2 2x Sn(3) ini the Linear equation 2-2 = 2x sin’) and dividing by 2 yields w—w =x sin(3x), Integrating we obtain o! "* : _ (4=Se)sin(2x)— 4-14 Sx)e08(3x) x e* sin(3x)dx = Sie SS Bermoulitnample nd 4h 7 stepone-Integrate[z Exp[-r] Sin{3x],x] out 142 and, computed below, 2S Coss x) , 4 = Se) Sinla x ou 30 Therefore the general solution of w—w — x sin(3x) is (4—Sx)sin(3x)—3(-1 + 5x)c0s(3x) , 50e* w= cot =A Sxsim(9x) (11 Sx)e0s(3x) te fo Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 36 Tal 4S) J steptwowsteponeso Exp[-x] uth ba5 = 2 9+ x) Coola x], (4-5 x) Sinfd x = vo 30 ] Finally y(x) =) ial t4) solationons-steptwo"(1/2)//PoworExpend Outf df= ei - RULE Sx) Costs x} sett gan 50 ] (4—Sx)sin(3x) 3-14 Sxpeos(x) +e |e x For), letting w= y=" changes y’—2y = 28 SG) Dw/Dw =x sin(x), Since the general solution of ws [(4-Sx)sin@ax)—H-14 Sx) cose) +e. ye wo” into the linear equation sinx)is w(x) = ateptwo = [(4—Sx)sin (3x)—3{-1+Sx)cos(3x) +6 Jo" from above, we obtain zi Wal 14S solutiontwo=steptwo“(-1/2)//PowerExpand ; ] Tal 46) J os=Renge[-5.71 Outl145 p= ] (5,4, 8, 8, 4, 0, 1, 2, 2, 4, 5, 6, 71 Ml tahoe ‘ographone-Table|solutionone /. o->estI1I1, G19; Differential Equations with Mathematica by Martha LL Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations Mirah Plot [Evaluate(tograhone],(x,9,7), PlotRange->{0,15] Plot: :plnr: Coupiledrunctionf <3>>]{ x] 2 not @ BAChifie-size real number at Plot: :pine Compiledrumetsonf <<>> J[ x) ig not a machine-size real nuaber at 0. 2e16e7 37 Plot [Evaluate {tographtwo] (x ‘PlotEange->(0,13}] Plot: :pinr ] wnt 10h ] CoupiledFunction{ <<>>} x} 15 not a machine-size real mumber at. | AM Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 38 . Equations ofthe form f(x y~ y)= g(y’ are called Clairaut equations. A general solution of f(xy y) = g(y’is given by f(x ey) =g(c). any constant EXAMPLE 2.15 Solve the equation 2(xy’(x)= y(x))" =(y’(x))* -y’0. Solution: We identify the equation as a Clairaut equation with f(x) and g: a !=2x'+ 1 and g(x)=x"-x. We begin by defining f and then computing fix y(x) ~ y(x)) and g(/(x)) to verify that the equation is a Clairaut equation of this form, Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations Dal Pil= anesthe x! Ix}-ri11 but 26)- 142 Grids erty? wl Pabe= masegiy" [x1] oul 77= rier? 1+2(ex~y¥ =e ~c, computed below and named implicit. inl?ah= - ] implicitettx o-ri=natel out 78} ] te2cox-nie ore? explicit. tal 8af-= J onphboit-Sotve[teptioit 11 bultoaf= 2 2, ty» PZ serttt 2s Medes, an 2 oe ~orstpraon, v interval (~.62,1.62). taf 88).= Selve[-1-04672= ut 95 {le => 1.61909), (e =» -0.618094)) an ‘An implicit solution is given by f(x —y) = 2(¢), eany constant, which is the equation + € is not defined when —1 —c +c <0 which is when cis in (approximately) the 39 Explicit solutions are calculated by solving the equation implicit for y; the resulting list is named ‘The explicit solutions are extracted from explicit with the commands explicit [[1,1, 211 and explicit [[2,1, 2] ] as shown on the next page: Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations inl 2i-= explicit {(1,1.211 explicate (2,12 Out 86}~ 297 sqrttit oF) aoe outezt= 22? sett 0+ 2p rtex ‘We will graph the explicit solutions for various values of create the ist of numbers ~5, ~4, -3, -2, -1, 2,4, 6, 8, 10, 1 lies in the interval (-,62,1.62). seatinton[Range 5. aut $6= on 6,8) 10, 12, t4) ‘We then create a able of functions. tograph. which consis the ith element of es for . 4, 5,6, 7, and 8. Since the result Unf 83/-* tograph-rapiely /_ explicit /. o-0s{(1}1, G18) ]//Flatten out oa/= SeE1202] = 20 x ~Sqrt 299) - 20 x ‘Sqrt[s52) - 16 x ~Sqrt1i52) - 16 x sarees) — ze saree) - ee, 7 , sertiag) ses, cagreiaoy ox, 7 ae, Prox Prox a. ‘Sarti9@] +16 x -Sertige) + 16 x sqrt i292) + 24 x -Sqrt292) + 24 9, which is then graphed on thei to indicate that the range of y-values displayed is [-15,15] We begin by usingRange and Union 10 and 14, Note that none of these numbers -xplicit solution by. i lis is list of ordered functions, ‘we remove parentheses with the command FLatten so that the result is alist of functions: terval [-2,2]. In this case, the optionPLotRange-> {-15, 15} is uscd Differential Equations with Mathematica by Maetha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 41 inf 90/~ Plotsole=Piot [Evaluate |tograph} (z,-2,2), PlotRange->{—15,15}] ut 20} ] ~Sraphics- Another solution, not obtainable from the general solution and called asingular solution, is obtained by differentiating both Ls and hs with respect 0 x. Tale = ] a a | out'210 I | 43 Gate sare eit ] “al seh= arkseD [rhs 2) : utf92}= ] ora) #2 tel te Wo obtain the equation 4x yx ¥x) — yO) = y"@IEy"G) — 1). Factoring yields the equation (1 —4x yx) — 2y'(x) + 4x'y(0) = 0. IF y“(x) # 0 (note that in the general solution obtained above, y"(x) =0), then 1 ~ 4x y(x) ~ 2¥(8) +4x°y(x) =0. 1H 4x yx) ~ 2¥(0) + 4x'y(x) is then oxtracted from stepene with stepone[ [1]]. Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 42 talaoh= stepone=Factor [4hs-arhs] out e5~ Ge deri ayes oD kD dal f= stepone{(11] ou oatf= xy) ari tae yi ‘We then use DSolve to solve | —4x y(x) ~ 2y(x) + 4x’y'(x)=0 and name the resulting list singular. Taf 05T= siagular-BSotve[stepone! [1] Ont 25 f= (ater > B+ setts + 28) erty) rte) x) ‘Thesolution $4+C,Y27—1 isextracted from singular with the command singular [[2, 1,2] ] and named sol, solestaguler{ (1.1.21 ou s6i= Be serties 42x71 cri Ai sot, naming the resus dsol and d2sol, respectively: Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 43 Inf 92m dsol=B[singuler[[1,1,2]],x] oul 92= 1, geet 2 sated + 22) Ini 98) d2s0l-D{singelert{t,1,2]1,42,2)1 ontfa8}= ado, acu) G42? seretet 22] ind then replace y [x] by sol, y’[x] by dso, and y ”[x] by 42sol in the equation Lns==zhs. We then salve the resulting equation, tesalve, for C{1] and name the resulting list of solutions roots. Tal 93h ] tosolvowlaswarhs /. (y{x]~>s01,7"[e]->ds0l, Fo txlsdaeod) oul o9f= 14-2 Pomerig = sqrtiet 6 2x7) ct) + qe 22 aye Pores are Th ase a ap - 224g, ana meetet s 27) 2” Serer v2 tel t00f= Footactolve{tosotve,¢{11] out 100/« ets} > aarti, (ern => sem» zis Therefore de singular sotutonsate yox) = 3 SV Inthe following, we obrain the singular solutions by replacing the constants in the listsAnguzLar by dhe values obiained in cots and name the resulting list singgraphs. Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ontnary Differential Bquatons inn Sroprerhsosingalar /. roots//ristten earn be seid 2 triek > $s see serett «22, rie) > f= seth) atts oD) The explicit solutions are extracted from siinggraphs with the commands singgraphs [1,2] ] snd singgraphs{ (2, 211 ‘al oet= s2300rePaSL 12.211 Butf102}= B+ sareigi sarti-t + 2x7) nt 105fs0 singorepbe (12,211 out t0s}= Be sored) sorei-t 2 ‘The singular solutions are not defined when 2x8 — 1 <0 which occurs (approximately) on the interval (708.708). inl todl= Out 105 (a => 0.707107), a> arene ] 708) and then show the resulting Finally, we graph the singular solutionson the intervals (708, graphs simultaneously Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 45 Wai 102= pone=Piot [Evaluate | (singgraphs{ [1,21], étion->Tdentity: pevoarite Evaluate (aiaggrepia (4,211, ‘Sanogrepnel (4.21101 Sizpic Show{pone , ‘BsplayFunction-»$0ispleyFunction] utf 107} = serepiice a 00% ve . Equations ofthe form y =x fly) + (y’) re called Lagrange equations. Let p= yx). Then, differentiating y= x fy) + g¢y’) with respect to x yields Y= xtUy ys HY) 1 giyy" und substiuting p into the equation yields paxr@ Perro 2= ry 2x rere ge] Solving for 7 yields the Tinea equation 2X — X7)+ 2°) which is equivatentio Hy MO) 2) se Gy p=) SRN Go Fpy=p*” p= HP) XAMPLE 2.16 Solve the equation y (xy +(2) - 2). Solution: We begin by observing that the equation isa Lagrange equation with {(x)=% and g(x)=3x* 2x" and then defining fund g. Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 46 dy oy af YY afdvy fay), Lex p= Thon, ditromiaing y=x( GY) «o{$%) {$F with sapectio 5, subsating Fp) ). 80) 34 Fate |= patepy- Below we compute ay ox dx by p,and solving for 2 yields the equation Gy —* op ip ro) p-l(p) p=’ and name the result steptnree. aan the result stepone, and en Conypue and simply stepone=-£"[p1/(2-£1P1) oul Sfo as ~ Malan stepthree=g" [?]/(p-£1P1)//Cancel ult 6 Jersponeip We then compute e! Gana the result sept wo, compute steptwo stepthree dp= foe! seePereth _ 6p 6p? +2p?, and name the result steptour. ais stoptwo=Exp (Iategrate{stepone 21] outs} Case? Malin steptoursIntegrate[steptwo stepthree out» ep-ereay Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 41 &x_ (7 ‘men te genera solution ot 2 — : a *\p=109) de. dp p= N(p)=stepfour +csteptwo= fel” Gap +e{—22ap Pop o(p—1)' 6p 6p? + 2p" Since y(p) = x(p)fip) + g(p) we obtain y(p) = 3p* —2p* + p*(o(p—1)* + 6p—6p* +2p'). oct ent +6p-6 e208 welh= J rip_iexip] £Ip}+ato1 outfa/= ] spt-apte te cit t+ sp- sp +2ny Below we graph the parametric eauations |) for various values of c by first defining esone to be the set of numbers =10,-8, .., 8, 10, then defining togzaphone to be a lst of the Functions {xip)y(p)} in which e is replaced by the ith clement of egone for i= 1,2, .. 11, and then finally graphing the lis of functions tegraphone with ParametricPlot. Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations uta -Graphios- . A Ricatti equation is @ nonlineat equation of the form y-ra(a)y’ + Deady Fes) =O. et yx) = MOL then, yc) = WO _ (WOO) GOW ag Bet) wea) aay TM™ YO GHC aCRKWOR)” (aC) WOR) substituting ino he eyuation y’ea(xny? + xy + ex) = O yields de second - under equation w(x), (won) __a’cow'(x) GOW) aGywoo) Multiplying the equation by a(x)w() we obtain _ awn) VO]. + b(x)w’(x) +a(x)e(x)w(x) =0 and simplifying Yields the second - order equation wW” =n) wtacayecayw =o, Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton 48. Chapter 2: First-Order Ordinary Differential Equations 49, CUEXAMPLE 2.17 Convert the Ricatti equation y’+(x!-+x? + I)y? + toasecond-order equation. Solution: Sex +1, B(x Leuing y(x)= 09 1 yiotds the second-order equation +1 w(x) a(x) 1 Wife rte hw ae (S38 2(l=x+x*=2x' +x‘) sshich simplifies Met] Tex? ext tow’ QW 1 wa. In Chapter 4 we will lean how to find an exact solution of w’~ 2w’ +w = 0. For now, we use NDSol-ve (0 approximate a solution of =x 4x2 = 25" xt yie(xtex? + Dy? + subject 0 y)=0on the Pe el G@,172,1)1 i Out t5f= | (at) > InterpolatingFonotion{(-0.5, 1.), O11) ‘The solution which results is then plotted below withPet. Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 50 ial tal= Plot [y[x} /. approx,(x,-1/2,1)] §2.6 Theory of First Order Equations In order (0 understand the types of initial value problems which yield a unique solution, the following theorem is stated. At this point the proof is omitted, ‘Theorem (Existence and Uniqueness Consider the init ¥ = fly), yO%o) at 1 Fand Sy are continuous functions on the rectangular region R: xb, sys containing the point Go» yo then these exists an intervally-Xg|~heentered at x on which these exists one anxl only one solution to the differential equation which satisfies the initial condition. CUEXAMPLE 2.18 Solve the mitial value problem dy x ox 00) Does this result contradict the Existence and Uniqueness Theorem? Solution: ‘This equation ean be solved by separation of variables whi ily solved to determine the family of solutions y*—x’ yields the equation ydy = x dx which is . Hence, i 0, then C=0, Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations ‘Therefore, two solutions pass through (0.0), y ‘Mathematica below _——— nl6ah= Avp=BSolve (x" [x]==x/7[21,710]==0) 2121.21 Oullé9f= Aerbey -> Sertte")), (rie -> -Seret2"D)) x and y lal POf= ivi ttt 1,211 Ouif 70)= fart tn) Ul?tfn vPU(2.1,211 x. The problem is also solved with a nally, the two solutions of the initial value problem are plotted. Mie Phot [Clvet tt 121) Avott2.t. 210900119, ‘Aspeothatio->1j aut 72 aa. Tos + EC Although more than one solution satisfies this initial value problem, the Existence and Uniqueness Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations 52 Theorem isnot contradicted since the function X isnot continuous at the point (0,0). y EXAMPLE 2.19 ‘Verify that the initial value problem ay dx y0}=1 nasa unique solution, Solution: ‘Notice that in tis case. the function fix.y ey. Hence. box tana axe continuous on all 12 (0,1). Therefore, there exists a unique solution to the differential equation This is illustrated below with Mathematica 1d several of these curves are regions con whiich also satisfies the initial condition y(0} Firs, the general solution to the differential equation is determined plotted. SSS hes SSO al: DSolvely" (x) out 73) ) tert =» cup) ‘The constant C[1] in the solution is replaced by a so that particular values can be substituted fora in the form wal r= UA 2017-€(1 28 relate ] Below, a table of solutions for values ofa on the interval [0.25.2] using inerements of 0.25 i ereated in family. Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 2: First-Order Ordinary Differential Equations hrs Santhyateiel TU 12117-6190, (a, .25,2,.25)] Out 25) (025 os oor 1 FE cane sat 173, 2. BY through the point 0,1). Ul 76= Flot [zvaleate{famtiy1],(2,-1,1)1 value problem, ‘To further verify that this initial value problem has a unique s 33 ‘The graphs of the functions in family are plotted below. Notice that only one of these curves passes “olution, DSoLve is used to solve the intial We Avp2=DSolve[(y" [x}==71x1,710]}==1) .¥1x1.21 Out 72} tat > Fy mao +o Differential Equations with Mathematica by Martha L. Abell and James P. Brasclton Chapter 3: Applications of First-Order Ordinary Differential Equations Mathematica commands used in Chapter 3 include: Apart Evaluate PlotPointe AspectRatio FindRoot. PlotRange AxesOrigin GrayLevel Plotstyle Cancel Integrate PlotVectorField ContourPlot, Limit Replaceall Contours ListPlot ‘Show ContourShading Log Solve D N Table DisplayFunction Part DSolve Plot §3.1 Orthogonal Trajectories Two lines L, and L;, with slopes m, and m,, respectively, are perpendicular if the respective slopes satisfy the relationship m = 1, Hence, two curves C, and C; are orthogonal at @ point if the ve tangent lines to the curves at that point are perpendicular. respect EXAMPLE 3.1 Use the definition of orthogonality to verify that the curves given by y = x and y = Solution: ‘The derivatives of the functions are given by second formula for y' yields 54 Differential Equations with Mathematica by Martha 1, Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 55 isillustrated below with Mathematica by plotting these two curves on a small interval centered at 42 wD First, this particular value of x is entered asa for convenience, OSS orthogonarajectories ————t Val thn anSqrt[2}/2 ull tf | 1 STI ‘Then, the two curves are plotted on the small interval |a-05,a405} to illustrate that they meet at a right angle. defen Phot [x Sqrt[1eA2]) ,(x,0-. 05,04. 05), AspeotRatio->1] 0.74 066 0.8 ee 0.74 0.68 - e.ce! \ outte}= ] ~Sraphios- EXAMPLE 32 Find the family of orthogonal trajectories of the family of ellipses xy + y ‘Skotch the family and the orthogonal trajectories. Differential Equations with Marhematica by Martha L., Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 56 Solutio. We lirst determine the dilferential equation saustied by une Lamily of ellipses. Implicit ditterentiauion de oy yd of iets | oe-ryyse9 or 20-y-n 9 4 ry M-0, Hence, 2y-ay 8 w ax as ax =y-2x,90 oy _y-2x ox 2y-x Below in sol, implicit diferentiation is carried out with Mathematica wo yield the desired formula fory” by differentiating the equation x xy(x)(y()? with respect tox and then solving the resulting equation for y(x) Sl J / solesolve(D[x"2-x yix}er[x1-20,2),7" [=] ul 5) crs 9 Azz i ‘This formula is extracted with the command sol [ [2,1, 21]. dnb Tl H so t1.1,211 Outta ] : stall Hi ‘Therefore, the family of orthogonal trajectories satisfies @¥ _ =X +2y. dx Qx-y ‘Tis is a homogencous fistorder equation which cannot be solved divecly withBSol.ve as indicated below. First, the right-hand side of the differential equation is defined as oztth below for use in the next step. ‘Then, we attempt to solve the equation with DSolve, Unfortunately, DSove is unable to solve the equation, ielsh= orthe-t/soll tt, Dutt) +2 vee Differential Equations with Marhematica by Martha L., Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 7 Tafel= aseDSoLvety”[xIowort 7121.21 Ouiféf= peoteety ta) = ZEAE, viet, ‘Note that by using the chain rule, we have However, it can be solved by making the substitution v ay _ av : foams, de S=eod i ax * Ge TY By substitution, wehave the ciferentalequationinvolving v: x SY + v=" which is separable. This leads to 2=¥ g & The integral of the left-hand side of the equation is found vai below with Mathematica, The symbol Log (:] represents the natural logarithm function, nal Tohm J Integrate [(2-¥)/(9°2-1),7] Dif 10} Logi-t + v) | 3 togit + v] ‘Therefore, we have the following equation which must be simplified with logarithmic properties. J Logl-1+ v}~FLogl1 + v}=Loglx]+€ © and simplification yields ]+6. Ax? or EU=% — xt where Acwonstant. Therefore the onhogonal (y+xy Differential Equations with Marhematica by Martha L., Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 58 yox (ya) plotted below with Mathematica, ‘The family of orthogonal trajectories is plotted below in ep with ContouxPot. Note that we avoid the discontinuity at the origin. The option ContourShading->False allows us to view the contour levels more easily. ContourPLot merely plots the solutions for different values of the constant A. In addition, the option Contours may be used to select particular values of A. Daft opinContourPlot [(y-2)/(y+2)73, Gr, 011) 7,014), Goatoursmidiag-rFaise, ContourSacothing->trus] trajectories are given by =A. The faily oF ellipses und the orthogonal urajeciories are a] 0 02 04 Out th ~ContourGraphios— ‘The family of ellipses is also plotted below in ¢p2’ with ContouzPLot. Again, the ContousShading->Palze option seting i used so that the contour levels can be sen more easly Differential Equations with Marhematica by Martha L., Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 59 inl teh= op2aContowrPlot [x~2-x ye7"2,{x,.01,1),{7,.01,1), ‘Contoursnadiag-sFaize] 4 oman B\ El 0 0 02 04 08 Out 12} ~ContourGraphtos- Finally, the two families are then viewed together withShow. ita = hover .cp2] Differential Equations with Mathematica by Martha L Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 60 §3.2 Direction Fields ‘The geometrical interpretation of solutions to first-order differential equations ofthe form important o the basic understanding of problems ofthis type. Suppose that a solution fo this equation isa function y-(x). Hence, the solution is merely the graph of the functiom. Therefore, if (x.y) is a point on this graph, the slope ofthe tangent line is given by f(x,y). Aset of short Tine segments representing the tangent lines can be constructed fora large number of points. This collection of tine segments is hnown as the direction field for the differential equation and provides a great deal of information concerning the behavior ofthe family of solutions. Matematica is quite useful in overvoming the tedious task of drawing the direction field. The graphics packagePLotFie1d .mmust be opened first in order to take advantage of these useful conmmands. We illustrate this procedure in the following examples. AMPLE 33 Find the direction field associated with the differential equation Solution: First, the appropriate Mavhematica package is loaded. The command Plot VectoxField can then be employed (0 plot this field. Notice that the argument of this command is a two-dimensional vector. Hence, dhe fist component iy aubivaly taken (© be 1 and Ue sevonkd component is M(s.y) fio Ue 0, then the population is increasing (growth) while the population decreases (decay) if k <0, Problems of this nature arise in such fields as cell population growth in biology as well as radioactive decay in physies, The model introduced above is known as the Malthus modet due to the work of the English clergyman and economist Thomas R, Malthus. EXAMPLE 3.4 ‘The population of the United States was corded as 3.3 million in 1800, Use the Malthus model to approximate the population if k was experimentally determined (o be 0.03. Compare these results to the actual population. Is this a good approximation? Solution: For convenience, the Malthus model is solved in general for all values of r and yj, This enables us 10 refer to this solution in other problems without sol ving the differential equation again. The solutionpop which is a function of t, r and Yo is extracted from the output list of peq with the command peq{{1,1,2]] === Population tal 11: peq=BSolve[(y"[t}== x y{t] 7101 Dutt tJ™ cerita > af * yyy Und t2h= peqtit.2.211 Out 2f= Ft yo dal 3h: pop(t_,x_,x0_l=peq{{1,1,2]] Out t3}= ] BY yo 70) ,yft1,t) = Ex This function is then plotted with r ~ 0.03 and y, ~ 5.3. For comparison, the census figures for the population of the United States forthe years 1800-1900 are entered in the listpdata and plotted with Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 64 ListPlot. The two plots are then displayed with Show. aaltabe= ] popit..03.5.31 Bull taf oie. ] bal t5fo2 popplot=Plot [pop[t 03.5.3], (¢ ‘DisplayFundtion->Tdcntity]; 8) ,80,29'2) {60,8109 ipdate, DicpleyFunction>Tdeatity1; 2,107.2) (2.9.6) (98.0.9), 4 approximation diminishes over time. Hence, another movlel which hetter needed, approximates the population inltar= Show[popplot ,dateplot, Displayanction s$DisplazFenction] 100] 20] 40] 20} eutl 137 -Sraphtos- The logistic equation (or Verhulst equation) isthe equation y(O=(F—ay(y(0) subject to the condition y(O) = y, where rand aare constants. Tis equation was frst introduced by the Belgian mathematician Pierre Vertulst to study population growth, Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 65 EXAMPLE 35 Use Mathematica o determine te general solution ofthe logistic equation. Approximate the population using r= 0.03, a = 0,0001, and yp = 5.3. Compare this result with the census values given inpdata in the previous example, Solntion: ‘This example is solved similarly to the previous example involving the Malthus mode! in that the general solution is found which depends on the parameters fa, andy Fist, DSelLve is used to determine the general solution of the equation y'(t) = (r—ay(t)) yt) subject fo y(0)= yin dea. Tal Tom dez=Dsolvel (x [t]==(r-a WED It, O}ay@) FLL) uf 19} att) Belov the solution is extracted from the output list ofde2 with the command de® [[2, 2,21] Taf 20-= e211 .1,211 utl20}~ and defined as the function Logistic. Te ote aot ot det tat ] bulf2t}= et ety ae ‘This tunction is determined tor the values of f, and y, indicated above. Wl22h~ Jogistio| .03,.0001,5.3,t] oufzet= gene 9, 00556030 + 0.0001 F Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 66 Using Zaimit, we see thatthe population inthis case approaches 300. dal 23)" ] Lindt [Logistsof-09,.0001,5.2,0],t- >Tasinity] Outl 25}= ] sou. the census, we first plot the approximated popul in order {o compare the approximated population obtained with the actual population obtained through ion below inpopplot2. alti popplot2aFiot [logisticl 0 {e,0,100), Pidtiange>(0.100) DispleyFuncticn-rtdentity]; 015.381, "Note that when this graph is display fed below with Show along found in pdatea, the approximation is more accurate than that obtained with the Malthus model. th that of the actual population values inf2aT= Showipoppiotz aatepiot , DisplayFunction->$bispleyFunction] 100) Outf25)~ MEXAMPLE36 Th ] Use Mathematica to investigate: (a) the behavior of the solution when the initial population is varied, and (b) the behavior ofthe solution when values of rand aare varied Solution: (a) First, we investigate the behavior of the curve as the value of assumes the values of 0.1, 0.2, and (0.4 which are located between 0 and 3. Plots which correspond (0 these values are created in different levels of gray in plot, plot2, and plot3 below. These three graphs are then displayed simultaneously with Show. Notice thatthe curves which correspond to larger values of y approach the limiting population r/a more quickly. Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations a Di28 = plotiaPiot flogistio[3,1,.01,t].(t.0,9), FlotRange>All ‘zesorigian>(0,0) latstzie-sereztevel [ 21, DispleyPunction->Taentaty]; pala): plot3ePlot (Logistio[3,1,.4,},(¢,0,5), PiotRange->All azesurigia->{ Ploestyi Pano ‘BsplarFunction-ridentity]; ae i: plot2ePict float stiol3.1,.2.61.(8.0.5), ‘FiotRange->ALL AxosOrigin-»( inl 28ho= Show[ploti ,plot2,plot3, ‘DisplayFunction->$iisplayFanction] outl281= ~Sraphios- (b) Plots which correspond to solutions which depend on the values of ¢ and a = 2 are considered in this case. The curves that result from the values of y, = 0.5, 1.5, and 3.0 are plotted simultaneously in varying levels of gray in pLot4 below. Note that each curve approaches the limiting population of 1.5 which isthe ratio n/a, Differential Equations with Mathematica by Martha L Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 68 Inf s0h= PlotdaPlot { (Logistio[3,2,2.5,t1, Togistie[3,2,1.5,61, Jogintael3;27-3,01)- (220,5) Fotiange>411, Pidtstyie-> (Graylevel['2] ‘OrarLevel [0] erazlevei.41)] os! Outl 30 -Sraphios- In plot below, the plots for the curves which are determined by r = 3 and k = 0.5 are shown for various values ol a, The values considered for a are a = 1, 2, 3. Note thal each eurve approaches a init of rfa=3,2, 1, respectively. dl 31]- li plot5-Plot{ (Logistiel9,1,-5,¢1, Jogistiols,2, 3,01, Logistte (3,3. °5,t1; . (er0;3) sFisthange sia, Histstyie->(Greylevel| /2], ‘GrayLevel [0] GrerLevel [.41}] ol ul 51} Graphics aT SEE ST Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations EXAMPLE 3.7 9 ‘Assume hat there are initially 1 grams of a radioactive substance, II the hall-ite of this particular substance is 1 year (half of the substance decays over the first year), then determine the time required for 9 grams of the substance to decay (ie.,1 gram remain), Also, determine how many grams remain alter 6 years, Solutio First, the initial value problem, y'() = ky) subject to y(0) =, is defined and solved in 1 below. The formula is then extracted and used to define decay with the command cay [t_, k_, yO_]=41 [[1, 1, 2, 1], 8 fimetion which describes the amount of substance present at any time t GdeDSokvet x" (t]==-e y1t] -y{0}==79) 7181.8) ulate cate > Boo Wl sm aan outf3/~ # Taf decay (t_,k_,y0_J-€1(11,4,211 Outta # The solution is then ploued for y,=10 and ‘determined. The value of k appears to be near 07, Differential Equations with Mathematica by Martha L {so that the constant of proportionality may be Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 70 Walsl= Plot [decay (1,4,10] (2,011 | | 6 3 0a 04 06 08 1 Outf5}= ~Seaphioe Hence, this is used as an initial guess with FindRoot to obtain a more accurate value in const. The kk-value is then extracted from the output list of const: and used (o plot the solution as a function of time. ‘all> const FindBoot {decay [1 2,10]--5,(8,.7)1 oxtf}= (> 9,599147) alte const (1,21) 20tf 7h 0.699147 Since we need to determine the value of time when 1 gram remains, we again use theFindRoot with an initial guess of t= 4 oblained from the plot. Hence, approximately 3.32103 years are required for 9 ‘grams of the substance to decay. Finally, {= 6 is used as an argument ofthe function (o sce that 0.15625 _grame of the substance remain after 6 years Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 1 ifthe Plot [deoay[t ,const[{1,21],10],(¢,0,10)] out (t —> 9.92180) nb toh= ] decay 6 const [1,211,101 “alsfm FindRoot [deoay {t const [1,21] ,10]==1 .(¢.49] Quit lO} 9.18608 §3.4 Newton's Law of Cooling Newion’s law of cooling states that the rate at which the temperanure ‘T() changes in a cooling hody is proportional to the difference between the temperature of the body and the constant temperature T; of the surrounding medium, This situation is represented as the first-order initial value problem temperature of the body and k is the constant of proportionality. We investigate avulying Newton's law of cuoiing in the following exaupies. AMPLE 3.8 ‘A pie is removed from a 350° oven. In 15 minutes, the pie has a temperature of 150P. Determine the ‘me required 10 coo! the pie 10a temperature of 80° so that it may be eaten, Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations R Solutio ‘AS as been the case in the cartier examples, the general solution which depends on the parameters of he problem is determined. Here, the resulting function is called temp, the surrounding temperature ‘temps, the initial temperature tempO, and the constant of proportionality k. The solution based on the data indicated in this example is then easily found, ‘al teh det-Dsorvel (tp" [t]m=-k (tplt]-teaps), ero] tone) tte 1 2) out zl ({tpit] -> temps + see) al ihm tomp[temps_,tomp0_,k_,t_Jedet [11,21] ‘tons + tempo stamps + tense ‘The solution using the parameter values needed for this problem is given below, ‘al the ] tenp(75,950,%,15] out ttfn ] 25 me gee Since the constant k is unknown, itis determined below with Solve and called Ie1 for convenience. ‘Notice that only one value in the output list of this command is a real number. This number is extracted in the usual manner so that it can used to determine the time at which the pie reaches its desired temperature. This is accomplished with FindRoot by, fint, plotting the solution to obtain an estimate Of the time at which the temperature is 80 degrees and then using this initial approximation with FindRoot. Since the value of the funetion seems to equal 80 near t= 40, the initial guess of 40 is used to achieve the more accurate value of { = 37.1614. (Note that FindRoot could have been used (0 determine the constant of proportionality above instead of Solve in onder 10 avoid the waming Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations B Wal 15h= Ai=Solve| teap[75,350,x,15}==150,21//0 Solve: : fun: Varning: Inverse functions are being © Solve, 30 soue solutions nay not be Out 15 (Ux => 0,0866189) , (> 0.0866169 + 0.419079 1), (->-6,0066109 0.807988 1), (> 0:0966199 + 1.25664 1), Gc => olegesias + 1e7es2 2)! (a > 0.0366ie9 + 2 09447), (> 010966189 + 2.51327 11. (>> Oloeceies + 2.99215 1); { -> 0.0966169 = 2.99215 1}! (Ge > a.ocese9 | 2'8:027 1), > 0,0966189 - 20944 1}, 0! caseies - 1167882 1), 0°nag6ies = 125664 1)’ 9, 0566189 - 0.637759 1), O.ceecies 0.410979 3)} ‘This number is extracted in the usual manner so that it can be used to determine the time at which the pie reaches its desired temperature. tal toh= RAUEA,211 Out t6fm ] 0. ceee1e9 ‘This is accomplished with FindRoot by, fist, plotting the solution to obtain an estimate of the time at which the temperature is 80 degrees and then using this intial approximation withFindRoot.. Since the value of the function secms to equal 80 near t= 40, the initial guess of 40 is used to achieve the more accurate value of t= 46.264, (Note thal FindRoot could have been used to determine the constant of proportionality above instead of Solve in o1der W avoid the wamning messages which resull with Solve.) Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 4 ial TE Pot [teap{79,350 300) 230) 200) 150} 10 ACL ,1,201,01,(8,0,50)) 1 2 390 a0 80 Out t 7} -frephioe= tal tah FindRoot [tewp(75,350,K1[[1,1,21],t1==80, ie aoyy ul 18} th > 45.964) MEXAMPLE39 In the investigation of a homicide, the time of death is often important. Newton's law of cooling ean be used fo approximate this time. For example, the nommal body temperature of most healthy people is 98.6 degrees. Suppose that atthe time that a body is discovered, its temperature is 82 degrees. Two hours later, itis 75 degrees. I the temperature ofthe surroundings is 65 degrees, what was the time of death’? Solution This problem is solved similarly to the previous example, First. the value of the constant of proportionality is found with Solve. The real number given in the output list is extracted to obtain a ‘vale which is sed to plot the solution in ore to appmnximte the time at which the temperamee of the body is 98.6, Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations on w2aSolve [temp [65,02,2,3]==75 21/78 Solve: :tfum: Warning: Inverse functions are being t Solve, 30 some solutions way not be outta} (Ue = 0.176076), => 0.176876 4 2.0944 TH, (Oe -> 0.176876 ~ 2.0944 T)) lh 109: Plot [tomp[6s 2 22111,1,217,61, 48 \ 105 x9} °s 0} aa] ~ 2 ae “Graphics that the person died almost 4 hours prior to heing discovered. Vel tOh= Famatoot (emp 69,03 42((4/1,211,U10098.6, out taf= ] ke => 3.05190) §3.5 Free-Falling Bodies Newion’s second law of motion states that the rate at which the momentum ofa body changes with respect to time is equal to the resultant force acting on the body. Since the body's momentum is defined as the product of its mass and velocity, this statement is modeled as Differential Equations with Mathematica by Martha L Abell and James P. Braselton 18 ‘Since the time at which the body Was discovered was taken 10 be t= 0, the curve must be plotted over negative values oft This plot reveals that death occurred near an] Hence, this is the initial guess used with FindRoot (0 obtain the value of t= -3.85192. We conelude Chapter 3: Applications of First-Order Ordinary Differential Equations 16 J qas=F where mand v represent the body’s mass and velocity. respectively, and Fis the sum of the forces acting on the body. Since m is constant, differentiation leads to the well-known equat Ifthe body is subjected to the force due to gravity, then its velocity is detcemined by solving the differential equation av we, Gt =mgor eae where g = 32 fs! (English system) and 9.8 mvs (metric system), This differential equation is applicable only when the resistive force due to the medium (such as air resistance) is ignored. If this offsetting resistance is considered, the equation becomes, de mif=mg-k, where F, represents this resistive foree. Note that down is assumed to be the positive direction. The resistive force is typically proportional (0 the body's velocity or the square of its velocity. Hence, the differential equation is linear or nonlinear based on whether or not the resistance of the medium is taken into account, EXAMPLE 3.10 ‘Compare the effects that air resistance has on the velocity of an object of mass m=0.5 which is released ‘with an initial velocity of ¥j=0. Consider FR=16V? and Fy= We attempt to use DSo1ve to solve the initial value problem. Unfortunately,DSolve is unable to yield the result Therefore, another approach must he taken which involves separation of varies, Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 1 == Felines ———7s| tnleln s012=DSolvel (x [t mng-(o/a) (v1 1)“2.¥10]==¥0) ote st Solve: “ten: ‘The equations appear to involve transcr functions of the variables in en ess nonselgebraic wey. ut el= a pssveter ty a 9 = 2H, v9} vp, vit), "This separated equation is 2a. Mathematica can be used to aid in the integration by partial fractions as illustrated below: ‘The solution is found below 3(rey try v= at vi K,exp(6tt) Kvexp(64t) 1 K,exp(64n) +1" Application of tie initial condition gives Kj=1, 90 the solution is exp(64t)-1 expey4l” ‘This solution is entered below as:xv[t] and then plotted in xpLot on the interval {0,5}. (The display of the plots suppressed.) vo= Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations B ‘alslo= 7 Apert t7ct-v-9)1 out | “1 1 ICs wy ray i iatan | (e_-= cep t6de 1-19 /cRep (eae 164) / rploterlot{rr{t],(t,0,.9) Flotkange-rA11, BspleyFunctionsideatity] alsa ] Next, DSolive is used to solve the problem with R=16v. Tat ah= Te dog-BSolve[ (¥" [t1-=32-92¥(¢1,x[01==0) ,v1t1,t1 |||) O0tf 2} ] H Cote) 1? Hy Ll ‘The solution is extracted from the output list; and also plotted on the interval [0,5] inpLot2, (The display of this plot is also suppressed.) Talal UU4,20 aut} nb) PlotgePlot [deg {1,1,211,(¢,0,.5}, ‘PlotBange->411, DisplayPanction->iaentaey] Outf af ] | ~Graphics- Both solutions are then displayed together with Show. Notice that since the velocity values are on the interval [0,1], more resistance is offered when Fy=16v is used. The graph of this function is he dauker of the two curves. In this ease, the object reaches its limiting velocity of 1 more quickly than in the case with F.=16y" (de lighter curve). Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 9 a y00% vio a AMPLE 3.11 Determine the general solution (for the velocity and the position) of the differential equation which models the upward notion of an object of mass mi when ditevted upward wilh an initial velocity of from an initial position y assuming thatthe air resistance equals cv. soL=DSoLve[{¥" [tI==-g-(o/ap v(t 41 VEL ED ant tf 2a deve] > EE) + ” 3) * ety ial tah= veloodty Outf 12] = eyo -D + tan ob aso2 1 1217 Differential Equations with Mathematica by Martha L Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 80 For example, the velocity funetion for the case with 1 1 3 wig 1s 10) ly, this function can be employed to investigate numerous situations without the 2=32, and vy is found below. Simi need to solve the differential equation each time. ‘ial 13) A velocity[1/128,1/160,92,40,t) ‘The position funetion is easily determined by integrating the velocity function. This is accomplished below with Solve using the initial position y,, As with the previous case, the output is named pos so ‘that the position formula may be extracted from the output list for later use. pot gat, ne aigeeow , tater > BES Sie ™ al tS ] | | position(a_,o_,g_,v0_,x0_,t_l=post{t,1,21] | | i i out t8/= ° / WP gmt ar) nent yg | mt Soe LC The position and velocity functions are plotted below using the parameters listed above as well as Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 81 ] Solve is then used to determine the time at which the object reaches its maximum height. ‘This time ‘occurs when the derivative of the position is equal to zero. Since warning messages appearFindRoot is then used to illustrate thatthe derivative of position equals zero at the time at which velocity equals zero for those parameters, ial = rootasolvet Diposition|1 /126,1/160,32,46,0,t1.¢) Soive: : tun: Varning: Inverse functions ere being us ‘Solve. so some solutions say not ef ut 17x {Me =r 0.985072), (& =r 0.900872 + 1.5700 2), {i> 0.988572 «3.14159 T), te > 01988572 * 1/5708 1) dal tal= FindRoot[velooity[1/128,1/160,92,40,t1==0, Outf18= (t= 0.909572) Below, we compare the effects that varying the intial velocity and position has on the position function, ‘Suppose that we use the same values used earlier for m,¢, and g. However, we el y=#8 in one function and vj=36 in the other. We also let yj=0 and yo=6 in these two functions, respectively. Note that the (darker curve corresponds to the second function listed below in thePot: command, Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 82 wahsaI= Flot [(positsonl1/128,1/169,22-48,0,¢) ey out su} ~Sraphios- Function. The values of vp used are 48, 64, and 80. The darkest curve corresponds to y=48. Notice that as the initial velocity is increased the maximum height obtained by the object is increased as wel wbsihe= Plot [{vositdgnl1/128,1/160,92.48,0,t1, position[1/120, 1716092 ,64.0,¢1, Pysstdon(1/1z0,17160/32.6070,¢15 ¢¢,0.2), Biot Strle—s{erczlovel [0] erazt orepievel 1} Dull 5) Brapnsos~ ‘The graph below indicates the effect that varying the intial position and holding al other values constant has on the position function, We use values of O, 10, and 20 for y;, Notice that the value of the position vertically translates the position function. Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 83 talszh-= Flot [ (position! /129,1/160,92,49,0,t), position[1/128,,1/160,22,48/10/t], Position{1/120 ,1/16092,40,20°}) ,(¢,0,2), Flotstyle->(OrdyLevei [0j ,oraylevei[ 31, Grayievel[-41}1 Investigate the motion of the object if Fi=0 (ie., if air resistance is ignored). Solve for the velocity and. position as functions of time, initial velocity, and initial position, Compare these results with those of the previous example which involved air resistance. Also, compare the effects that varying the initial ‘velocity and intial position has on these functions. Solu Since we ignore all resistance forces due to the medium, we have the following, solve: ov ag, WO)= ‘This is done below nea. Wl Tal= de2-DSolvel{¥" [t }==-9,¥1 Out 19} -@) +) ‘The Lunetion ve12 is then delined by extracting the appropriate Jormula trom the previous output. In ‘order to compare these results to those of the problem in which F=cv, we consider the following values: L239, Tap B= 32, and v,=48 ‘which were also used in Example 3.10. The velocity function ve2 for the problem involving no air Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations resistance is given below. ] ] daleth= ] ] _tfaan tt ,1,211 inital condition, y(0)=. Next, the position function pos2 is determined by using DSolve to solve the necessary initial value problem. Note that we are simply integrating the velocity function given in ve12 and applying the 2.9.70,¢L 2181-10), ialezi= | l 2 catty > EDs eos Oy outf22}~ ] The position fimotion posit ian? is then defined by extracting walea= position2[e_,o. -0_,t_Jepos2{ (11,211 Out 250 4 stroeyo ‘The position functions for the ease with FO and chat when Fy-ev are plotted below using the parameter values indicated earlier, Note that the lighter curve is that corresponding to F=cv. Differential Equations with Mathematica by Martha, LL, Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 85 positiona[1/121 7 -19 -2a ut eafe Graphics Note that these two curves differ in shape. We know that by looking at the formula for the position function in which air resistance is neglected, thatthe corresponding curve is a parabola, This is verified below, The result in noai.rv represents the t-value at which the object reaches its maximum height, and the result in noaizpos represents the [value a which the Object reaches the ground, Henee, eyual amounts of time (t= 1.5) are necessary for the object to achieve its maximum and then return t0 its waledl= Plot [ (position{1 /178,1/160,32,48,0.¢1 17166, 32 a), 1 ] Whe f= nosirv-FindZoot { ‘vel3[1/128,1/160,32,40 ,¢ j= autf25]= feo 1.5) talBéle= eadrpos-TindBoot | position [1/12 ,1/1¢ crea 46 1.5)1 22 ,48,0,¢} auil26]= (93) On the other hand, the result in ai:zv is not one half of the result in aixpos. Hence, this curve i ] l nota parabola. In fact, more time is required for the object co return to the ground (the horizontal axis) than to ‘move from its initial position to its maximum height, Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 86 Wnle7= siry-FindRoot[ reLocdty[1/128,1/160,92,48,t)) Gutf27= (=> 0.985572) - | Infé ] ] At A51 (rpos=PindBoot { ‘position[1/129,1/160,92,48,0,t}==6,(¢,3}] (> 2.92008) wnleel= 2 adrvE tt ,21) —airpesttt 21) coe | ‘We now combine several ofthe topics discussed in this section to solve the following problem. EXAMPLE 3.13 ‘An object of mass m= | is dropped from a height of 50 feet above the surface of a small pond. While the object isin the ar, the force due to air resistance is v. However, when the object is in the pond, it subjected to a buoyaney force equivalent to 6v. Determine how much time is required for the object to reach a depth of 25 feet in the pond. Solution: This problem must be broken into two parts: an initial value problem for the object above the pond, and an initial value problem for the object below the surface of the pond, The initial value problem above the pond’ surface is easily found to be av a WO However, to define the initial value problem to find the velocity ofthe object beneath the pond’s surface, the velocity of the object when it reaches the surface must be known. Hence, the velocity of the object above the surface must be determined by solving the initial value problem above. This is done below with Mathematica In order to find the velocity when the object hits the pond’s surface the position funetion of the object must be found by integrating the velocity function. This, too, is done below with DSolve. In di and pl, below, we obiain the velocity and position functions, respectively, for the object above the pond. Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 87 Lincs — ] | ull 53 ttt > 92 - By & ballon pi=gol Lor tep oul stf= cate) ls /= PLot [PILL ,1,211,(¢. ] 7 vel ‘a és a «| 2a] ri I ‘A more accurate value of the time at which the object hits the surface is found below withPindRoot. The velocity at this time 1 then determined by Subsutuuon into the velocity function. Lhis result 1s called v1 for convenience. Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 88 Dal Sim timenFindzoot Epi [11 ,1,21}==50,(¢.2.9)] ul 3é)~ tt => 2.47864) Mtsehe joa [ [1,1 ,2])/.t-otimel 14,211 atl 52} 29.2166 ‘afsai= edeptodvot(y'teyon92-6e Lt) vf leert) wLE1,t1 auto! cor > BA) nfsehe P2eDSoLve[(r"[e]eee20 121,21. -7101==09 TLL.) aut 38) 2.99721 | 16 (tt) =» 3.99721 + ‘This position function is then plotted to determine when the ol pond, This time appears to be near 4 seconds, Tab dofe= Phot (p2tl1,1,211,(b,0,5)1 . a de | ‘The initial value problem which determines the velocity of the object beneath the surface of the pond is solved below in 42 with DSolve. Then the Position function is found inp. FindRoot is used below with an initial guess of 4 10 oblain a more accurate approximation of the Differential Equations with Mathematica by Martha L Abell and James P. Braselton Chapter 3: Applications of First-Order Ordinary Differential Equations 89 ‘value at which the object is 25 feet beneath the pond’ surface. Finally, the time required for the object to react the pond’s surlace is added to the time needed for it to travel 25 tet beneath the surtace to see that approximately 6.41667 seconds are required for the object to travel from a height of 50 feet above the pond to a depth of 25 feet below the surlace., TalviP= tme-Pindoot [p21 [1,1,21]--25,(¢4)1 out 41pm tt => 3.99802) inl x2l-» tdmol [1.21 ]st4m02 (11,211 atl def 6.41667 Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 4: Higher Order Differential Equations Mathematica commands used in Chapter 4 include: Coefficient: Exponent. PlotRange ColumnForm GraphicsArray ReplaceAll ComplexExpand Integrate Roots ContourPlot LegendreP Short. Contours: Length ‘Show ContourShading Map Simplify D Matrixform Solve Det. Module sum DasplayFunction NDSolve Table Dsolve NIntegrate TableForm Evaluate part rig Expand Plot Variables $4.1 Preliminary Definitions and Notation Definition An ordinary differential equation of the form Lacy = anny ta coy ort) + 40090)= 109 is called an muh ore ordinary linsae-ifferculil equation. I 3) i demally the zero Faneton, dhe equation is said to be homogeneous: if f(x) is not the zero function, the equation is said 1 be nonhomogeneous; and if the functions a(x), 1=0, 1, 2, .. , mare constants, dhe equation iy said 1 have constant coefficients. Definition: Let (x), 109), OX), fy 8), nd 1, (x) bea set of n tunctions atleast n — | umes ditterenuable, Let = {0} (4).500) 00st, s(X)s4(4)} bea set oF n functions. 5 islinearly dependent Low every value of x in the interval L$ islinearly independent means that Sis not linearly dependent om an interval L means there are constants ¢, ee. ot all ero, 8 that)” cy for 90 Differential Equations with Mathematica by Martha L. Abell and James P. Braselton Chapter 4: Higher Order Differential Equations a1 QEXAMPLE 4.1 ‘Show that $ = (cos(2x) sin(2x),sin(x)eos(x)} 18 linearly dependent Solutio Sis linearly dependent since for every value of x, 0- cos(2x) + 1 -sin(2x)—2- sin(x)eos(x}= 0. Definition: Let $ = (£16), £00, £60... (0, £(4)} be a set of n functions for which each is differentiable atleast n~ 1 times. The Wronskian of S, denoted by WES) = WUC), (9), £6). -G), ED) is the determinant fx), £09) Ta eee ae Ite 7%) rc QEXAMPLE42 If = {sin(a).c0s(x)}, computeW(S). Solution: Jo 422800 | hangs) ea ‘ wesy-farGanco) teow)" fos) “sn i8*s) e064 ‘Theorem: Let £, (0),:00,6 (0), 100), £,08)} be a set of n functions each differentiable at least n— 1 times: onan interval IFW(S) #0 for at least one value of x in the interval I, $ is linearly independent. QEXAMPLE 43 ‘Show that $ = {e*,x e*,x'e" fis linearly independent Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations a xe" xe ke xe" x'e* He) be) fre’) EF akie (x #2x)e% (°) he) ove kX (e+ 2)e* (x 44x +2)e (x4De* (x? +2x)e* kx +2yer (x’ 4x +2)" [oxen #4x-+2)e* (+ 2)(x° + 2x)e™ J xe" [(x? + 4x +2)e* (0 #2 axtet[(x+2)0% (x4 De"] Since the Wronskian of $ is not zero, we conclude that S linearly independent il EXAMPLE 4.4 Determine whether each set is nearly independent or linear independent: (a) {1-2sin'¢x),c08(2x)} sand (b)[TegandreP [1, x] , LagandreP [2, x] , LagendraP[3,.e]} Solutio For (a) we frst define rowone to be the list {1 ~2sin“(x),cos(2x)} SSS Wronskion ial etdh= rowone={1-25in{x]2,Cos{2x1) uth eaf= ] (1 = 2 Sinfx]?, cost? x1) and then define zewewo (0 be the list {-4e0s(x)sin(x),-2sin(2x)} obtained by differentiating each element of rewane. matrix is then defined to be the 2.2 matrix (rewone, rowane} and displayed in traditional matrix formwith the commandMat-xixForm Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 93 dof aS lm rowtworD[rowone x] Outfd8]~ ] (4 Cos{x] Sinfx], -2 Sin[2 x1) tabeeehin matriz=(rovone,rowtwo) ; tatrizFore[eatriz] Butl t2febietrisform= 1-2 sinixy? — cosiz x1 x4 Costu] Sintxl -2 Sin{2 xt J {1-2sin*(x),cos(2x)} is linearly dependent, Val al= wronskian-let [estriz] Outf46}= 4 Cos{x] Cos{2 x) Sin{x} - 2 Sin[2 x] + 4 sintx]? sin(2 x] Unban Expand [wronskien,Trig->Trae] oul 48 a ‘The Wronskian of {1~2sin*(x),cos(2x)} is the determinant of matrix which is computed and simplified below, Since the Wronskian of {1-2sin*(x),cos(2x)} is zero, we can conclude that ‘The Legendre polynomial of order n, P,(9), is a solution of the second order differential equation (yet 2x Ye ninety =0 which satisfies [P,P (x)dx =0 ifn ¢ m. ‘The Mathematica command LegendreP [n, x] returns the Legendre polynomial of order on, For (b) , we define row[1] to be a table ofthe first three Legendre polynomials P(x), P.(x) ,and Ps (x), 3x21 ang Sx? respectively. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 94 ratte ature 0.20 | ull 50)= og aes, We then define row [2] 10 be the derivative of each term of row [1] and xow[3] be the derivative of each term of row[2]. Note that row[3] could also be obtained by computing the second derivative of each term of zow[1] InStfe row[2]=D[row{1],x] outs t/= i: sis xt / aye (1, 3x, oufs2}= (0, 3, 15 x i mat rix is then defined tobe the 3 «3 mattix with first row ow [1] , second row xow {2} and third row row[3] and displayed in matrix form with MatrixForm, Then the Wronskian of x Hol 5-38) is de determinant ofmatrix. 252 Tals mifrdzrteetrortt (2.9015 BatrisFore(eetrisy Out Spesrutrixforme ee [| x oe eee 4 seis? | 1 ox — | 0 3 ise J Since the determinant ofmat.xix isnot identically zero, we conclude thatthe set is linearly independent Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 95 EXAMPLE 45 In the following example, the command wzonskian is defined to compute the Wronskian of a list of functions inthe variable x, wronskian [List] computes the Wronskian of thelist List by 1. Defining the variables, x, and matrix local to the function wronskian; 2. Defining n to be the length of List. The length of List is the number of elements of List: 3. Defining x [1] to be List and then x[k] to be the derivative of x [k~1]. x [1] corresponds to the first row of the matrix whose determinant will be computed to yield the Wronskian ofList; © [k] corresponds to the kth row of the matrix; 4. Defining matrix (0 be a lable of the lists 711, x21... efn]:and ‘5. Computing and simplifying the determinant ofmat.xix, We then use wzensleian to show thatthe functions 1 — 2sin’(x) and cos(2x) are linearly dependent while the set of functions sin(x), cos(x), and sin(2x) are linearly independent as isthe get of functions sin (x), sin(2x),sin(2x), sin(4x), Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 96 ind? ronskian[(1-28in{x]“2,Cos[2z]}] Out 7x o tal tof wronskian[ (Sin[x],Cos[x],Sin[2x]}] Outl 75/= 9 Sinf2 x] tal File wronsrien{(Sin[x] ,Sin{2x1 ,Sia3z1 .Sint4z1}1 out 76f= 109 ~ 015 costa x} « 100 Coste x} - 25 S051 2) 45 conto xy - 2 S28{t0 8] ae 00% v1 Ene ‘One way w see that 189 — 315c0s(2x) + 18000s(4x) — 135€08(6%) 4 15oq9(8x)— 3808ON) js notthe zero {so graph it on a suitable interval. Alters 189 -315c0s(2x) + 180cos(4x) S20 moc the zero function. ll ively, since Se08108) has value 768 when x=%, itis funy + 15c0s(8x) Asset $ = (100, 149), Levee (4), 1,0} of m linearly independent non-trivial solutions of the nth order linear homogeneous equation A. CYM%CR) a, OOY! MD act (FMR) + 6%) = 0 called a fundamental set of solutfons of he equation. Observe that if ~{F, (4), is. fundamental set of solutions of (x). OOY’(X)-+0,08)Y09-+0 and fc Yacoy =a,coy" ota, coy is a set of n numbers, then f(x) =) e,f,(x)e,f(x) is also a solution of J°a,coy oy") =0. The following two theorems tell us that under reasonable conditions the nth order homogeneous equation. ALCR)y MR) +a, Gx)y™ Mx).tay()Y"(R) + a(x) = O has a fundamental set of n solutions, Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 7 ‘Theorem: 114 (9) is continuous on an open interval 1 1or1 =0, 1... 1, then the nth order linear homogeneous equation J a (xy"%x) = Uns a fundamental et of solutions on Theorem Any set of n+ solutions of the nth ofder linear homogeneous equation )” a, (x)y°(x) linearly dependent. QEXAMPLE 46 Show that $={e isa fundamental se of solutionsof the equation y"(x) + 6y’(x) + Sy(x)=0. Solution: islinearly independent since W(S) - | £7. | --e 4 se — se Sis neal independentsice W(S)—| 6°. Se —Se“ +0. yy Since Fs(e *)+orle ")45e* =25e* —30e* +5e =Oand (e*) +641 (e*)450°= 0° ~60" +50 ax ‘ax set of solutions of the equation yx) + 6y/(x) + Sy(x) = 0, we conclude that is a fundamental . $4.2 Solutions of Homogeneous Equations with Constant Coefficients 1f 5— {F,(9), isa fondamental set of solutions of the nth order Tinear homogencous equation Sane ¥ a(avy"'s) 0, nena general solution of te equation is (x {e,}} sa setof natbitay constants. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 98 CUEXAMPLE 4.7 ‘Show that y(X), ¢\¢* eos(4x) + ¢, €* sin (4x) 18a general solution of First, y’=0*(-0,cos(dy) + de,cos(d) — de,sin(4x) ~c, sinde)) and /” = e%-1Sc,c0s(4x) ~ 8e,cos(4x) + 8e,sin(4x) ~ 15e,sin(Ax)). ‘Computing and simplifying y’ + 2y’ + 1Ty yields zero Iti easy to verify that €* cos(4x) and e* sin(4x) are inearly independent and, consequently, ‘we eun conclude that y(x) is 2 general solution of y’ + 2y"-+ Ty =O. Inthe following, we use Mathematica to graph the solution for various values of ¢, and e; by first defining the general solution y asa function of ¢, and === ceneralsoution ——————t tal 18-8 ] cleertr) 2{(Ol_je2_) JeExpl-x} (ol Costax}eoz stn[4x]) Out{ 16) of Cos[4 x] + of sinfs x 0,4) (1,0) 2,1) (1-2) ‘Then, Map is used (0 compute the value of y[{eL,€2}] for each ek resulting Tist of functions is named tunes: walz0h-= funcsctiap[y,vals] outfz0}~ (S014 x], Soeld x) 2 costa x] + Sante er Fs . Finally the list of functions Eunes is graphed on the interval [-1,1]: Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 99 tal2eh-= Plot [Evaluate [tones } (x. eT 007. = oS EXAMPLE 48 ‘Show that (ay =c.* eos(2x) + c.e'sin(2x) isa general solution ory 2y'+ Sy =0; and (y= ce +e +e.x%e* isa general solution of y"~ 3y"+ 3y’—-y=0. Solution: For (a) we begin by clearing all prior definitions of y and then defining y. Note thate [2] and ¢{2] in the definition of y correspond to the constants ¢, and ¢,, respectively. SS Funes —="| talZ0h-= leerty] wbeth= eo[1 ]E=p[x]¢os[2x}+o[2]&xp[=]Sin[2x] ouifet)= 2 oft} Conta x] + F019) snl? x} @ a +y~2“y+Sy and name the result stepone: dae de ‘Then compute Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 100 ial e2h= ]] | Stepone=Diy, (2,2) 1-201 21657 aut2)> <3 PE oft) Cost2 x) + 4 2 cf2] Cost2 a1 - 4-2 oft) Sin(2 x) - 9B ofa] Sin[2 x) + 5 (a oft) costa x) + BF of2) sial2 x1) - 2 (EF oft] Cost? x} + 2 off] cost? x) ~ 20% ott) sunte x} + (9) sinla xD) and finally simplify stepone. Since the result is 0, we conclude that y is a general solution. inf2ih= 1 Sinpladytevepone1 | oul esf— j | ° | For (b) we proceed in a different manner. Ualeafo= 7 sole=(Exp[x1,x Exp(x],2°2 Exp(=1); J walestee j clear ty] sand then use Sum 10 defi Waheb= yfx_}=Suafols Iso8st 1411,(4,1,3)1 cy Bess Bs eat fo ] and finally compute and simplify y”—3y"+ 3y-y: Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 101 dnterh= a0 Fe]-3y"* e137" bx -yix] outf27= 3B ofa] +6 2 of3) +6 E x ol] + 3 CB oft} + BF of2) + B* x oft] + 2B x 013) + Fi? on -3 oft) + 2 BY 12) + Ex of2) + 22 ol) + 2 x ofa) + ef wl29he 0 belay" bear" (x -vtey/ssampaacy outlz6= a TT ARAM TT AR I The equation a.m" + a, .m’-! +..kam + a= Lasm* =Oiscalled the haracteristic equation of the nth vider huniogenevus fineat differential equation with constant coetTie‘ents ay%X) 1 ay MX) 1 1A) Fay) = The general solutions of the nth order homogeneous linear differential equation with constant coefficients, are determined by the solutions of its characteristic equation. Letay’” +b y’+cy=0 be a homogeneous second order equation with constant coefficients and Jet m, and m, be the solutions of the characteristic equation an + bm + ¢=0. i) lfm, #m, and both m, and m, are real. a general solution of ay+ by’+ cy =0is, y= ce"! +e,e""; (i) Im, =m, and both m, and m, are real, a general solution ot ay"+ by'+ ey. y(=ce"! +e,e "sand 0, and m.= m,.a general solution of ay’+ by’+ cy =0is e#Ltc0s(Bt) +e-¢% sin BO). In Git) above, iy is the complex conjugateof m,: my - & B= a+ ip. The following three examples illustrate each of the above situations Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 102 QIEXAMPLE 49 Solve y+ 3y"—4y O subject 10 y(W)= Land yO) =~ 1 Solution: The characteristic equation of y"+ 3y solutions ofthe characteristic equation arn m+4\(m~1)=0. Since the 1, the general solution of y" +3y”— dy =Disy(x) =c, e+ ce. Since ¥(x)="-4ee* + c.e%, applying the initia 2 5 s0 the desired solution is yx) = 2 e+ 3 QEXAMPLE 4.10 Solve y”+ 2y'+y=0. Oisme+2m-+ 1 = (m+ 1F=0. Since the 1 with multiplicity two, the general solution of eristic equation of ¥" + 2y"-+ solution ofthe characteristic equation is Y Fly Fy HOI Y=, +e KEN QEXAMPLE 4.11 Solve y’ + 4y'+ 20y=0. Solutic The characteristic equation of "+ 4y’ + 20y = 0 is mé + 4m +20 =0. Completing the scp in? +4m +20 =(m-+2)+ 16=0s0 the solutions of the chacteristic equation are m=—2+ 4i, thatthe quadratic formula can be used to solve n? 1 4m 1 20~0 as well Since the solutions of the characteristic equation are complex conjugates, the general solution of "+ 4y+20y =0iis yox) =E™%\COLAX) + CNX). More generally, let am" + asm? 4. am+ S.ajm! =0 be the characteristic equation ofthe nth order homogeneous linear differential equation with real constant coefficients AY") + ay MOPE.ct ay) + ay) = Lay) =0. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 103 Inthe same manner as inthe case fora second order homogeneous equation with eal constant coefficients.a general solution i also determined by the Solutions ofthe characteristic equation, Instead of stating an exact rule for the numerous situations encountered, we illustrate how a general solution is found in the following examples. QEXAMPLE 4.12 Solve dy” 12y" 2ly—2 yO Solution: Tmnthis ease the charaeteristc equation isu? ~ 12+ 21m - 26 subject to the inital eonditions y(0) =O, ¥(0)=—1, and ). Factoring yields the equation (a ~2) (4m 4m + 13)=0.and then applying the quadatie formula yields the three roots 1 Bion mee! $+3ior m 2 m=2orm Inthis case, each root has multiplicity one so a general solution of the equation is "e+ eM(e, c08 (V3x)+ 5 sin (4/3x))- yO ‘Tocalcutate the values of ,,¢2, and ¢,that satisfy the initial conditions, observe that ul at Fey yO)—¢, 4,-0.0) —2¢, + jet afhe,--1, and yO) —4e, ¢,+¢,= i ils te ayn of tre tions inde unkown |26, +E, #18 = The command DSolve can be used to solve nth order linear homogeneous differential equations with constant coefficients as long as nis smaller than 5. In cases when the roots ofthe characteristic equation are symbolically complicated, approximations of the roots ofthe characteristic equation can be computed with the command NRoots. MEXAMPLE 4.13 Find the solution of each problem: Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 104 (a) 3y'+2y'—Sy'=0; (b) 2y” + Sy'+ Sy = O subject tothe initial conditions y(0) =O and y(0) = 43 and Cy" +4y' +4y=0 subject othe initial conditions (0) =Oand y(0) =5. Solution: (ais solvedusingDsolve. = ConstantCoctficients dal 13h= / solutiom=asolve(y" (x Je2x" (x1-3y lx 1==0,3121,21 Out 13 Cate) > Gd + cams ‘When Dsolve is used to solve (b), the resulting solution is expressed as a complex exponential. To see ‘that_the solution 1s real, We use CompLes=xpand a ] (O}=—0,7°(]==1/2} yx} ,2] 2 (CS + T Sart{5)) ¥)/4)) > sere 151) i Notice that solution is @ nested list. solution [[1,1,2]] yields the second element of the first element of the first clement of solution. In other words, solution[[1,1,2]] yields the expression corresponding to the desired solution. ComplexExpand is used t expand solution [[1,1,2]] assuming that x is real, The result is clearly a real-valued function. ie Hl simp-colution{ [11,21] //Complexixpand ut 8f= | / 2 sin( EELS) 8) He OR seers) &° i Finally, the solution is graphed on the interval [-12 .} Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 105 -Braghions Similarly Dsolve successfully solves (c) Wnlesl= soLution-Dsoxvel (y** [x}e4y” [x}+4x[x}==0,71 7 [0}==-1/2) 712102] oufeai= The result is then graphed on the interval [-1, Plot [solution {[1, 1,211, (,-1,1}] would produce the ]. Note that the command ‘same result wlea= Plot [y[x] /. soletion,(x,-1,1)1 100% a 1 Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 106 As stated above, in cases when citherDSolve is slow or does not work, other techniques can frequently be used. EXAMPLE 4.14 Find the general solution offaly” 3y"42y'+ 6y ~ 0; and (b) y#)— Sy 30y2~ Soy) 40y — 0; ‘and (€) graph the solution of y+ 3y” + 2y’+ 6y =0 subject to the conditions yO) =0, ¥(0) = 1. and ¥"(0)==1 on the interval [-1,1] the characteristic equation for y+ 3y""+ 2y'+ 6y Solve to solve the equation, Note, however, hat either NROOES Or ROOES COUlA Also be used to solve the equation in this case. EEE ConstantCocfficients wall), Solvo[x73+2"2+2x46==0] elf 1] | Ca => 9), (eo 7 Sart in), (> -T Sert2D) is x°+3x? 42x + 6=0. In this case,we use Since the solutions ofthe characterise equation are~3 Vi, and, we cance that he general solution isy =oe°%+-e,cos(V71)-+e,8n6 70. ‘Similarly, the characteristic equation of y® —8y® + 30y® — S6y" + 49y =Ois x‘ 8x! +30x2 56x +49=0, The solutions are oblained with Solve: “ad tel= Solve[x~4-8x73+302-2-56r+49=00] Outf 12} toe SEMEL, gg ASAE, feat tial, gy, 2 E seetia}, By" + 3Uy* Soy" + 49y = Vis, (i) tof c09(15) +e, sin V5) In (a) we found that the a solution of "1 3y"1 2y/1 6y—Ois y= e* +e, c0s(-¥21) + e,sin(/20. Applying the conditions y(0)=0, ¥(0) = Merefore the — solution of and y"() Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 107 e4e,70 em of equations| ~3¢, +e, | 9,0, yields the sys ‘Therefore the solution to the problem is ¥ sraphed on the interval [~1.1] with thePLot function, ‘Asan alternative we useNDSolve {0 obtain a numerical solution of y"+ 3y"+ 2y'+ 6y =O subject to 0, ¥(O)= I,and ¥"(0)=—1 on the interval [-1.1 rele solution-NDSolve| (7 Ux ]99y" "Ex ]o2y" [x16 [x] rier *[Olank-y"*(Olm=A) -yExiCx.—1 097 Out tafe ] ((rbe) > Interpotetingrmotion((-i., 1), elt) and then we graph the result: case, the solution found in (a) could be used to oblain an exact solution to the equation, In 1, tive thal the 1esull UC NDSolve is a list, nained solution. Explicitly, the interpolating function can be obtained with the command solution [[1,1, 21]: deb téhe Th solution (1.1211 Outf tb ] Interpolatinghunctéont(-1., 1), 1b] ae 00% vie Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 108 $4.3 Nonhomogeneous Equations with Constant Coefficients: The Annihilator Method A particular solution, y,(x), of the differential equation f(x,y’ Cx),...¥" 00,9" O0)= 800) is aspecific function (which contains no arbitrary constants) that satisfies the equation. The general solution fo the nonhomogeneous equation gin) is yin aya, YOM) 4 tayix) kayled=) avr (x) +y,00, where y,(x) isthe general solution of the corresponding homogeneous equation AYMOH, y"MAt.tay@)HEYOO= )a,y(X) =0, and y,(9) isa particular solution to the nonhomogeneous equation. Recal that then th order derivative ofa function y is Dy = £¥, Thus, the linear nth order differential equation with constant coefficients }=2(x) can be expressed in YOO a. MODE.tay’ Ot AYO) = YP a.yC operator notation Ay) +a Ye Mark ctay’ (a) +ay(0) =aD'V(a) +4, D-yOx)t.taiDyta) +40) = (a,D° +a, D+. 49,D-+a,)yex 0X). The expression p(D) = aD" + a,,D™! +,.+aD + a is called an nth order differential operator. The differential operator p(D) is said to annihilate a function (x) if p(D\ACx)) = O forall x QEXAMPLE 4.15 Find a differential operator that annihilates (a) x; (b) xe; and (c) e'sin(x) and e* cos (x). Soluti ‘The differential operator D* annihilates x’sinee D'x’=0, Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 109 the differential operator (D +3) annihilates xe"* since (D43)¥x0™) = (D? + 6D+-9) (xe) = D*(xe™) + 6DIxe-3x}- H(xe™) 60+ 9xe™)+ 6(e* —3xe™) + 9xe = 05, the differential operator D’— 2D +2 annihilates both e sin(x) and e*cos(x) since (DP 2 + 2) (€* sin(x)) = Di" sin(x)) ~ 2D'sin(x)) + 2(€* sin) =2e* cos(x) ~ 2(¢ sin(x) +e cos(x)) + 2c sin(x) = Oand (DP-2D + 2y(€* cos(x)) = DXE*c0s(x)) ~2D(€ cos(x)) + 2(€* cos(x)) 2c! sin s(x) ~2(€* cos(x)—e* sin(x)) +2 cos(x) =0. Ml MEXAMPLE 4.16 ‘Show that (a) (D+3)° annibilates x'e™; (b) D—4D + 13 annihilates e* cos(3x); and (D+ 3XD?-4D + 13) annihilates x¥e™+ e* cos). Solution: ‘We begin by defining a function ann [q, £] which computes q(D){(x)) forthe differential operator q, ann is defined as follows: 1. The variablesvax, exp, c, val, and pare declared local to the functionann; 2. gis expanded and the result is named 3.The variable inp is named var; 4. exp is defined to be the deeree of p: 5. €[0] is defined to be the constant term ofp obtained by evaluating p when the value of the variable of pis 0: 6. For i greater than zero, e [4] is defined to be the coefficient ofexp in p; and 7.The value of 5° ei] t0nis ‘computed which corresponds to the value of q(D\f(x)). GS Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 110 £=====" OtherMethods(Annihilator) tal t= ennlg_fo1:= ‘Soduie {var .exp,o,vel.>), potepandials varsVartables(P; exp=Exponent [p,var((11115 ovwpep 7. vartit1i-20; of4_1:=oetticiontIy.ver 1111.41: val=sea(ofi] DIt,(x,4)1,(4,0,027)] 1 TalTih= onewenn[(d+9)3,x°2 Exp[-22]] Outf ti} sO Me ee 228 By Se- Gyo , ial 12) Simplify [one] ull 12h o Similarly ann and Simplify are used to compute then simplify (D? ~ 4D + 13)(cos(3x)) and (D +3)! (D? ~ 4D + 13) @x¥e** +e e0s3x)) Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 11 Wel tsh= two=enn{(472-44¢19) ,2xp{2x] Cos{9x]]//Simplity uf 13} | a aalta= Chroemenal (452979472413) x2 Bap L314 Exp (2x] Cos(ax]|//Siaplity eth taf= a TTT 00% > oS ia In general (i). The differential operator D” annibilates each of the functions 1, Gi) The differential operator (D -f) annihilates each of the functions &, xe... xe"; and iii) The differential operator [D? 20D + (ot + B°)/° annihilates each of the functions &* cos(Bx) xe cos(x) ...#"e cos( Bx) ,€% sin(Bx), xe sin(Bx),.. x" fe sin(Bx). Therefore, the homogeneous linear nth order differential equation with constant coefficients can be expressed as p(D)y = g(x). When g(x) isa function of one of the above forms, another differential operator (PD) which annihilates g(x) can he determined Suppose that the differential operator q(D) annihilates g(x). ‘Then applying q(D) to the nonhomogeneous equation yields q(D)p(D)y = (D)g(x) = 0. The form of the particular solution is found by solving the homogeneous equation q(D)p(D))y ~ 0. QEXAMPLE 4.17 Solve y’+2y"—3y = 4e' — sin (x) subject to the conditions y(0 Solution: In operator notation, the equation y” + 2y”—3 y = 4e*— sin (x) is the same as =Oand (0) (D+2D~3) y=de~sin (. Notice that by (i), (D ~ 1) annihilates 4c and by (ii), (D+ 1) annihilates sin (x). Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 12 Applying (D— 1) and (D? + 1) to the equation (D'+ 2D ~3)y = 4e* —sin(x) yields (D - 1XD? + 1) (D+ 2D ~ 3) y=(D~ 1(D + 1) Ges—sin (x) =0. ‘The auxiliary equation of (D-ANDE + 1D*+ 2D—3) yay" + y= Ay) + 4y SY 43y ism + m'—4n? +4 Sm-43=(n— jon +1) (nF +2m—3) =(m~ 1yan'+ Nm +3)=0 ‘which has roots m= 1 (with multiplicity two), m=+i, and m =. First observe that y, = cye* + ee isa general solution of the corresponding, homogeneous equation y"+2y'~ 3y = Oand yoo= eral solution oF Hee + CXC +E, COMRI+C, Sil) 514 yl)dy9) 4 4y”~ Sy’ 3y = 0. Therefore a particular solution of y+ 2y/— Ay =e sin (2) ca he found of the form y, =6,x0¥ 40,008 (x) + sin (x). Since y,/ =e9x e+ ee" —c, in (x) +6, c08 (x) and yp" e,xe' 420.6 — e008 (x) —e,sin (x),we obtain (exe! + 2e,0%¢, 008 (8) = in (x)) + exe +e, 0c, sin (x) + €; 008 (x) 2(e.x e 1 e,c08 (x) 1 6, sin (x)= et sin (x), Simplifying yields the equation doe + eye) cos(x) + (2c, ey) sin(x) = 4e* —sin(x) and equating coefficients dey yields the system | 2¢, —4e, -2e\ 40, esi + £08 NS ag end atan fy" 297 Y= nano) ccos(x) | sin(x) 0 5 isvinie cet +ee*+xet + Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 113 1 6 since w= 1 +e +¢,=0and yior= $ +6)~3e we Ors AL and tus the desired 0 ge 4 S080) , 8iN(8) 40 102 2309 solution is yon=—= EXAMPLE 4.18 Solve yx) —y"(x) ~ Ty) + ISy(X) = Ce + 6% cORAX), Solution: In this case, we first use Dgolve to compute the general solution of the equation and name the result, gensol. = the mena) —=or| wl2ol= gensol=Déolvely"** [x]az"* [x]-7y" [x]+157[x]—= 32 EEDL-Sel+Eap [2a] Cst3], auf 20}= (oti 9 2 SH “He our * wey eee * x SE * cosi3 x) #7 ¥ oa) coste) - SEY Gos19 4) - 2x 22 * ray singe - 222% 3ini9 2, Alternatively, we use Mathematica to help construct solution via the annihitator method. In operator notation, the equation y"(x)' — y"(x) — Ty(x) + 1Sy(x) = x'e% + e*cos(3x) can be ‘written as (DD? 7D + 15) y(x) =e + e%cos(3x), Since (D+ 3) annihilates ve and D? —4D + 13 annihilates e cos(3x), applying (D + 3)' and D?—4D + 13 10 the equation yields (D+3)(D‘— 4D + 13(D'~ D!-7D + 15)y(x)=0. ‘The corresponding homogeneous equation of ¥“(x) —y“x) — Ty'C0) + 15y00 = xe + e*C08(3x) isy"() ~ y"() —7y(x) + 15y(x) =O which has auxiliary equation & —d2—74-+ 15 =0. Inthis case, root is used to find the solutions of cP — 7d-+ 15 = Oand the auxiliary equation of (D+3)(D* 4D +13)D'~ D*- 7D + 15)y(x) = 04+ 3NP- 4d + 13)@- T+ 15) Note, however, that Solve could be used just as easily Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 14 ial 22): Roots [473-4°2-74415==0,4] outl22}= da -B idee 2-T idee 2er wntesfn Roots { (d+) “9(d“2-4d+13)(d-9-d-2-74415)==0,4] outf28)— a 1 “3 Ta \ Therefore a general solution ofthe equation is of the form yace™ +e (e, cos(x)+e,sin(x)) + care e,x7e" +0,x°e" +e%c, (cos(3x) +6, 8in\(3X)), where y, is a particular solution of YX) — y"(x) — Ty) + ISyG) = fe + e034) and, is the general solution of the corresponding homogeneous equation y“(x) — yx) — Ty'(x) + I5y(x) = 0. We proceed by first clearing all prior definitions ofy, yh, ¢, fans and es and then defining yh: Ules]= Clear ty.7h,37 rhfx_)-<1 jx Baptte col 1 Jeneleleot91siate1) Outfé3]= 4H +88 * (ol2} Costu + 0f3] sintx1) Instead of directly typing and entering the definition of yp, we first define a list of the functions that appear in yp and name the result funs, then ereate a able of values of ¢ [4] for4 0, ButhSéfm l Gx) y2tx} + pl) y2' bel +2" Tel > O) Let u(x) and u,(x) be two functions, if they exis, so that (x) = y,(ou,(x) + y,Cous) isa particular solution of y"(x) + ptxdy/(x) + q(x)y(x) = fexy'and yiuy’+y We define yp and ruletwo below: tab 5O= yolx_lev! Ex} [x}o72[e e212] oul 56 v1] ytfe) + txt vate) Taf eh-= ruletwo=(ri[z] wi*[x]+y2{x] x2" [x]->0) oui 50). (att) tbe] # 2h) wf) > 0) The derivative of yp [x1 is computed below: “taf 0f= Dixpix}.x1 20tf 50} vif) ul’ fx] + yQEx} wa tx) + wt fe) ytd + eax] yb Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 118 xuletwo is applied to the derivative of yp] and the result is named fist. malt: first-Diyp[x} x] /. ratetwo autl1f= etd YE De) + see) 92" Therefore, yy(3)'= y/()u(x) + ys()u,(a). y,"(8) is computed be the derivative of fi.xst and the result is named second: inleel= ‘seoont=D[one,x] Butt Phe Sd Ded a Ca) ¢ 0! fe) Ua + HER) Whe) + ix} 72°" ts] Then y,’(x) + p(X)y,(X) + 4(%)y,(8) is computed and expanded bel is named stepone. Wale stepone-secondsp[x] firstegtzlyp[x]//Expend out esfm atx) vif) yilx) + abel w2tx) yale) + Pie] Sife] yt bey sated eto te) + Bled uate] y2'bel 4 02" bed 2‘ Ee] + Sibert tad + eaixd 22) The terms containing u(x) and u(x) in stepone are then coll 6 - steptwomcollect [stepone, (ui [x],02121)] Outl8th~ te) vital + 92 tad 32° bed + voll) Cal] Ate) + pix) atx] # yh" be) + ste) Gl) 2K) + pba x2" Ux] + 2°12) And finally rule is applied to steptwo and the result is named wal651-= stepthree=steptwo /. rule auf 65}= Sted tbe 6 2" be 92 ow. The result Differential Equations with Mathematica by Martha L. Abell and James P, Braselton Chapter 4: Higher Order Differential Equations 119 Thus ,"+ (3) + pOx)y,()+ ay, (8) = yr COuy’(x) + yx COs) = Hla), Since y,Cx)u,/(x) + y,/(3)0, 0x ‘Cth, ()+Y-C0H," 00) o.wecnave Be nsenf yu,” (%) + y,00uy) for u, (x) and uy (x): oj 3m yf) BO Be) 9 Cow OF Ry 6)-9/ 9 stows ara) f = 0008) HOW )-¥ OO) i yf), : i w(x) Fy. (x)= y," Cy day the general solution of y“(x)+p(ady (x) +g(a)¥O0=M0) Isy(x) = (0) = yal) + OOMCD¢Y:O0)UC9) =¥, 000) yf) sdystad ey (0) | S22) _ ag yoy f 200) oeanven 7-9 cor Saat yew More generally, if we are given the nonhomogeneous equation ax 9) +00) ONE) at lady) + afIL8) = JAA LOYCR) = 800) and a fundamental set of solutions y\(x).y.(X),..u9,(X) of the associated homogeneous equation YC) +a, OD OMA) Hach Aly + Alay =P'a, (yx) = 06 then we can extend the above to find u(x),Us00)ynst(¥) such that y,(x) )° uy, Oxy, (xis a particular solution of the nonhomogeneous equation. UY u//Coy,(x)=0, then y,G)= Yu, (x)y.%Cx) for m=0,1,2,...48 1 and if Ye GoyPG)=0 for m=1,2,..50 fythen x)= Yu, Coy,0)+ Yu, Coy," 0. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 120 ( Yy.@)u,@)=0 Thetfore wecbiinihe ysemotnewpaions] LY 0)0/()=0 stich sing Camersae Yxe"oyu/ =e) can be solved for u(x) am Let W.(93.Y.0) -2- 30), (wm ~» -2+3T)) Since the solutions of the characteristic equation are ~ 2 ~3i and ~2-+3i,a fundamental set of solutions of Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 122 y"+4y+ 13y =0is {e% cos(3x).e™ sin(3x)}. Therefore, we define f(x) = x eos (3x), yi(x) =€* cos(3x), and y,(x) =€ sin(3x): dol Shem ] ! felon Coste] 2 Outl5]= [ fap | Tile Iotert-Qx leon and j-Expl-25. yi(x) ly.'(x) lor ] wronsesan-beti (HEL aU) PLT aay ssmnaser e033), we first andwronksian= oe rT) yy wronskian and then define (x)= [ ua pxamedx Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 123 Wel toh= jnTntegratefutprine,x] eutl 10} BF casinos, a8? * (4s 65 x) coe(9 x) | Pt eraen sage, 2* eww sia Siwilaly, we define u2peime=—Ysl)1x) _ wronskian Cia ‘uaprinesyi [x] £[x]/vronskien ut 1 iJ 2x 2 os coslo ) Out 12} BF san anien, 2 77 + 170 x) cosa x], oe? * (4s 19») sintd x] oe 28? * (4s 05 ) sini ¥ 500 ‘Then a particular solution of y"+ 4y'+ I3y =x cos'(3x)is given by YC) = YARD + YSERNLOO Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations Dft3P J yolx_l-yi {x} of(x}or2{x] w2tx] i oat 3p ge sina ey EG + 26.0 costs el EB 7s 1709 cos x) , a8 cas 19n san, sE caren ane, ae, 2 caste cal, (Costs x1 38? * (4s 65 x) Cosl9 x] a 1 PX smn say, aH 2% or een sia uy ) 2 + I3y ‘and the general solution of y+ TFs ee | Si , otto | ae aaen | ccos"(3x) is given by yO so the general solution of y+ 4y’+ 13y ¥.00+9,000 Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 125 di tl= ix_lerplx}+r0(2) Outt 16)~ [1] Gos]9 x) , of2) sin{3 x) , e e ea 2 (77 + 170 x) Cost x) ee ocr i9y sa, 387 * (4+ 85 x) Sinld x Pca iy ose, by ey (Cos[3 x) ¢ 38? * (4 + 85 x) Cos[9 x} _ PX pean say BX ons yw tan, , ox of functions tograph: ‘al th y_Jerplx]+r0[x] Out t6f= ett) conl9 x}, of) sin{2 9), eins xy CLUE2 Bop Contd 1, 2X een coed, a2 cas ign sain, ae cogs) sins my, 2x, company CECA 198) Gls, 28 cae es») costes] BE G4 269) sists a] Bons 190% tial why, 2 and then graph the table tograph on the interval | 1,1] In order to graph various solutions corresponding to different values of q and . We first create a table Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 126 eT 00% wo oes EXAMPLE 4.21 Solve y—4y Solutio Proceeding as inthe previous example, the characteristic equation of the associated homogeneous equation of y"~ 4 —4= 0 which we solve for m: [=== Voriation0 Parameters wleh= Sheer fyiy2.z0 70,01 22] Solve [e“d24=r0f Outl2 An => 2), (o> -2)) “Then a fundamental set of solutions of y yi@)-e* and y,)-e" Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 127 aish= E £a_I=Exp [4x] /2°9 F euttap= L, i : a | Mal Shee l Ye leneptesy; : teeta: : sits) andwronksian | 8) yr) ‘ilil= wronskieneDet((7tfz1.1212)) ahaa on antsl= a ‘To finda panticular solution of y ‘we first define x)F(x) wronskian tal ulprines-y2[x] £{x]/eronskien out f= 1 and then define u(x) = | 81. prime dx = ‘The function Exprntegral=i appearing in the resulting output represents thesecond exponential integral function, BC) =f ot Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 128 inl Sh= wiprine=yi[z] £[z]/vroackien DutlQhu ae ane deine wa Oot) yy Jo2peime ox f afl» | (x_]=Integratefulprise,x} | onal | ve | TEBE? | pteymeganis « E rr ki: Inthe same manmeras above we definew prime =—20°)#() _ «and the general solution of y"— 4y = Dis vx) =¢, y(a) + ey. wronskian wal lah ‘u2[x_|=Tategrate(uzprine,x] Outf 10} ee i yp(A)= yrCaduy (A) + ysCDUSC0) Valid yelx_J=r1[x] of (x]or2ix] w(x] auf 11} 1EiI-€ €]) Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 129 ‘al 2h yolx_}mol1] Bxp[-2x}+ol2] Exp(2x) vin Ss ora ll ‘Therefore the general solution of y’~ 4) walt rix_l-relz}ero(x1 Out 13) SP totes eu ca egg-6 ey . ee me 22 7* _ eeptategntss-2 2] anaes) ane ‘These solutions are graphed by ereating a table of functions tograph corresponding to the function ‘v(x) where ¢, and c, are replaced by various constants, ‘al20= fograpterentety ta] /- (oft}-24,0121-93), (aa ayaa araattns short togrenn, 3} ul 201¢Stort= Apart t a ett ‘The set of functions tagraph is then graphed on the interval [0.01.1 Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 130 dafezh Plot [Evaluate [tograph] ,(x,.01,1), Plotkange->(=15,195 ] EXAMPLE 4.22 Solve y+ 8y""#16y = Solution: Proceeding asin the previous two examples, the associated homogeneous equation of yore ay"+ toy = SNC) e+ ay" Loy =0 which has eharacenstie equation in¥+ Sn? + 16.=0 solved below: === verti rooms —= balan Clear {y,x£,70,7p 41,02] Sotvelz*edr~atio=d) oul 42}= (#220, @ > 20, (920, w- 2i) Since the solutions -2i and 2i have multiplicity two, a fundamental set of solutions of y+ By"H16y = 0 is [cos(2x), sin(2x), x Coss), x'sin(2x)]. Each of these functions is ‘defined below as yE 1], y£[2]. y£ [3], and y£[4], respectively. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 131 Let up(L], up(2].up[3]. and wp[4] denote u (u's us‘, amd uy respectively, where yO) = yE TL] urty£ [2] ust y£ [3] uty [4] uy, isa particular solution of ¥ + 8y"+16y =SI02%) Then, by the method of variation of parameters we obtain the system of equations{y £111°up[i] + y £(2)%upl2} + y£13]%upl3) +y £14)%uptdl = 01-5 defined below using the Tae commnd he resulting system of equations is munedequat-Lons: nae equations ‘rable [Sua D{y#{4}{x1,(2,3)1 ott, hy PadTs0,85 50,297 uf 53}= (Gos(2 x) up(t) + Sin(a x] up(2) + % Cos[2 x} wp[3} + x Sinf? x) upl4] == 0, -a'singa x} spit] » 2 co=(2 2] pie) + (Costa x] = 2x Sinf2 x}) WIS] (2x Cos[2 x) + Sin[2 x}) wpld] == 0, Gos 23] wplt] = 4 Séal2 x] vpl2] + (A x costa x} ~ 4 sin[2 x]) vpl3] + (cori? mi} — 4x Sint? 1) wptad = 9) Inaddition, we obtain the equation y£[1]*upl1] + y £[2]*upl2] + y£[3]“upl3] + y £14) up la] =20), 2%) defined below as equationd, where go) = SA Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations nlSif = ole_}-Sin[ax}/= outonf= nlS5h= een tone sem met NET 2) TS out 55f= 8 San(2 x) wp{t] - 8 Cos{2 x1 vpl2i + (C12 Costa x1 + 8 x Sinl2 x)) wl] + (8 x Costa x]'~ 12 Sin(2 x]) wpl4] sin(a we use AppendTo lo concatenate equation4 to the equations: tal sih= appendto [equations equation} Dull 56 (Gos|2 x] wplt) + Sin{2 x] vpl2] + x cos{2 x) vpl3] + x S4n[2 x] upl4] == 0, o2'sin(2 x] weil] #2 con[2 x] api] * (eoel2 x] "2 x San[2 x1) opts] + (2x Cos[2 x] + Sin[2 x}) wplé] = 6, 4 Gos|2 x) vpit] ~ 4 Sin{2 x) wpl2] + (4 x Costa x} ~ 4 sin{2 x}) wi] + (i cox(2 x} = x inf?) pla] = 0, 8 Sin{a x} vpti} ~ 8 Cos(2 x] vpl2] + ($12 coz [2x] + 8 x Sia(2 x]) wp19] + (CB x cospa ay - 12 Sial2 x1) wld ‘Since we must solve the system of equationsequatiens define alist ofthe variables and name the resultsups: Inorder wo solve the system of equations determined by the equat 1s nequat.ions and equation4, end of equations and name the result for up{1], up(2], up[3]. and up[ 4], we Lata (opt), weI21, op19), vets) and then we solve the system of equations equations result, and name the resulting outputuprimetable: for the variables in the list ups, simplify the Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 133 WnlSBh-= ‘uprinetable=Solve [equations ,eps]//Siaplify outa} (opti) -> got + SSI , Saf a) ] cota = f= S831, Sige), wil ~ salts), w(t) » S221), ‘To compute ty Us table utable: and u, we integrate each expression in uprimetable and name the resulting inlol= Lagan, Outf60}iiTebleForm= oglt x] , Cortmeegranta wt _ Leghe) wot wes slat 222 te one) SEBEL cog, SSBB | ap ‘The funetions Costntegral and SinTnzegza! in the resulting output present the cosine integral function, sie =[ £10. moss We Differential Equations with Mathematica by Martha L., use the results to define ¥4(x) to be a particular solution of y+ 8y" Il6y = Cia [SF 0800 gy y+ Ln(a) + +f See and the sine integral function sin(2x) x Abell and James P, Braselton Chapter 4: Higher Order Differential Equations 134 WWl8S/-= utes} costa x) 2 Legh Costategren[4 x] _ Loglx y + x (CL) + x 613] Cos13 Lote] — utf2)= | l x €(2] Sin{3 Logis}1) / °)) ous three examples. We begin by definingLhs (o correspond to the ‘Oxy Ms y" + S8y =O. left hand side ofthe equation (xietax To compute the auxiliary equation of xy" Oxy" 44xy'+ S8y = 0 we then define y(x)= x°, evaluate Lhe, and factor the result and name it seepone: Welle yi dere; is Outf6/= Soe dee Mo ta mae (tem Ctem at tal he stepone=Factor [1hs] outl}= Gsm rans 2," 2! ‘The auxiliary equation of xy” + 9x'y+ 44x y+ S8y (2+ (29 -+4m-+ nF) =0, We first Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 138 extract the left-hand side of the auxiliary equation and nami ‘al to} suneq-Take[etepone,2] Out 10)= Gsm seams oy and then solve the auxiliary equation: the resultauxeq with the Take command: Veh tah rootseSolvefeureq==0] oul te) (@ > 2), @9 2-50, @> 2450) IE | Since the solutions of the auxiliary equation are —2 X'v"4 Ox'y"+ deny’ + S8y = below: is yOx) = ex? + x Xe-costSLn 2- Val TSI cleer(y] yix T=0I1] =*(-2)¢x*(-29(0121Cos15 Loglx11+ ‘ols}sin(S Logiz11) Gi played in an abbreviated three-Hine form: ‘We then graph the general solutions for various values of ¢, tal 26/-« tographetentetri] /. (oft1-r4 0171-95, Short [tograph,3] oul 26feéSert= ot 4 Sinf8 Logte)) cf = 4 aIS toate A, A oslS Logix}] + cct>y 4 oay,, ope Seesis eg se, . cet, Sys ato, Sy» LORE ote and then graphing the resulting table on the interval [25,3] Differential Equations with Mathematica by Marth aL, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 139 Tn some eases the method of variation of parameters can be used to salve nonhomogeneous Canchy-Fuler equations, EXAMPLE 4.27 Solvex'y”- xy’ +5: Solu ‘We begin by using DSolve (0 find a fundamental set of solutions for the associated homogeneous. Clear[x,y,71,72,£1 talSl= LI solhow=iSolve[=°2 y°*[x]-x ¥°[x}+9y[x]==0,7121 2] | 1 ttn toa ~ ct at teen» i ‘Then a fundamental set of solutions for xy” —x y’ +5 proceed by defining tx) =. x Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 140 ‘tal fOh= ftx_}tle oul tof= and then defining yi(x) = x cos(2Ln(x)) and ys(x) = yx) y200)| Ii) yo" (XY) wronskian: 2x: wél= Tiler Coetatoatx}1 FrongBienbot (Gila L z2iz)), Gt baa tem ivsim outf}= ax yif(x) and wp: : wronskian ‘To find a particular solution, we begin by definingwtp = initeh= p=-y2 [x] [x] /eronskian crix] flz]/eronckion Out tf asin? Logie uit tf esl? Logls: ~yaflx) sade dctaingwa)= ftp = [2H a u,(x)= [u2p dx = (—2f@)__ 4, wronskian Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 141 etl 15f= cos{2 Logix] ] ‘Then a particular solution of xy Dis yo iGO) + y,Cu,(), the general YX) + exy.(x), and the general solution of 7 1 xy’ +5y =L isy,(9 solutionol x'y”—xy' +5; xy'-ay +4y= 1 ao Tian yefx_J=y1 [x10 [x]oy2[x]e2[x] Poona taleolahat) (x) +y,(1), all defined and computed below: ul 16} x oft] Cos[2 Logtx]] + x of] Sin[2 Logtx]} Dutt 12h 2 oft} conta Logteyy + 22222 ote, 2 x o(2] Sin[? togix)) + % Sal? teatel We then graph the general solution for various values of q and e; by first creating a table of functions ‘tograph and then graphing the result on the interval [.0 Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 142 inl th tooranbotante(yiz1 J; (elt1->4,0121-93), 20 I 100% ¥ el Pe $4.6 Ordinary Differential Equations with Nonconstant Coefficients: Exact Second-Order, Autonomous, and Equidimensional Equations The second-order differential equation F(x, y, ¥, y”) = 0 is an exact second-order differential equation means that hero finetiond such that Fisthe ital differential of IFFCx. y, ¥. y’)=Oisexaet, then any constant, isa solution of Fix, y, ¥, ¥")= IEF(x, ¥. sy“) =Oisan exact second-order differential equation ancl is such that Fis the total diffirential of Fax yy fx, ¥. YOY” + BC, ys ¥) where xsyry)= 2b and atx, y, y= 24 4 28 Fis yy)= Sr andate wy)= SP Soy 24 Letp=y’. Then, substituting into the above yields f(x, y and g(x, yp) = 5 Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 143 Differentiating with respect to x, y, and p and eliminatingo yields the system of equations {fa t2phy +P, = 25 +Pe fy + Dlyy #2f, ~ 8. Conversely, i x,y, YIY+ 8%, Ys ¥)=0is +2 ly +My, = Lap + Php «differential equation that satisfies the system 4" * fer *D Tn 5 8 * PB Buy + Plyy +2f, ~ Bhp 1, WY IY" + 94, ¥¥) =O Is exact, In such a case, we can determined via ay (4, ¥, P) =H(x, y) +] f(x, ¥, pldp, where p. as above. QEXAMPLE 4.28 Solve x (y’P +yy’ +xyy”=0. Solutior ‘To see that the equation is an exact equation, begin by letting p = y, f (x. ys p) = xy, and 204% P= AP + yp. They ¥9/— AQ + ayy” =O Thay ys DY” + Blo yD) — 0 and we must show that fy + 2pfy + Ply = Lap + PLyp—g, and fyy + Phy + 2i, =g,_. Computing, f= 0.f,= 1h fa + 2phy + PF f jap ti yy" AGP ERY Leto.(%, y, p)= hx, y) +IfOs, pp = h(x, y) + xyp. The equation a6 a = 2(%, yp) where g(x,y, p)=xp? + ypis satisfied 28 eiiay) yp +h ayn x ix, y)= C.C any constant Therefore, 9x, ¥. p)= 00%, ¥. ¥) = C+ ayy’ and xyy’ = ¢1.6 any constant, is asolution to xG/)2 1 yy’ | ayy" 0. To compute y, we note thatthe equation xy y=c is separable. Rewriting gives the equation 2, 2 the general solution of xy) + yy’ +x yy" -dx and integrating yields = ¢,Ln (x) + ¢,¢, and ¢, arbitrary constants. Therefore, [La(x) + ¢ Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 144 EXAMPLE 4.29 Solve seo(xyam(xyy y¥ + sectx)(y'¥ +8ee0)y Solutior ‘We show that the equation see(x)tan(x)y y' + seo(x)(y’)? + sec(x)y y”=0 is exact by defining All of the necessary derivatives are then computed below as are the left- and right-hand sides of the equations which must be satisfied in onder that the equation bo exact. Since the corresponding components are equivalent, this equation is exact. Wh f= fue=DIftx.y.p] (2.201: Seal; see LF aH Sr PLz Pls FDL? reels Pd crplzad or=Digte,7 P1715 Spp=igte F epi AP.2ds (fxxeap taysp72 £71 ,gxp+p 91P-a1) (expep erp? topo} uf aef= (x Sectx]? + 2 p Seolx) Tan{x] + x Sectx) Tentx]?, y Swolx]? +2 p Sola] Teale] + 7 Sso(x) Taal] auth ss= ] (2 sectx}, 2 Sects) ‘The formula used to determine the solution is defined below and appropriate derivatives determined, Note that quantities hi" (x,y) and n°” (x, y) below represent the derivative of h with respect to x and y, respectively. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations delazh= Clear [phi .h} phich[x.y{eintegrate(t(x,x,p].21 prem niegereete ans==a1=,7 PI out ]~ ale, 1+ py Seolx) Out d6]= Dy Sec{x) Tanfx] + Cp Sete) + aM fx, yy ea Ee, 1 Dut S2fu Py Seolx} Tanfx] + vom seotey MOD, 3) EDGE, yy oe p* seote] + py Seolx) Tent) Comparing the last two lines of output, we have: 1» Seotzteelt) oft] + py Seole) ] | T DSolve[phi [x,y[x).° [x1}==0,212],2] Deif 5a) (nlx) > Sqret2 Cit) ~ 2 oft] singel, (yix] > “Sort (2 c(t] ~ 2 oft) sinix) fy) A differential equation of the form Fly", y°™, differential equation, Given the nth order autonomous differential equation Fy” , u(y) ~ y'G) yields a differential equation of tower vider. Therefore, we can use Solve (o obtain the solution as indicated below. Y..y)=is called an autonomous + YY) =0, the substitution We illustrate the solution of autonomous equations inthe following examples. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton 145 Chapter 4: Higher Order Differential Equations 146 CUEXAMPLE 4.30 uly) an sbstiingno te ogaton se obtain the equation u(y) we 5(u(y))? -4uly) = 0. Since this equation is separable, we obtain 5 oe : 5,0 |e FagyTdu— dy and integrating both sides ofthe equation results inlA ]=y-+e, where cis a constant, Solving this equation for u yields gy dy __ ce “Ge We obtain the separable equation SY = <3C—— and hence ox” Sy 25 Sae dy = dx, Integrating both sides of this equation results in where dis constant, Ml MEXAMPLE 431 Proceeding as in the previous example. we note that the equation is autonomous since x does not explicitly occur in the equation and let u(y) = yx). In onder to compute v(x), we begin by defining dy{11=uly fx land dy [21=Dfulyfx11.x1 /. y'Txl->utylxd]. We then define dy fal recursively t0 be D[y[n-1],x] /. y’[x]->uly[x]]. The definition is of the form dyfa_]:=dyfa]=...so hat Mathematica rememhers the values of Ay fn} computed. Note that yn] comesponds to the value of ¥°%x) using the substitution u(y) = y(x), We then compute a table, ys, of @y (1). dy 2) . and dy [3] and display dys in ColumnForm Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 147 SSS futons rele step ths} fain x(x Dx] f° x Srbadsartedvia tnt a1 atrix) nel the ayeetandel (Diy [x], (2,0)] 4710) .(2,1,3)15 ColvanFors [dys] out 16) aye, siya) Glog, std) © pean, 3) 2 gx), sii wot + obi eye 1 We then define rule to replace Diy [x], (,n}]=y"x) by dy[n]. Since dy{n] is defined recursively ubove, dy [fa] can only be evaluated when dy [a] is a specil Consequently, the command RuleDelayed, represented by :>, is used in the definition of rule so ‘that dy [n] is only evaluated when raze Is applied to an expression, fT J ude=(D[y1x] (2.0.91: 24710)) out 17 1 ty x12 ayia For example, in the following command we define step to be ys). Tal T8F: 7] sbepeD Er ba) 2,991 | otf 18 = ] yr tal 8h= step J. rule Outl 19]= ] styteld otter? + ofyteny® o tye Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 148 dy. ‘ax 0 we dk ¢ Abs w correspond w the left-hand side of To soive the equation S—(sy—5) & the equation a 5)S2=0and then apply nile 10 Uns and name the resulting output stepone alP7h Uasey"" [1 Grlz-5) Eo] outeti= 263 +9 rl) yx +O) ull 25) cOntybe) OS + 3 vba) + styled) wert) ] ] ] | For convenience, we then replace each ovcurrence of y [x2] in stepone by y and name the resulting output steptwo. ‘ooh ] steptwonstepone /. 11x17 outee}— ] GS +97) wD + vty) wT ‘Therefore, we must solve the equation u 44 — (3y—5)u=0 foru, We may proceed by recognizing that ay wt ay both sides ofthe equation. Instead, we useDSolve o solve the equation and name the resulting output stepthree. The solution, ~Sy +2" +6, .isextracted fromatepthzee with the command stepthree[[1,1,21]. (3y-5)u=0 is separable, rewriting the equation in the form du — Gy — 5) dy, and integrating (tr 816 3 ecu) Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 149 Sine fy) — 92-59 + 3 sepa nl lt i bay nena sides of the equation ——9¥.— = dx, In the following command, we compute f wy Eve, yo and name the result stepfour, TAS stepfourntntegrate[1/stepthrs out'Stf= Seay 2 arctant, x + C12] = 0. To graph the solution, we begin by defining duan-| 3 . VSCUI=25) , ..c12]=stepfour ~ x + C12). Joctiy=25 Wlsth= eee ci I uf S2h= iE ‘We will replace C[1] and C[2] by various numbers defined below inpaizs, Then, graphs of echt] 25 echt -25 x+C[2]=0. To graph the solution, we begin by defining ~x+C[2| forparticular values of C{1] and C[2] corresponding to the level curves Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 150, of sol corresponding to 0 for particular values of C[1] and C[2|, We then define g[4} to be the contour graph o! so on the rectangle [=/:/}x|-/./] when C [1] 18 replaced by the tirst member ofthe ith ordered pair of paixs and C[2| is replaced by the second member of the ith ordered pair of pairs. The option Contours->{0} specifies that the only contour graphed correspond to the graph Of sol. =0, the optionContourShading->False specifies that the resulting space between contours is not to be shaded, and the option DisplayFunction->Identity specifies that the resulting ‘graphics object is not displayed. Finally, we create a table of nine graphs, geaphs, corresponding 1 the graph of sol for each of the nine members of pairs. S{4_]:=ContourMict[co2 7. te wataits Th of graphs graphs is then displayed simultaneously below. ‘nfs Sow NoplayFunction-»4DisplayPanction] ltl ut s2)= wowapnios— 100% vee Differential Equations with Mathematica by Martha L, Abell and James P. Braselton ] Chapter 4: Higher Order Differential Equations 151 An equation in which all the y terms that appear have the same degree is called anequidimensional (iny equation, An equicimensional (in y) equation can be converted to an equation ot lower degree wath the substitution y(x) = ay (ayy : oe ( #)) 2x(1+ x)y" =0 is an oquidimensional equation since each yreem, y£Y, (st) sand y* has degree 2, Yar) w y'- $X—yareo + yu") yuan! + yu")— YU? +4"). Substituting ito the equation results in the equation e™(yy((u'(x))? + w(x) — (yu(x))?) — 2x(1_ + xy" = 0 wh ‘when simplified and factored yields y(e"u"—2x(1 + x)) = 0. Then eu’—2x(1 + x) u"=2x(1 + xe Integrating twice, using integration by parts, we obta udm e*(F-px+ 54° ]+ ex + es where c; and e; represent arbitrary constants. Since y(x) = Let y(x) =e. Then, y u(x) = yx) and, * is the solution, ll ‘we conclude that y(x) XAMPLE 4.33 i dy &y of dy) ae wy ‘i Sowve 4 ve Sy inane +r) | (1440 os(x})y?=0. Solutic Asin the previous example, the equation Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 152 sx 842) 1s 4codayp=0 sen cqutinensonleqatn since each y term, veG%, yQ¥ FY, (2) and y*has degree 3. In onier to compute y%(x).we begin by defining dy [0] =Exp Cu } and dy [1] =y x1 u' Ex]. We then define ay [n} recursively to be Bty(a-L],x] /. y'[x]->yLx]w [x]. The definition is of the formdy [=_] :=dy [n]=...so that Mathematica remenibers the values ofdy [a] computed. Note that dy [a] conesponds to the value of y°tX) using the substitution ytx) = e. We then compute a table of dy [1], dy [2] and dy [3] and display te esultinCoLumnForm =< equdinension! <==. “ati Clear fay rate, step,1h5] ilailon arfo-tsytetz 11: Grier wed . : fa Ji=dy ta ]-Bldy (a1) 2-2 [x)-orle] © x] tab sohe= Table [(n,d7[a1} (2,13) ]//ColumnFore ull 48} (1, vba) ofa 2 ated ote], + rhel wD (3, be) wf) #3 vie) we) w' Eel + ° ) yi eb) We then define rule to replace Dly [x], (x,n}] =y%x) by dyfa]. Since dyn] is defined recursively ahove, dy fa] can only he evaluated when dy fn] ix a specific positive integer Consequently, the command RuleDeLayed. represented by :>, is used in the definition of rule so that dy [n] isonly evaluated when ale is applied to an expression Walden Tl reade=(DEr Le] (2.8) 124710) i ont 48}« ] | ape > arian ] For example, in the following commandsstep is defined to be yx) and then when zule is applied Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 153 to step, ¥OXR)is replaced by dy [3] “lS stop-Divix) (2.291 J auto} ] ] ta) lS 1 on step /. rele ulfStf= ] wed w fx)? ¢ 9 yber ote) w tx) + yi) Ed Lns (0 be the left-hand side of the equation: = a wals2h-= ewe -c 900) fe 1oR gtr Cele“ tee ar (x13, Cet Ca aycos ta dyrlx1-2 out 52h= cP? cop re? + 4087 (2 y be? = 3 ix) bed ytd + rial? tx) and then apply eule ols, factor the result, and name the resulting outputstepone. Ulsa= stepone=ins /. rule//Factor autsam | yb? (1+ 4 297 costa] + 4297 txt) Then, we must solve the equation 1+ 4x! cos(x) + 4x*2u(x) =O for u. Note that 1+-4x°%e0s(x) + 4x°u°%x) is extracted from stepone with steponef [1, 1,21] Solving 1 + 4x: cos(x) +4x°u(x) =0 for ux) yields (x)= R008) Te expression steptwo with steptwo[ [1,1,2]]. 2) is extracted from thelist Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 154 ile = i steptwo=Solve[stepone [12] ta | outszt= an OD pey p42 costa, ] co fey aD), HE =I(1 44x" cos fo compute u(x) we frst compute u(x) = [og [stepeworr1, 1,211 dx and name the result stepthree then compute / \ vin=f/ Spsin(s) +e lax [ stepthreedtx and name the result stepeour Wn 59f-= J Mal 60h:= ] Butf60}= ] Last we compute u(x) teptourdx = | (Vx(1 +0, fx) +c0s(x) +0, }ax atv r300-46e,) A + Sins) + 65, where €,¢5, and the resull stepEive. Since yx) = &, the genera cc represent arbitrary constants, and nam solution i given by y(x) =e", defined below as se. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 155 Deft stepfivestategrate[stepfour ,x]+0[3] ae lath sol-Eap[steptive] outfézt= rowers, 24 Sattix] + 9 x oft} + 6 of2) , (91 + Simtel? ‘To graph the solution, so, for various values ofc, c, and c., we first ereate an array of ordered triples, array. Since axray is a two-dimensional array and we wish to have alist of ordered triples, wwe use Platten to convert azzay 10 a list of ordered triples, tziples. An abbreviated two-line form of triples is then displayed. ‘We then define togzaph to be a table of functions consisting of 801 with e[1] replaced by the first ‘member of the ith ordered triple of triples, c[2] replaced by the second member ofthe ith ordered triple of triples, and c{3] replaced by the third member of the ith ordered triple of triples, for 121;2,3)9. Wal Feh= | rapetatel (24.09 (2 1131 AN: hort[eriples 2] Buf 771¢8Short® | MeL, A, 0), (1, 0, 0), fo, 1, 9), (0, 1, 0}, <>,"1,'0, 0), 1, 1, 0} tal 78h-= tographe¥abtefenl/ (oft }-oteiplest {i111 ‘o12]->triplest{s,2] ela}->traplest {1.3115 .(1,1,991; ‘We then graph the table of functions togzaph onthe interval [0]. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 156 Wal ele Plot [Evaluate [tograph] ,(x,0,1}] ut 79) -craphtes acacia WEXAMPLE 4.34 sowve 238) +29( if) shag oO ey Solution: Asin the previous two examples, the equation {8} +0) -n Bary »tsoquamensional since cach y erm, () . (a aay yeh ye Gand ye F has degree 3 Proceeding as in the previous example, we first define Lh to be the left-hand side of the equation and then apply tule to Ths. factor the result and name the resulting output st epone. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 157 aes Couldinensiond —————=s| nf 0/-= amsmay” (21902 fy” [2] -2-S7 xy” Cad Lee Gaeta Pay bel e ayte}ay Ux er bxd-ay" 1] auf 60}= sr yo ye) + 2 ye) te? 2 on - 2 ybel? ye) = 2 ye) bbe + reel? tx) | anistie | steponesths J. rule//Fector | out tf= | rie? 4? weed 2 tel OED ‘We must then solve the equation u”—2u” + 17u’=0. Note that u””— 2u” + 17u’is extracted from stepone with stepone [ [2] ]. The cluracteristic equation of u"— 2u”+ 17u'=0is, ’ Factoring and completing the square yields, Mu 2an-+ 17)= mlm = 1F + 16] =mfGn— 1) ~4ij[— 1) +44] =0 4, Therefore, the general solution ofu —2u + 17u = Ois +e, sin(4x)+c, cos(4x)). Below weuseDSolve tosolveu —2u +17u =0 and name the resulting output stept wo. eee || oufaz= ((olx] => C141 + E C19} costa x) ~ Pca) stat eb) ‘Then the general solution of (v2) -w Rory Bay Bay 1, defined below as 802. Differential Equations with Mathematica by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 158 Tal 37 sol=Exp[steptwol 1,1,211] autf 85} gflt1 + BE {91 Coats x] = BE ciat sia x1 ‘To graph the solution, s01, for various values of ¢, ca and c,, we fist create an array of ordered triples, array. Since azray is a two-dimensional array and we wish to have a list of ordered triples, wwe use Flatten to convert array 10 a list of ordered triples, triples. An abbreviated two-line form of triples is then displayed. ‘We then define togzaph to be a table of functions consisting of sol with e[1] replaced by the first ‘member of the ith ordered triple of triples, ¢[2] replaced by the second member of the ith ondered triple of triples, and e[3] replaced by the third member of the ith ordered triple of txiples, for 9. 211A teiplessriettestarray iT; Short{erapies,2] Dull 86)éShort= a {0 =1, 1), (9, LO), (0, at, 1), 0, 0, -LD, >>, (0,1, 0), @, 1, 1) wl82h-= tograph-Table[sol/. (C{1]->triples{ [4,1], Cta}-serapaestit 2 Sia }-seriptest {i311} 4.19015 ‘We then graph the set of functions, tegraph, on the interval Wal s0h* Plot [Eva1uate|togrey e201 Differential Equations with by Martha L, Abell and James P. Braselton Chapter 4: Higher Order Differential Equations 159 and on the interval [0.1] 02 04 06 08 t autho ~Sraphics- ar TT 00% ye Differential Equations with by Martha L, Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations “Mathematica commands used in Chapter § include: Appendto Line Plotstyle AspectRatio Module PrependTo Axes NDSolve ReplaceAlL D NIntegrate Show DisplayFunction Paxt Simplicy DSolve Partition Solve Evaluate Plot Table Graphics PlotRange Ticks Graphicsarray Point GrayLevel PointSize $5.1 Simple Harmonic Motion ‘Suppose that a mass is attached to an clastic spring which is suspended from a rigid support such as ceiling. According to Hooke's law, the spring exerls a restoring force in the upward direction which is proportional tothe displacement of the spring. Mathematically, this stated as follows: Hooke’s Law: F=ks where 150) is the constant of proportionality or spring constant, and s is displacement ofthe spring. Us ‘sing this law and assuming that x(t) represents the position of the mass, we obtain the initial value problem m2S+kx=0 ar x(0)=0, x(O)=B. Note thatthe initial conditions give the initial position and velocity. respectively. The solution x(t to this problem represents the position of the mass at time t. Based on the assumptions made in deriving the {lifferential equation (the positive cievetian is down), positive values of x(0) indicate thar the mass is heneath the equilibrium position while negative values of x(t) indicate that the mass is above the equilibrium position. We investigate solutions to this intial value problem under varying conditions below. EXAMPLES. ‘A mass weighing 60 Ib. sirtches a spring 6 inches. UseDSolve to determine the function x(\) which eserihes the motion of the mass if the mass is released with zero initial velocity 12 inches below the ‘equilibrium position, 160 Differential Equations with Marhematica by Martha L Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 161 Solutior ‘Hust, the spring constant k must be determined trom the given information. By Hooke’s law, F = ks, $0 ‘we have 60 = k(0.5). Therefore, k = 120 Ib/ft. Next, the mass m must be determined using F = mg. In this case, 60 = m(32), so m = 15/8 slugs. Since k/m ~ 64 and 12 inches is equivalent to 1 fool, the initial value problem which should be solved is ax SX + 64x = Ger reax=0 1,x(0)=0. problem is solved below will BSolve and he resulting utput iy named ded. The solution iy explicitly extracted fromdet with det [[1, 1, 2]] and named sol [¢] See tormoniemotion In order to better understand the relationship between the formula obtained above and the motion of the mass on the spring, an alternate approach is taken below. First, the function zigzag is defined to rode a Fist of points jainod hy line segments to represent the graphics of a spring Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equatio 162 Dnbi= Chear[ points-Table[b+i length/a, ia: patrtaptel TesC1)AL eps podntst (411), Gilat; Prependto[peirs,(4,>)1; appentrotperrs (6.4) Hanetaetes] Below, the function spring is defined. This function prod ! allached 1o the end of the spring) as well as that of the spring obtained withzigzag. e8 the graphics of a point (the mass id= spring (t_) ‘Show[Graphios{ {eignugl (0,s01Lt1) (0,1) 20,0251, Prthange 9 ({24/2.472) (4.1), DispleyFunction->identity] produced in graphs below for v represents the multiplication symbol. The same results would (15 4). This list is then partitioned into groups of GraphiesArray. The plots displayed show the position However, they cannot be animated since they are contained in animation, the spring finetion should he used with ae com alues of 00 t=2/4, The symbol * be obtained if (15*4) were replaced by four in toshow for use within a of the mass at these values of time. aGraphicsarzay. In onler to achieve nmand Afier the list af graphies celle is created with theDo command, the resulting graphies can be animated (0 view the motion of the mass. Val ol= graphs-Fable[spriagit], 1b 0 Fa /4 FASCISEAS 1: toshow-PFartition[graphs.4] ShowlGraphiosArray|toshow] Differential Equations with Mathematica by Martha L Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 163 =e Enea MEXAMPLES2 Determine how varying the value of the initial positionct atfects the solution of the i =0 by considering values of a= 1, 4, and [s(0)=6,x'0)=0 Solutio ‘The first step is to determine the solution to each of the three problems inde2, de3, and de4 using Dsolve. ial dal t6jm ei aera: ih -. 0} eft] ,t) / Dull tif ] j Cate} > costa em cagall Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equatio Wal 17 dea-DSolvel x" "It ]eartt = EOTe=O) aT L AT autl 12. Axle] > 4 Coste en wb toh= ded=DSolvel {x"*[t]+4xlt ==0,x[ 0} = O}==0) -xfe),t1 aut 18} AGx(e] ~> -2 costz UM) "These three solutions are then plotted simultaneously in varying ‘motion ofthe mass on the spring. tal Fah Phot {(e21 11,2,211 ,4e9111,1,211, aeattte ail} Pi) -Plotstyle—> {GrapLeve1 [0] ,oreyt Graplerel (411 (e outf1 9) ~Graphios- aa it + BI 164 levels of gray to show the resulting Notice thatthe initial position only affeots the amplitude of the function (and direetion in the ease of the negative initial position), The ma cases. i MEXAMPLES.3 s passes through the equilibrium (x }) at the same time in all three Determine how varying the value of the initial velocity affects the solution ofthe initial value problem Differential Equations with Mathematica by Martha L Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 165 +4x=0 ] by considering values of B= 1,4, andl—2 | x(0)=0,x'@)=B. Soluti ‘Again, the fist step in the solution process is to determine the solution of each of the three problems in e2, de3, and ded using DSolve. _SSS Wale: o AezDsorve l(a" [e]etn[t}==0,2101—-0, x LO}ea) x11 8) eultet= sinj2 ty) (ett) => x" [elt tt Seas) (x(t) > 2 state en? (ott) > -Sint2 tM) ‘These solutions are then plovied simultancously in varying levels of gray (o demonstrate the resulting ‘motion. Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 166 dnf2iln Phot {(4e2111,1,211,4e9{(1,1,211, dea A velocity) of each function, The mass passes through the equilibrium ( cases. §5.2 Damped Motion wich eens dats danging re pepeioal seponeate ces ee ye Clearly, from our experience with second order ordinary differential equations with constant coefficients in Chapter 4, the solutions to initial value problems of this type greatly depend on the values of m, k, and c, Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 167 Suppose that we assume that solutions of the differential equation have the form x(Q}=¢. Note that m is not used inthe exponent as it was in Chapter 4 (0 avoid contusion withthe mass m, Otherwise, this ealeulation is identical to those followed in Chapter 4, Since x'()=re" and x”(Q=re", we have by substitution into the ditferential equation mre’+cre"-+ke"=0, so e'(mr! +er+k) The solutions to the auxiliary (or characteristic) equation are Yo =tmk 2a Hence, the solution depends on the value of the quantity (¢ ~ 4mk). In fact, problems of this type are characterized by the value of (¢- 4mk) as follows: Case: C—4mk>0 This situation is said to be overdamped since the damping coefTicient ¢ is large in comparison with the spring constant k. Case I: ¢—4mk=0 This situation is described as critically damped since the resulting motion 1s os decrease in the damping coefficient c. latory with a slight Case II: c*—4mk <0 This situation is called underdamped, because the damping coefficient © spring constant k. small in comparison with the WEXAMPLES4 Classify the Following differential equation as overdamped, underdamped, or critically damped. Also, solve the corresponding initial value problem using the given initial conditions and investigate the ‘behavior of the resulting solutions. x , pdx Gees G+ 16x=0 (2) x0) =0,x(0)=1 (b) x0) =-05. (0) Solution: In this case, m= 1, = 8, and k= 16, Thus, ¢ —4mk= 64 — (4)(16) =, so this situation is e damped. (a) DSolve is used to solve the frst initial value problem. Clearly, inthis ease, the solution is alway positive and approaches zero ast approaches infinity a illustrated in te plot of the function, ally Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 168 Damping 148 x! [t]e16x[t]==0, xe eD ‘ cot > Fils Il 28m soltt_t outfz0/= t me je deft 1,201 Plot [sol] ,(¢,0,5)] 0.00] 0.06 0.04] Outl227/= ~raphios- | dal etn ] To further understand the relationship between the formula obtained and the motion of the spring, similar commands are used as those employed in the section on harmonic motion. In this ease, the functionp is defined below which produces the graphics of a point (the mass on the end of the spring) moving along the vertical axis. A list of graphics cells is produced in graphs using p for values of t from t= 0 to 5. This list is then partitioned into groups of three in array for use with a GraphicsArray. Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equatio 169 Wala lo= Cheer ip] Unb PUt_l:=Plt ]=Show[Oraphios| (PointSixe[.11, ‘Point {{0.soLlti} 11. Axes-sAntomatio ‘Foks->(Hone (0, .05,.1)),, Piotkange-> ai, DisplayFeaction->ideniity] nls tf Gapdsaradloipits ,{,0,2.5,2.5/14}15 SrraysPartitiontgrapie 31; ‘The array of graphics Ahese graphics. In onder animate the grap the list of graphics cells. IIs generated above is displayed below. © spring, Note that animation cannot be used with ‘aBo cunmnaind should be used (o create tal52h- Show[Oraphdoederay[arrer]] oy oN om 0.05} 0.05} 0.05} or oy oy 9.09} 0.09} 9.09] Outf52)= GraphtosArrey. Differential Equations with Mathematica by Martha L Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 170 (b) DSove is used to solve the second initial value problem, These results indicate the importance of the initial conditions on the resulting motion, In this case, the position is negative imitially, but the positive initial velocity causes the function to become positive before approaching zero vel (x**[t]e9 x°[e]oextt1==0, ] ‘x10}=r=-3,2°[0}==3),2 (01,00 Outf Sfx atts = BSS ial SSh-= Plot [4e[11,1,211, (€,0,9) ,PlotRange >A11] jemape 7] a 0.2 0.3 -0.4 “0s out Sf Graphics a ~~ v0% | —aT wt VE oe EXAMPLE 55 Classify the following differential equation as overdamped, underdamped, or eritically damped. Also, solve the corresponding initial value problem using the given initial conditions and investigate the ‘bchavior of the resulting solutions Pr ye eae (a)x(0) (b) x0) in this case, m= 1, e= 5, and k=4, Thus, & — 4mk = 25 — (4)(4) = 4, so this situation is overdamped, (@)DSolve is used to solve the first initial value problem. Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equatio m1 Damping Wal5: ger degeD Solve x" *[t ]+Sx"[t ]oaz ft at E1O}==t 2° [O]o=-1),31e) .t outsf= weet) > EY illustrated in the plot of the function, Clearly, in this case, the solution is always positive and approaches zero as ¢ approaches infinity as Tals Flot (dogi (1, PlotBange->42i7 1 0.9] 11.18.06), 0.6] 0.4] 0.2] 1239458 6 outtsa}- ~Sraphtos- not large enongh to fave the position to go negative. the’ ‘The damping is so great that even though the initial position (b) DSoLve is used to solve the second intial value problem, ital conditions on the resulting motion. In this ease, the position is positive initially, hut the larger ‘negative inital velocity causes the function to become negative before approaching zero. is positive, the negative initial velocity is ). These results indicate the importance of Mab60/-= | Gleer{toe) SESE cae terse epeantercce, Hto}=si,z'fo}==-0) .zte1.0) | outtcol : ‘ | cater aot i Differential Equations with Mathematica by Martha L Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 172 fit = Plot [deat 1.1.21] ,(¢,0,6), ‘FiotRinge—SAli} uf tf= ] “raphios- oot ESS _ EXAMPLE 56 Classi the following differential equation as overdamped, underdamped, or erally damped. Also, solve the conesponding inal value problem vsing ihe given inital conditions and investigate the behavior ofthe resulting soutions XB yt6x=0 ‘i 1x0 Solutio In this case, m=1, ¢ underdamped, DSo1ve —————— infsi= Cleer{de] deen 1, and k= 16, Thus, ¢—4mk = 1-(4)(16)=-63, so this situation is ‘used to solve the initial value problem. Oulosf= Dy 4 sart 7) Since the values of r inthe solution x(0) = € are complex conjugates, the Trigonometry .m package is loaded to obtain a real-valued solution. (Note, however, that Mathematica can plot the solution in its Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 173 solution in de to obtain the resulting real-valued function called soLution, (In many cases, ComplexTotrig must be followed by SimpLify (0 obtain the desired result; in other cases, the command CompLexxxpand can be used successfully.) A function of tis then defined as 803. for later use, Wale= (Orayteren|.51, dzeptered 51), DicpleyFunstion-sldentity]; ShowEplot -rlott , “el 7Ol= ] DispleyPunciion->$0isplayFanction] eater ] identical result, Other questions of interest include: (1) When docs the mass 2) What isthe maximum displacement ofthe mass on the spi "The time at which the mass passes through x = 0 can be determined in several ways. Since the solution involves the sine function, the solution equals zero at the time that sin(x) first equals zero after Hence, Solve can be used to find out when the argument of the other hand, FindRoot can be used with an initial guess 0 first pass through its equilibrium point? gt 0. the sine function in so1 equals zero. On obtained from the earlier plots to yield an al 7th ] Solve ((9/2)Sqrti7] ta=Pit1/8 Out?) ] (te “> 0.791607} af 72l A cteeterentes an ] aug rete (e ~> 0.791607) / : Unfortunately, the derivative of the solution is rather complicated due to the exponential term, Thetefine, Solve fails Differential Equations with Mathematica by Martha L wo determine the ine at which the Hirst derivative ofthe solution is equal tw Ze40 Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equatio 175 However, FindRoot can be employed to determine this time. Then, the result found inepl can be ‘used to lind the corresponding position, ult 73/= 0 tal 4h opl=FindRoot [sol"(t]==0,(t,-25)] Outl74}= ft => 0.364226) LPL ont {1,21 auf 73/~ 0.64226 inl 761: solfept{(t,2111 Out 26) 0.555672 0.546995 sqrt) 7 Another interesting characteristic of solutions to underdamped ‘maxima of the solution, called the quasiperiod. This quantity time at which the second maximum occurs withF indRoot. of Lis taken t obtain the value of 1.58321 1 problems isthe time between successive is found below by, first, determining the en, the difference between these values Wal 7B op2=FindRoot [501 auf 7ah~ (b> 1.94744) eal 79hm op2{(1,2}1-op1 (11,21) (t.1.901 Differential Equations with Mathematica by Martha L Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 176 ‘To further investigate the solution, animation can be used with commands similar to those previously used (0 observe the motion of the muss on the spring, Again, the luncionp is detined. ‘The graphics cells generated in graphs below are then partitioned into groups of five. tai al= Cleerte grarte errer) pier) tpfeesnae ercpatost (Rosatstme[.11, Pout, sollte) axossohatonsts Kittorteie-s Fioke-s (Home (6,0), fothangee> {fet ip (2,1 190. spleyPunction-yidenitéy] 4 mnt 8h grepnceranne (nie Sretyorareitiaatgrapis 3); ‘This array of graphics cells is shown below. AS wi command should be used withp to produce listof graph as the case with the previous examples, aDo ‘cells whichanbe animated. To see the motion ofthe mass, graphs should be viewed across each row from left to right. ae J Show Orapaiosirray ervey] Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 7 EXAMPLE 5.7 Suppose that we have the initial value problem se son-0 dt dt ), x(O)=1 24/6, 46, and V6. Determine how the value of eafecs the soluion ofthe inital value problem Solution: DSolve is used to find the solution of the initial value problem for each value ofc. Note that each ease results ina different classification: CriticallyDamped Overdanped tal 51h det=DSorve|{y""[x]+2 Sert[6] 7° [=}+6y12: 2 [0lent) rte] .2] outf131}= (Qo) > { 1) tal -> Satter Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equatio aft 52Ir0 dezeDSolvel(y”[x]+4, Sqrti6] 1° [xIs6rtx ThojeeO,7"[8le=t) 7181-21 uf 152h= cartel SSPU2] (@ - 2 sartioH x ra . RET Inf t33/-= aesonzea tayo sactt6y 1° bx oor ta} ho}==0,y'[0}==1) 7 Ex} x1 3 Sqr ay OT + SHETTY H)7SELZ] Fa(68 F sertia) - serttey 072 EEE SEER ‘The corresponding solutions for each value of ¢ are plotted sin ‘more obviously as Well alt= plotinFlot [det [[1,1,21},(2,0,6), DieplayFanctin-stdantiey}? wb 135) phot acPiot (ae3{ (11,211, (2,0,6), BisplayFunction->Tdentity, Plotstyle->OrayLevel|-21] taf 1562 plotg—Flot {de9{1 1,2]}.(2,0,6), Dispiesranction:sidcutiey Plotstyle-sGrayLevel 41]; Plot: :plnr Compect>>tionl (x), <<2>>][x] ie note mechine-size real number Differential Equations with Mathematica by Martha L Abell and James P. Braselton 178 multaneously, Note that since the values of vary more widely than those considered in the previous example, the behavior of the solutions differ Chapter 5: Applications of Higher Order Differential Equations 179 Wal 152 Show{plot ,plot2.pioct3, ‘MopiajFunotion s#htepieyrenotion) $5.3 Forced Motion In some cases. the motion of the spring is influenced by an external driving fore. f(t). Mathematically. this foree is included in the differential equation which models the situation as follows: ax ax Axe A 4110, qt. Hence, the resulting initial value problem is, il equations modeling forced motion are nonhomagencons and reqpite the method af Undetermined Coefficients or Variation of Parameters for solution. We first consider forced motion which isundamped. EXAMPLE SS Investigate the effect thatthe forcing function: @fO=0, (b= 1, ‘has on the result of the initial value problem: Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equatio 180 Shean ar x(0)=0, x(0)=0 Solution: (a) DSolve is used t0 solve the first initial value problem, However, this problem could have been solved without any calculations whatsoever. Since f() = 0, there is no external driving force. Also, the initial position is zero as is the initial velocity. Therefore, the mass is never placed into motion, s0 it remains in its equilibrium position x =0. A _ Ww auth t7f= ] Catt] > 9) (b) DSolve is used to solve the second initial value problem, i168: ] 402-Dsorvel (=" Dull 19f~ ] 2 cent» Sap, The forcing function in this case is constant. The mass moves wo a distance .3 units from equilibrium and then returns to the equilibrium. The external force then causes the mass to repeat this motion, Hlta= photz=Piot (dez1U1,1,211,8,0,2F8)1 0.5 o.4| 0.3 0.2 ot Differential Equations with Marhematica by Martha L. Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equatio 181 (©) As in the previous cases, DSoLve is used to find the solution (0 this nonhomogeneous inital value problem, ial20h= deD-DSolvel (x"* [t Je4x[t ]maCos[t] x10) jmn0) ate 27 utl20}= (att =» 25 . 2242 yy (ote that in this case, however, the extemal force isa periodic function of time. Therefore, the external force varies with time and the solution is periodic since it is the sum of two periodic functions. The resulting motion is shown inp1ot3 below. tad Et i= Zz (@) This situation similar to that in partic). ‘inl22h= Aed-Btodvet Cx" [e]etattyantiatty ale Ea }==b) 21th eT atl 22, < ae 4 cof sini oo ‘The forcing function is, again, a periodic function of time. The motion shown inpLet points out that the value of the foreing function is different from the external force in (c) at dilferent values of time. Hence, the resulting motion is not the same as that of part(c). Differential Equations with Marhematica by Martha L, Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 182 inlesl= Plotderiot [deal (11.211 (¢,0,271}, Plotstyle-sOrayievei[-41i MEXAMPLES9 Investigate the effect thatthe forcing function: (a) f= ews lO =sineo thas on the result ofthe initia value problen: (a) This situation is imeresting in dia the forcing function isu eouponent of Ure homogeneous (or Differential Equations with Marhematica by Martha L, Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 183 2). Therefore, the nonperiodie function t sin(2) complimentary) solution, x(t) = C,cos(20) + C; appears in the solution. es rorreamation Ml 25fr= outest= (ott) > by ‘This causes the solution to approach infinity as t approaches infinity. This phenomenon is called pure resonance and is illustrated inpLot 5 below. infzah= PlotS=Plot {4e3111,1,211,(¢,0,28i)} i ) In this ease, the forcing function is also a solution to the comesponding homogeneous equation ») wnlet= AeG=DSolvel (x"*[t ]+4x[t ]==Sin[2t],z[0]==0, = [O}==0) x(t], 0) outl221 coxt) Sg once, the nonperiodie function tsin(21) causes the valuc of x impLot6 to approach infinity with tas in the case above, Differential Equations with Marhematica by Martha L, Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 184 ‘elo plotgariot 4e6{11,1,211,(¢,0.275), Piotstyie-vorayiered | ATF | NN tS Out 26]= ~Graphice ‘The (wo solutions are shown inultuncously below for comp Mal2af= Show[plotS plots] aro. YE WEXAMPLE 5.10 Investigate the effect that slightly changing the value of the argument of the forcing function f(t) = .cos(21) has on the solution of the intial value problem given in the previous example. In this case, use the functions: cos(1.90) -05(2.11) ‘with the initial value problem: Differential Equations with Marhematica by Martha L, Abell and James P. Braselton Chapter 5: Applications of Higher Order Differential Equations 185 ms $4x=1) x(0)=0, x(0)=0. Solution: ‘The solution of each initial value problem is determined withDSolve, SSS Forceamotion watsth= lear [ote] odesDrolvel(x"*[t]rtz{t]onCoslt.9¢}, 2x LO ]e=0) xe] eI oul Sife ] | Ul] > 2.3641 Cos[t.9 t] ~ 2-S64t Cost. t)) Lote: ode2=DSolve{(x"*[t Je4xlt]==Cos[2.1t], 2° [0}==0) 2081 Out) Ceate] > 2.43800 costa o1 = 2 0902 costZhgtyy [Note that each solution is periodic and bounded since the solutions involve cosine functions only. These solutions are then plotted to reveal the unusual behavior of the curves. If the solutions are plotted only ‘ver a smal interval then resonance seems t be present dnfSifn ] Plot [{ode[[1,1,2]] ,ode2[[1,1,2]]},{t,0,2Pi}, Plotstyle-» (Graybevel[0],OragLevei| 21} ] out say= ~Braphios- / However, the functions given with DSove clearly indicate that there is no resonance. This is further indicated with the second plot Differential Equations with Marhematica by Martha L, Abell and James P. Braselton

Vous aimerez peut-être aussi