HOMEWORK # 2: MATH 2, SPRING 25 TJ HITCHMAN Noe: This is he las soluion se where I will describe he MATLAB I used o make my picures.. Exercises from he ex.. Chaper 2.. Problem 6. We are o show ha y() = /( + Ce ) is a general soluion o he equaion y = y( y), hen skech he paricular soluions wih C =, 2, 3,, 5 on a compuer. To check ha he given expression is a general soluion, we compue boh sides of he differenial equaion wih i. y () = Ce ( + Ce ) 2 = 6Ce ( + Ce ) 2 and ( ) y()( y()) = = 6Ce ( + Ce ) ( + Ce ) ( + Ce ). 2 Since hese agree, he given expression is a general soluion o he given equaion. We plo he paricular soluions indicaed wih a MATLAB M-file. exch2_prob6.m =linspace(-2.5,2.5,); Y=[]; for C=:5 Y=[Y;./(+C*exp(-*))]; end plo(,y) axis([-2.5,2.5,-.5,.5]) grid on legend( C=, C=2, C=3, C=, C=5,2) xlabel( ) ylabel( y ) ile( Soluions o y =y(-y) ) shg The oupu graph is he following.
2 TJ HITCHMAN.5 3.5 C= C=2 C=3 C= C=5 Soluions o y =y( y) 3 2.5 y 2.5.5.5 2.5 2.5.5.5.5 2 2.5 Problem 7. Noe ha for exercise 6, y = is a soluion because hen y () = and y()( y()) =. However, no value of C in he general soluion can produce his paricular soluion because he fracion in quesion can never be zero is numeraor has no roos. Problem 8. This problem has hree pars. a: Use implici differeniaion o show 2 + y 2 = C 2 defines soluions o he differenial equaion + yy =. If we differeniae he given expression impliciy, we obain 2 + 2y y =. Upon dividing by 2, we ge he resul. b: Solve 2 + y 2 = C 2 for y o provide explici soluions. Show ha hese funcions are also soluions o he differenial equaion in (a). The algebraic manipulaion yeilds y() = ± C 2 2. Noe ha his is a pair of soluions for each value of C. We differeniae hese o find y () =. This allows us o check he differenial equaion as follows: C2 2 + y()y () = + (± ) ( ) C 2 2 = =. C2 2 c: Discuss he inerval of exisence for each of he soluions in par (b).
HOMEWORK # 2: MATH 2, SPRING 25 3 Fix a value of C, and consider he soluions y() = ± C 2 2. This funcion is only well-defined for hose which saisfy C 2 2. This means ha we mus resric a leas o he inerval C C. However, we also require ha our soluion is coninuously differeniable. So we exclude he endpoins, oo. Thus, he inerval of exisence for hese wo soluions is ( C, C)..2. Chaper 2.2. Problem. We are o find a general soluion o he equaion xy y = 2x 2 y. To do so by separaion of variables, we mus firs rearrange he equaion o read y y = 2x2 +. Then we may inegrae wih respec o x o find x y (x) 2x 2 ln y(x) = y(x) dx = + dx x ( = 2x + ) dx = x 2 + ln x + C. x So ln y(x) = x 2 + ln x + C is our implici soluion. We exponeniae boh sides o find y(x) = C x e x2. Whaever sign ambiguiies come from having he absolue value bars can be absorbed ino he consan in his case, so we obain he following explici general soluion: y(x) = Cxe x2. Problem 6. We are o find he exac soluion o he iniial value problem y = e x+y, y() = and give he inerval of exisence. We separae he variables as follows: e y y = e x, hen inegrae boh sides o ge e y ( ) = y e u du = x e w dw = e x. We rearrange o obain he explici soluion y(x) = ln(2 e x ). (This one I had o double-check o believe. I jus fel funny.) In order for he equaion o make sense, we need o resric o hose x for which 2 e x. Tha is, we mus resric o (, ln 2]. Jus as before, we need o also assure ha our funcion is coninuously differeniable, so we remove he endpoin. The inerval of exisence is (, ln 2)..3. Chaper 2.3. Problem 2. We are given ha a.2 kg mass is released from res a 5 m, and ha i falls agains an air resisance of R(v) =.v, where v is he velociy. Wha is he velociy upon impac wih he ground? There are wo ways o go abou his problem. The sraighforward way is o wrie an iniial value problem for he velociy and solve i. Then, inegrae wih respec o ime,, o find he posiion. We hen solve for he ime i akes he mass o hi he
TJ HITCHMAN ground (numerically, he equaion is nasy), and hen evaluae he velociy a his ime o ge an answer. The clever way is as follows. The velociy is v = dx/d. By he chain rule, he acceleraion is dv d = dv dx dx d = dv dx v. We reinerpre his as saying ha as a funcion of x, we can wrie dx = v dv dv/d. Wha we shall do is inegrae boh sides. The lef hand side will give us he oal change in posiion, -5 meers, and he righ hand side we need o figure ou. This feels a bi slippery a firs, bu i is ok. I really depends upon being able o wrie he quaniy dv/d as a funcion of v. Bu his is exacly wha our equaion of moion will ell us. Using Newon s laws, we see ha he moion of he mass is described by he iniial value problem 2 dv d = 2 g v, v() =. where g = 9.8m/s 2 is he graviaional acceleraion consan near he earh. Working wih he manipulaion above, we find ha 5 = 5 dx = vf v= v dv dv/d = vf v= v dv g v/2, where v f is he final (impac) velociy ha we seek. I ll clean up he negaive signs and do some algebra vf 2v vf 5 = 2g + v dv = 2 2g + v 2g dv, 2g + v equivalenly, 25 = vf ( 2g ) 2g + v dv = v f 2g ln 2g + v f ( 2g ln 2g + ). Cleaning up a bi, we ge he following implici equaion for he impac velociy 25 = v f 2g ln 2g + v f + 2g ln 2g. This is he kind of equaion ha needs o be solved numerically. We do so wih he MATLAB command v=solve( 25=v - 2*9.8*log(abs(2*9.8+v)) +2*9.8*log(abs(2*9.8)) ) o find v f = 7.3 m/s 2. Noe ha MATLAB reurns hree answers and we need o pick he correc one.
HOMEWORK # 2: MATH 2, SPRING 25 5.. Chaper 2.. Problem. We are asked o find he general soluion o he equaion y + 2y = 5. We proceed by finding an inegraing facor. We are looking for a funcion u(x) which saisfies u /u = 2. Thus u = e 2 will do. Thus, we find ha e 2 y() = (e 2 y) d = e 2 (y + 2y) d = 5 2 e 2 d = 5 2 e2 + C. This leads o he general soluion of y() = 5 2 + Ce 2. Problem 3. This problem has wo pars. a: Use he echnique of inegraing facors o find he general soluion o he equaion y + y cos(x) = cos(x). We mus find a funcion u(x) such ha u /u = cos(x). Inegraing, u(x) = e sin(x) will do. Then we find ha e sin(x) y = (e sin(x) y) dx = e sin(x) (y + cos(x)y) dx = e sin(x) cos(x) dx = e sin(x) + C. Thus our general soluion is y(x) = + Ce sin(x). b: Use separaion of variables o solve he same equaion. Discuss any discrepancies beween he wo resuls. We separae variables o find y /( y) = cos(x). Inegraing his, we obain ln y = sin(x) + C. This is an implici equaion for he soluion. A firs blush, his seems differen, bu upon rearranging hings, (and folding any ambiguiy of sign ino he arbirary consan) we ge he same resul as in (a), y(x) = + Ce sin(x). 2. Exercises from he Manual 2.. Chaper 2. Problem 2. We are o solve y = (y + ) wih y() = over he inerval [, 2], and use ezplo o make a plo of he soluion. Firs, we solve he equaion using separaion of variables. dy = (y + ) d leads o dy y + = d. Acually, o sick wih he iniial condiions, we use his version y du u + = dw.
6 TJ HITCHMAN Performing he inegraion, we ge ln y + ln 2 = =. This is an implici equaion for our soluion. Rearranging hings, we find y = 2e (we choose he posiive possibiliy o mach our iniial condiion). Then we graph his wih he ezplo command. My MATLAB command line was: ezplo( 2*exp(x)-,[,2,.5,.5]); xlabel( ); ile( Soluion o y =(y+), y()= ) (You need o play a bi o find he righ inerval for y.) This produced he following picure. Soluion o y =(y+), y()= 2 8 y 6 2.2..6.8.2..6.8 2 Problem 8. We are o solve ( + 3y 2 )y = cos(), y() = and use he implici version of ezplo o graph he soluion. This equaion already has is variables separaed, so we inegrae y ( + 3u 2 ) du = cos(w) dw. This yields y + y 3 2 = sin(). As we are suck wih his implici equaion, we plo i as follows in MATLAB:
HOMEWORK # 2: MATH 2, SPRING 25 7 ezplo( y+y^3-sin(x)-2,[-2*pi,2*pi,.5,.5]);xlabel( ); ile( Soluion o (+3y^2)y =cos(), y()= ) We ge he following..5 Soluion o (+3y 2 )y =cos(), y()=..3.2. y.9.8.7.6.5 6 2 2 6 Problem 2. We are o solve he iniial value problem y = y sin(), y() = and wrie a scrip M-file o plo he soluion over he inerval [ 2π, 2π]. For he soluion, we separae variables and inegrae: o ge y du u = sin(w) dw ln y = cos() +. Noe ha we are ineresed in a problem which has posiive values of y a he iniial condiion, so we can solve for he explici expression y = e cos(). I wroe an M-file iled manualch2prob2.m wih he following conens. =linspace(-2*pi,2*pi,); y=exp(-cos()); plo(,y) axis([-2*pi,2*pi,,])
8 TJ HITCHMAN xlabel( ) ylabel( y ) ile( Soluion o y =ysin(), y()= ) shg Running i produced he following picure, Soluion o y =ysin(), y()= 9 8 7 6 y 5 3 2 6 2 2 6 2.2. Chaper 3. Problem 6. We are o plo soluion curves o he equaion x = 2 + sin(x) wih iniial values x = 3, 2,,,, 2, 3 a =. This equaion is no very easy o solve, so we jus use dfield o plo hese. A reasonable window o show he imporan feaures of he graphs is, x. My picure is below. (Soon, I ll figure ou how o jus prin he picure, and no all he exraneous suff.)
HOMEWORK # 2: MATH 2, SPRING 25 9 x = 2 + sin( x) x 3 2 x()=2 x()= x()= x()=3 2 x()= x()= 2 3 x()= 3 3 2 2 3