0% found this document useful (0 votes)
21 views

Lab 3 Part 2

Uploaded by

eduinsidebd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
21 views

Lab 3 Part 2

Uploaded by

eduinsidebd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 45
Math lab 3 Powered by Desi play boys do ORDINARY DIFFERENTIAL EQUATIONS 2.1. Differential Equations The Mathematica function DSolve finds symbolic solutions to differential equations. (On the other hand, NDsolve, is a general numerical differential equation solver.) DSolve can handle the following types of equations : (i) Ordinary Differential Equations (ODEs), in which there is a single independent variable t and one or more dependent variables x, (t). DSolve is equipped with a wide variety of techniques for solving single ODEs as well as system of ODEs. Ras a7 2 CBS (ii) Partial Differential Equations (PDEs), in which there are two or more independent variables and one dependent variable. Finding exact symbolic solutions of PDEs is a difficult problem, but DSolve can solve most first- order PDEs and a limited number of the second-order PDEs found in standard reference books. (iii) Differential-Algebraic Equatins (DAEs), in which some members of the system are differential equations and the others are purely algebraic, having no derivatives in them. As with PDEs, it is difficult to find exact solutions to examples of such systems DAEs, but DSolve can solve many that occur in applications. CHAPTER-2 { , | | In Mathematica, unknown functions are represented by expressions like yIx]. The derivatives of such functions are represented by y’Ix], y’’[x] and so on. OE - 40 Mathematica (Math Lab-Ill) The Mathematica function DSolve returns as its resyjt a li, of rules for functions. There is a question of how these functio,, are represented. If you ask DSolve to solve for y[xj, the, DSolve will indeed return a rule for y[x]. In some cases, thig ry may be all you need, But this rule, on its own, does not give Val, for y’[x] or even y{0]. In many cases, therefore, it is better to a DSolve to solve not for y[x], but instead for y itself. In this Cage what DSolve will return is a rule which gives yasa Pure function, in the sense discussed in "Pure Functions", le Note : If you ask Mathematica to solve a set of differenti, equations and you do not give any constraints or boundary conditions, then Mathematica will try to find a general Solution to your equations. This general solution will involve various undetermined constants. On is introduced for each order of derivative in ¢ach” ode m you give, The default is that these constants are named C[n], where the index n starts at 1 for each invocation of DSolve. DSolve[eqn.y{x].x] solve a differential equatin for yx] DSolveleqn, y, x] solve a differential equation for the function y, with independent variable x , ie. solve a differential equation ‘for y as a pure function. DSolve[{eqn,eqno, ---}, fy [x], yolx], --}, x] solve a system of differential equations for y,[x] DSolvel{eqn;, eqno, ---}, {y1, yo, ---}, x} ‘solves a list of differential equations i.e solve a system of differential equations for the pure functions y,. DSolveleqn, y, {x;, xo, ---}] solves a partial differential equation. Ordinary differential equations-2 a} SOLVED EXAMPLES 2.2. First order ordinary differential equation : : 1 Example-1. Solve the first order differential equation oy dx *¥ - 1 and comments if we use y[x] or y for DSolve, Solution : pSolve ly ’[x] + y[x] == 1, y{x], x} tylx] > 1+e*C{l}} The rule applies only to y[x] itself, and not, for example, to objects like yl0] or y’[x]. ylx] + 2y’ El +yl0] /.% {1 +e* C[1] + yl0] + 2y’ Ix} Note : Here % means the previous result or solution of the ODE But If we use y as a pure function then observe that. DSolve [y' [x] + y[x] == 1, y, x] {fy ~ Function [{x}, 1 + e* Cll} ‘ Now the rule applies to all occurrences of y. yix] + 2y’ [x] + y[0] /.% [2 + C[1] - e* C[1]}} Substituting the solution into the original equation yields True. y' [x] + yix] == 1/.%% {True} Note : Here %% means the previous 274 result or solution of the ODE 42 Mathematica (Math Lab-III) Example-2. Solve the differential equation y’ _ 7 4 represent the solution as a normal function to © evalltate f(4), Nig Solution : sol = DSolvely’ [x] == x, y[x], x] {fra += + cu} 7[x] /. sol [[1]] } Now, f[x] can be evaluated as a normal function : £14] 8+C{l] | Example-3. Solve the differential equation y’ = y, y(0) and plot the solution. Solution : First we solve the DE without initia] condition DSolvel{y' [x] == y[x}},, y[x}, x] {y[x] > ex C[1]} yix] /. DSolve [{y' [x] == yix]}, y{x], x] lex C[1}} Here, we j returns parte slaton St SOMeON fO1 = 1 and Dot sol = DSolve [{y' [x] == yIx], y[o] = {¥ix] > ex} Plot [y[x] /. sol, {x,- 3, 2}] = 1}, yix], x} ‘ Ordinary differential equatione 2 43 gxamplon4, Solve ihe homogeneous differential equation y! xy #0 golution | psolve ly' [x] = xeyle] ee O, yl), x] x? « (yixl & e4 CL) Example~ ~6, Solve the non-homogeneous differential equation y’ ~ -xyel, Solution | pSolve ly ' [x] ~ x+y[x] == 1, y[x], x] x? x2 {|ves + e2 O(l) +e2 {Een ext| I} 2,3. Initlal Value Problem : Example-6. Solve the differential equation y’ + y = a sin x, yO) = 0. Also solve this equation as a pure function of y. Solution : DSolve [y '[x] + y[x] == a-Sin[x], y[x], x] {{vea + e* C(1) +3 a(- Cos(x) + sintx)]] Include the boundary condition : DSolve [{y'[x] + y[x] == a*Sin [x], y[0] == 0}, y[x], x] {via ~ -5 ae (- 1 + e* Cos[x] - e* sintx)]| Asa "pure function" solution for y : DSolvelfy '[x] + y[x] == ae [x], yl0] == 0}, y, x] {{v — Function [o.-3 ae™ (-1 + e* Cos[x] - e& sinix) | Substitute the solution into an expression : FullSimplifyly ''[x] + y[x] 4 2/.%] ‘ | (i ae2x (a — 2e* (- 1 + a Cos|x] — a sin[x]) + e2* (a + 2Cos[x] - 2 Sin[x] -a sini2xi)} a, y y Mathematica (Math Lab-II}) Example-7. Using Mathematica solve the «, io differential equations :— 3 wo fe xsy:y0)=2 19 $4 +7 =0.910=0.9/5)=1 Solution : (i) DSolvel{y [x] ==x+yizl. I =. viz. x fyix] — - 1+3e-x} ti DSolvd |y'txl+yix)—=0.9101—= 0.95 —1 yin x fyix] + Sin{xi} Example-8. Solve the differential equation y = ay. yg) - ; Solution : DSolve [fy Tx] ==a-yizl. yi] == ll. yixi. x] tyix] + €>}} 2.4. Higher order Differential Equation -: Example-9. Solve the differential equation y” = y, y49) = ; yO) =1. Z Solution : DSolve [y’ x] == yixl, yizi, x] fylx] — e* C[1] + e* CIZIy DSolvel{y’ ‘Ix] == yiz], yi0] == 1, ¥' [0] == 1}, yixj, xj fyi) ~ ey} ; Note : If not enough initial conditions are given, constants Cin] are returned , 0 rdinary differential equations-2 45 example-10. Solve the differential equation y” = y, y/(0) = 0 and draw the graph for differential constant c(n) from 1 to 10 solution : First, solve the differential equation : solution = DSolve [{y'' [x] == y[x], y' [0] == 0}, yi], x] fyi] 2 e* (1 + e2*) C[2]}} Define a function gix] using solution : gix_]=ylzl /. solution 11) ex{l +e%) Cl] Define a table of functions t[x] for integer values of C[2] between 1 and 10: t{x_] = Table [[gx] /.Cl2] >j,{j, 1, 10}] {ex (1 +7), Qex (1 + 2), 3e* (1 + 2%), 4e*(1 + 7), Se (1 +e%), Ge*(1 + €2%), 7€* (1 + e%), 8e~(1 + 24), 9e* (1 +e), 10e*(1 + €7)} Now plot the table : " plotitixl, (x.- 2,23] oe 46 Mathematica (Math Lab-II]) Example-11. Solve the differential equation :— e- aM y= xe* sin X Solution : DSolvely"[x] - 2y' [x] + ylx] ==x* Exp[x] * Sin[x], y[x], x] flyix] > eX C[1] + eX x C[2] - e* (2 Cos[x] + x Sinix)} Example-12. Using Mathematica solve the follow; differential equations :— q a =% we sy=0, gig te _y = 32, a? dx? Solution : -_-™ 1) DSolve yx] == 72 yin, x| > yb] > x CII} (ii) DSolvely'' [x] + y[x] ==, y[xl, x] {fy[x] — C[1] Cos[x] + C[2] Sin[x]}} (iii) DSolvel y [x] - ylx] == x”, yixl, x| {fy[x] > - 2 - x? + e* C[1] + e* C[2}}} Example-13. First solve the fourth order’ differential ane equation y~ = y. What happened if we use the initial condition y(0) = y’(0) = Solution : The general solution involves four undetermined constants. DSolve [y [x] = = yIz], y[xl, x] {{y[x] > e* C[1] + e* C[3] + C[2] Cos[x] + C[4] Sin[x]}} Each independent initial or boundary condition reduces the number of undetemined constants by one. . DSolve [{y [x] == ylx], y[0] ==y '[0] ==0}, y[x], x] {fyfx] > e~ {c[3] + e2* c[3] - e2* c[4] — 2e* c[3] cos[x] + e* cl4] coslx) + e* c[4] sinkx)} > Ordinary differential equations-2 “7 Example=14, Solve the On second order linear differential equation x yY *+y#Q, Solution : DSolve [x A Q6+y" [x] + y[x] ae 0, yixl, x] {vi ~ Vx cl1] cos ; V3 log|x] + Vx of2) oir [2 V3 logis |) Example-15. Solve the differential equation Z =t41y with initial condition y(0) = 1. Solution : DSolve [{y '[x] == x?+ Vyix] , yO] == 1}, yix), x] DSolvelty‘Ix] == x? + Vylxl, yl0] == 1}, ytxl, x DSolve can not solve this. So we can only obtain the numerical approximation : eqn = NDSolvef{y ' [x] == x? + Vyix] , yl0] == 1}, yix], {x, 0, 13] {fy[x] > InterpolatingFunction [{0.; 1.}}, < >] [xJ} sol[x_] = eqn [[1, 1, 2] / InterpolatingFunction[{{O., 1.}}, < >] [x] sol[0.5] sol[0.8] sol[1.1] 1.60643 ° 2.14429 InterpolatingFunction : : dmval : Input value {1.1} lies outside the range of data in the interpolating function. Extrapolation will be used. 2.89132 48 7 Mathematica (Math Lab-II) data « Tablel(x, sol{x}}, (x,0, 1,0. I}; TableForm|{data, TableHeadings ~ {None, {"x", "Numerical”}}) x Numerical 0 i. 0.1 1.10284 0.2 1.21273 03 1.33181 0.4 1.46228 0.5 1.60643 0.6 1.76656 0.7 "1.94504 0.8 2.14429 0.9 2.36672 1, 2.61479 Plot[sol [x], {x, 0, 1}]; 25 2.25 2 1.75 15 1,25) 0.2 04 06 08 1 Example-16. Using Mathematica do the following :— Plot the solution to the differential equation— d o oot (ee 1) By =0:y(0)= 1, yO =0 forO) by sollx-] = eani(l, 1, 1, 2)) interpolatingFunction|((0,, Li <>] (xd gol[0.4] sol [0.6] sol[1-1] 0.927686 0.843017 InterpolatingFunction : : dmval : av Input value {1.1} lies outside the range of data in the interpolating function. Extrapolation will be used. More --- 0.512731 data=Tablel{x, sol[x}}, {x, 0, 1, 0.1}]; TableForm[data, TableHeadings — {None, {"x", "Numerical"}}] x Numerical 0 i. 0.1 ' 0.995152 0.2 0.981113 0.3 0.958478 0.4 0.927686 0.5 0.889094 0.6 0.843017 . 0.7 0.78977 0.8 . 0.729692 0.9 0.663172 1. 0.590672 Math Lab-il-4 PS 50 Mathematica (Math Lab-IIl) Plot [sol [x], {x, 0, 1)] Example-17. Solve the differential equation oy 1 +279 with initial condition y(0) = 1,0 InterpolatingFunction[{0. » 1.3, < >] [x]} sol2[x_] = eqn2[[1, 1, 2]]; data = Table[{x, so11[x], so12[x]}, {x, 0, 1, .1}]; Ordinary differential equations 2 51 TableForm|(data, Tableteadings — (None, ("x", “analytic”. opumerioal"))] x analytic numerical 0 1 1, 0.1 1.15817 1.15817 0.2 1.33582 1.33583 03 1.53895 1.53896 0.4 1.77601 1.77602 0.5 2.05935 2.05936 06 . 2.40786 2.40788 0.7 2.85196 2.85199 08 3.44406 3.44411 0.9 4.28301 4.28309 1. 5.58016 5.58031 Plot [{so11[x], so12[x], {x, 0, 1}] of sO Example-18. Plot the five solutions to ay +032 + siny =0 for 0 < x < 20 using initial conditions y’(0) =1, y(0) = - 2,- 1; 0, 1 and 2. Solution : Do[ {sol = NDSolvel{y'' [x] + 0.3y ' [x] + Sinly[x]] ==0, yl0] ==k, y'[0] == 1}, 52 Mathematica (Math Lab-III) yix], (x, 0, 20}]; f[x_] = sol[{1, 1, 2]]; figik] = Plot[f[x], {x, 0, 20}, PlotStyle + Hue[0.2k + .5], DisplayFumction — Identity]}, {k,- 2, 2}] Show [figi- 2], fig I~ 1], figiO], fig(1), figi2J, DisplayFunction > $DisplayFunction, PlotRange All]; Example-19. Solve the differential equation y”” — ey = 0. Solution : DSolve [y" [x] - Exp[x]+y[x] == 0, y[x], x] {{ye > Bessel 0 2 ve c[1] +2 BesselK [o. 2 ve crf Example-20. Solve the nonlinear first order differential equation y’ = y?, y(0) = 1 as.a pure function. Solution : . eqn ={y'[x] == y[x] « 2, y[0] == 1}; sol = DSolvefeqn, y, x] {{y — Function [es, i 1 al} This verifies the solution. eqn /.sol {{True, Ture}} oo ee Ordinary differential equations-2 53 example-21. Solve the nonl inear differential equation +. 1 as a pure function, solution : pSolvely[x]+y' [x] == 1, y, x] {lv “i Function] x) ~ V2 Vx + fi] |. ly > Function] x V2 \x+ cui]! Example-22. Solve nonlinear differential equatin y’ - y” = 0. Solution : pSolvely'[x] - y[x] « 2==0, y[x], x] os 2.5. System of Differential equation : Example-23. Solve the following system of differential equation simultaneously Solution : DSolvel{y[x] ==- z'[x], z[x] ==- y'[x}}, {y, z}, xl {fe — Function [e. sex (1 + e749 C[1] -3 ex(-1+e% cra], yo Function| fx - sex ( 1+e74) C[l] +3 e*(1 +e) craft Example-24. Solve the following system of differential equation y’ - z= 0,2’ + y =0. Solution : DSolve[{y'[x] == z[x], z'[x] ==- yIx], y[0] == 0, z[0] == 1}, {y[xl, z[x]}, x] {{fy[x] — Sin[x], z[x] > cos[x]}} Mathematica (Math Lab-IID Rxampie-36. Solve the following differentia). “alge equation y’ 4 Se’ « dy + 1/x.y +z 1. ty i.e. a mixture of differential and algebraic equations. Solution : DSolvel{y'[x] + 32'[x] «= 4y[x] + 1/x, y[x] + 21x] == 1), {iyi 45 s+ is (- e-2x c{1] - 9e-2x (3e2* + Shctegaltaese ax] > - 5 +B (e-2x C[1] + 9e-?* (3e* + Pxpintegralpie,. Example-26. Solve the following system of different,,. equatins dx ds ~ ©0s t(s) = oy ~ sin t(s) = 0 with initial conditions x(0) = y(O) = t(0) 0 dt ds ~S=0 Solution : DSolvel{x'[s] == Cos|t[s]], y'[s] == Sin[t[s]], t'[s] ==s, _— == 0, y[0] == 0, t[0] == 0}, {x[sI; yIs], t[s]}, s] {{us1 +5 79 xls] > Vn FresnelC a ee yls] > Vn Fresnels fs We 0 CHAPTER-3 ORDINARY DIFFERENTIAL EQUATIONS USING LAPLACE TRANSFORM 3.1, Introduction » The Laplace transform is a powerful tool formulated to golve 4 wide variety of initial-value problems. The strategy is to transform the difficult differential equations into simple algebra problems where solutions can be easily obtained. One then applies the inverse Laplace transform to retrieve the solutions of the original problems. This can be illustrated as follows : . Initial-Value Problems ODE's or PDEs Difficult Very Easy Solutions of Solutions of 3.2. Definition of the Laplace Transform For function f(t) defined on 0 ~. That is, there exist real constants K, a, and T such that "|f(0| T. Note that conditions 1 and 2 are sufficient, but not NECESG Ary for F(s) to exist. The Laplace transform is also very useful in the area of Chrewy, analysis. It is often easier to analyse the circuit in its Lapla,, _ form, than to form differential equations. : The techniques of Laplace transform are not only used {, circuit analysis, but also in ¢ Proportional-Integral-Derivative (PID) controllers e¢ DC motor speed control systems ¢ DC motor position control systems e Second order systems of differential equations (underdamped, overdamped and critically damped) 3.3. Definition of the Inverse Laplace Transform : If the Laplace transform of f(t) is F(s), then we say that the Inverse Laplace Transform of F(s) is f{t). Or, go {F(s)} = f(t) where £7! is called the inverse Laplace Transform Operator. Conditions for the Existence of an Inverse Laplace Transform of F(s) = f(t) (1) lim F{s)=0 s— (2) lim s- F{(s) is finite. S—too DE T'C— Ordinary Differential Equations Using Laplace traneform-3 57 3.4. Table of Laplace qime Function f(t) fy = 7" (Fis) Transtormations Laplace Transform of f(t) o = If) 1 8 8>0 t(unit-ramp function) x 8>0 ¢?(n, a positive integer) a 8>0 at 1 £ s-a °7a @ ginal 4 @2 870 s cos at Fog s>0 t g(t), forn = 1, 2, -.. p ip SS) os j 2@s | t sin ot +07 s> |o| | s2 — @2 tcos at ero hi |o 1 glat) 2) Seate property et g(t) G(s ~ a) Shift property n! et 7, forn = 1, 2, -- Grant s>a -1 1 1 te : +12 > 12 s>- 1 . Le arety 8-7 et sin ot _ 2 s> a (s - a)?.+ 0? © et cos wt ear et s>a u(t) é s>O u(t — a) = s>0O- u(t - a) g(t —a) es G(s) Time-displacement theorem g(t) sG(s) - g(0) gt) s?.G(s)- s+ g0)- gO g(t) s+ G(s) —s™ « gQ) -s"2« gO) - + - gM) 58 Mathematica (Math Lab-III) 3.5. Mathematica Command : * LaplaceTransformlexpr, t, s] gives the Laplace transfy,, of expr. * LaplaceTransformlexpr, (ti, t +}, (81, 82, +H] gives th, multidimensional Laplace transform of expr. * ‘nverseLaplaceTransformlexpr, §, t] gives the invers, ‘ace transform of expr. _ -rseLaplaceTransformlexpr, {S1, $2, }, {ty, t, j . the multidimensional inverse Laplace transform : expr. Section A : Fundamental Examples SOLVED EXAMPLES Example-1. Find the Lapace transform of 1 and 5 ang inverse Laplace transform of the acquired results. Solution : Laplace Transform [{1, 5}, t, s] is Inverse Laplace Transform [%, s, t] {1, 5} Note “Here % means the previous results. Example-2. Find Lit}, L{t?},, L{t3} and inverse Laplace transform of the acquired results. Solution : Laplace Transform [{t, t?, t3}, t, s] 126 a 4 Inverse Laplace Trans form [%,s, t] {t, t2, t3} * Laplace Transform KE", B2t, 2+}, t, s] FO ordinary Differential f Mathone Uainig Lapiane trmnatenrrn 4 vi } \ | Qea'Dan ats’ paplace Tramaforan ((0" + m*", ¢. mat ot sw), ¢, wf fat a) Gamma Ten} | 8 (24a) (2 6 oy gxamplens. Mind b (sina, Lestat, i{sin4at) and inverse Laplace transform of the results gptaineds golution : paplace Transform [(Sin [a +t], Sin{t), Sin (ati), ¢,#! a. 1 4 {as es les 164 a inverse Laplace Transform [%, 8, t] isin{atl, Sin[t], Sin[4t}} taplace Transform |(Cos[a +t], Cos(t], Cos/4t)), t, 6] See ee eee (ea 14s?" 16 ra Laplace Transform [{Sinh[a « t], Sinh([t], Sinh[4t}}, t, 6] a ta (“as s?~ 1+ 8?'= 16+ ah Laplace Transform [{Cosh{a «t], Cosh[t], Cosh[4t]}, t, s] 8 = 8 8 ares 1+s?’- 16 +s? Laplace Transform [{Sin|t], Sinh[t], Cos[t], Cosh(t]}, t, s] Tee eB ee (i +s2'-1+s?'1+s?'-1 al Example-4. Find L {tsint}, L{t® sint}, L{tcost}, L{t® cost} and inverse Laplace transform of the results obtained. Solution : Laplace Transform {t « Sin(t], t? + Sin [t], t + Cos [t], t? + Cos [t]}, ts] 2s 24s(- 1 +82) -1+s? 6(1-6s* +s4) ta +822’ (14x24 ‘(14+s2)?' (1 +s?)4 | : - © Mathematica (Math Lab-IIl) Inverse Laplace Transform [%, 8, t] {t Sin [t}, t8 Sin [t}, t Cos [t], t? cos [t]) Laplace Transform [{t + Sinh [t], t® + Sinh{t], t + Coshiy , Cosh{t}}, ts] ‘ { 2 24(s+s‘) —1+s? 3( 1,1 We 1 +82)? (- 1+ 89)4' 1 + 87)?2°" (CE 1 + 8)4 + 9)) Laplace Transform [{E** + Sin[b + t], E' + Sin[2+t]}, t, 5] b 2 } ja? + b? - 2as + s2'5 -2s + s? Laplace Transform |{E** + Cos[b +t], E‘ + Cos [2+ t]}, t, 5] -ats -l+s rg eerery terre Laplace Transform [{E** +Sinhjb + t], E‘» Sinh[2 +t}, ¢, s] b 2 (aaa eee +s? Laplace Transform [{E** «Cosh [b +t], E'« Cosh[2 + t]}, t, s] -a+s -lt+s (eases +s2’(3+s)(1+5) Laplace Transform [{t + E** + Sin|b +t], t? «E' «Sin [2«t), ts] {. 2b{a - s) 4(- 1-6s + 3s?) { (a? + b? - 2as + s2)2’ (5 - 2s + 82)3 Laplace Transform [{t +E** + Cos [b +t], t2 +E‘ « Cos[2« th}, t, s} a?~b?-2as+s? 2-1 +s) C11-2s + 52) (a2 + b? - 2as + s*)? , (5-25 + s7)5. } Laplace Transform [{t «Et +» Sinh [b +t], t2 + Et « Sinh[2 «t}},t, s] _ 2bt ats) done] (a+b-s)?Cat+bt+s)*—349)3 aa Laplace Transform [{t + E**t « Cosh [b « t], t2 « Et « Cosh[2 « t]}, t,s] . f3( Bog ud 1 1 2\(a + b—s)2 Carbra Cosa isa y- »D » Fs ordinary Differential Equations Using Laplace tranetorm 4 Hh a aratorrn j place Transform (6 Sinhi2y ~ § Coshiay, 6 giniae - 5 ), 81 ¢ 12 __ 58. 12 5s | aes! -4+87'44592 44 49 paplace meeneiorm KE" ~ 3), (Sinit} ~ Cosit})2 }, t, 6] Lave “Iae8 ts: “gee ‘se aol paplace Transform [Sages ah , I. Stall ou { at], | 0 | [a ArcTan [ & | arcTan [Fh S 12s pert FE a EE t EY {a] + Log[b] 4 s s example-5. Using Mathematica do the following. Find taplace transformation of t?, sin zt and et cos t. Solution : Laplace Transform|{t?, Sin[z «t], Explt] + Cos{t]}, t, s] (2, N# Signlz] rtita s?’ s?+2% '24+(245)s Example-6. aang Mathematica find Laplace . Sot transformation of (-D@s1) Solution : 3s+1 Inverse Laplace Transform eae aai +S, t 2et - 2 Cos[t] + Sin[t] Mathematica (Math Lab-I!l) 1 ot ] 4 f s | span —_—— a J Example-7. Evaluate L ts je a L Fe + | and 1 [es x) Solution =| Inverse Laplace Transform {e Sinled Costatl {1 -1 deals 41} 8 | Example-8. Evaluate L fF Ls ya a2 and L (5° hte nts org onl \p=a'eh oa a+ al 6, t| i Solution ; Try yourself as above. _, (38-8 48-24 Example-9. Evaluate L” ) 244 52-16 Solution : Inverse Laplace Transform Gs-8 45-24 | |, s2+4 s?-16’” — 5e4t + eft + 2 Cos[2t] - 4 Sin [2t] 6s -4 } -1 Example-10. Evaluate L {en as 50 4s +20 Solution : . 6s-4 Inverse Laplace Transform E ~ 45+ 20’ Ss, t (3 +i) e2@4it + (3 - i) eit Example-11. Evaluate (i) L {(5e?t — 3)?}, (ii) L{6 sin 2t-5 cos 2t), (iii) L{(sin t - cos t)?} (iv) L{t®-sin t} wm uffSialad 0 J co feel 0 (vii) L{ | * ethics cat} 0 Solution : Try yourself as above. ordinary Differential Equations Using Laplace transform-3 63 yample-12. Evaluate ; L (a8 * far=36| ai) aes + aa a (ii) Lt (s2 ara (iv) i cy s+ Geshe Bit | (v) (s2 + 2s + 2)2 + 2s + 2)2 a (vi) ser (s? + a solution : Try yourself as above. Example—-13. Define the unit step function f(x) = x ifx < 1 and pifx> 1. Also draw the function in the interval [0, 3] eiaaion : “4 f[x_] = UnitStep [1- x] x+ UnitStep [x- rT x2; Plot [flx], {x, O, 3}] OS 64 Mathematica (Math Lab-III) Example-14, Define the unit step function g(t) =1ifO 1. Also draw the function in the interval [0, 3] Solution git.]= UnitStep[1- t] 1+ UnitSteplit- 1) 0; Plot (git), {t, 0, 3}] ae 0.8 0.6 0.4 0.2, Example~15. Define the unit step function f(x) = (x - 1)? if x >2and 0 if0 1, yi! -7 0 {|LaplaceTransform [y(t], t, s} = - =a} ~ “F a2 etti (ll. 1, 2)] ] Inverse LaplaceTransform [tt2, s, t] sin [t] Therefore the requried solution is Y = sint ope wy Example-17. Solve the ODE d2 tY=1l.yO), 2,y@) =o. Solution : Try yourself as above. dy , Example-18. Solve the ODE de ty=tyO=1Ly O=-2. Solution : : eql=y” [t] +ylt] ==t; tl = Laplace Transform [eq1, t, s]; t2= Solve [t1, Laplace Transform [y[t], t, s]] /- {y’ [0] > - 2, y{o} 9}} j 27 5 -s LaplaceTransform [yt], t, s] > - Math Lab-iIK5, 1+s? ~ — 66 Mathematica (Math Lab-III) t3 » t2{[1, 1, 2}) 1 82 1 +s? 2 -s8 Inverse Laplace Transform [t3, 8, t] t + Cos[t] — 3 Sin[t] Example-19. Solve the ODE Zry-tyo-0y¥ O=2 2. (ii) oy Dat, y(0) = 2, y’ 0) =-3 ; . (iii) -3 2 4 2y=0, y(0) = 2, y’ (0) = 1. ay dt? Solution : Try yourself as above. aa Solve the ODE d2 @ G27 3. SY 4 Dy = 4e2, yi) =-3, y"(0)= (ii) FY 3B soy =e, y(0) =2,y’(0)=1. INUH-2013 Solution : @) eq=y” It]- 3y’ It] + 2yit] == 4 Exp [2t); tm = Laplace Transform leq, t, s]; tn = Solve [tm, Laplace Transform ly|tl, t, s]]_/- {y’ [0] > 5, yi0) 7-3} i ; - 14-5 | LaplaceTransform [y[t], t, s] = - — “2-38+82 tp = tn[[1, 1, 2]]; Inverse Laplace Transform [tp, s, t] —et (7 - 4e! (1 + t)) ee ordinary Differentia; Equations t ie La Mare + aretiwrn.2 ¥ a 67 ai) eaey"'ltl-ay OS ae ‘ (EAPC TTANSOrmigg toe se .8)y Solve(tm,Lapig ne “eT ransfoy IVIL. eth 7.ty° ‘ ‘ly (O}-91, qLaplaceTransformiy(t).¢, +2 yiO}—+2) 5 9749 oA 99+ ‘ " * Zyl /(t-B+e) i) epetni{1,1,2)); oon taversehaPlaceTranstormity 0.t] +9 2Iy}-9 @31 example-21. Solve with the help of 1 yd - 4y(0 + Sy(t) = 12542 1/81 (133429 e © 6 tg 29 13 Alyl+27 t yp Aplace transform when y(0) = yy = 6, Solution : eq =y''[tl- 4y'It] + 5y[tj -- 125 t2: tm = Laplace Transformieg, t,s]; t= Solveitm, Laplace Transformly(t], ts ll/. {yi0] + 0, yoy 30} {{LaplaceTransformiytt, t,s] > ae 0 3] = Ss tp=tn[[1, 1, 2]]; Inverse Laplace Transform [tp,s, t] © 22 (11 = 24) eat_ (11 + 2i) ety aoe 4 o542 Example-22. Solve the ODE d (i) ty =sint y0)=0,y’ (0) =2 wy FY dt2 -W <4, (0) =2,y)=-3 ° d’y. . , , (iii) Wyle yo) =3.y (0) =2 a 68 Mathematica (Math Lab- II!) Solution : (i) eq ey''Itl +ylt] == Sinttl; tm = Laplace Transformleq, t, 6]; tn = Solve (tm, Laplace Transformly [tl], t, s]J/. {y[0] + 0, y [0] > 2} 3+ 26" {{LaplaceTransform [y(t], t, s] — (1 + 842 tp =tn[[1, 1, 2]; Inverse Laplace TransformItp, s, t] 3 (— t Cos[t] + 5 SinI{t]) (iii) eq =y''[t] +y'+ylt] ==Exp [t]; tm=Laplace Transform [eq, t, s]; tn=Solve [tm, Laplace Transform[yitl, t, s]] /. {y[0] > 3, y' [0] > 2} -4 2 {[Laptacetransformiyt t, s]> ee tp =tn[[1, 1, 2]] InverseLaplaceTransformltp, s, t] -44+2s+3s? C1+s)(1+s+s%) eet? (2 +8 Cos PS +673 Sin et ‘} esampl a Solve the ODE 1 wy (i) dz Yo 4 5y= et sin t, y(O) = Oy’ (0) =1. Solution : eq = yt] + 2y’ It] + 5ylt] == Exp|[- t] + Sin [4]; tm = Laplace Transform [eq, t, s]; .tn = Solve |tm, Laplace Transform [yit], t, s]] /+{y’10] — 1, yl0l 70}; Ty . Ordinary Differential Equations Using Laplace tranaferm-3 69 ep 2 tn (L, 2, 2) inverse Laplace Transform (tp, », tj 1 -1 "242548 “54 2s+8? . Rien (- Ll -elt + edit, efit) example-24. Solve the ODE Py 4 dy 3-3 +2v=m0. 0) =0,y 0 <0 where f(t) = LifO 0. yi0l — 0}; tp=tni[1, 1, 2]] git_] = Inverse Laplace Transform [tp, s, t] l-es s(2- 3s +s?) ~ (e - e)? UnitStep [+1 + t] + e? (1 + e) UnitStep [t] 2e? Plot(g{t], {t, 0, 3}] 60, 50 40 30 | 20 10 0.5 1 1.5 2 2.5 3 . ( i mp 70 Mathematica (Math Lab-IID) Example-25. Solve the ODE @y dy av ~ dt tY* gd), yO) = 0. yO) = ty where g(t) = 1 ifO st< 1 and tift > 1. Also plot the solution fon (0. 3) Solution : eq =y” [t]- 2y’ [t] + yit] == UnitStep[1- t] + t+ UnitStep [t~ 1), tm = Laplace Transform [eq, t, s]; tn = Solve [tm, Laplace Transform [ylt], t,s]] /- {y’ [0] > 0, yi0) 70}; tp=tn [[1, 1, 2]] h[t_] = Inverse Laplace Transform [tp, s, t] es (1 +e s) (-1+s)?s? 1 7? (- e UnitStep [- 1 + t} + 3rt UnitStep [-1 + t] - et UnitStep [- 1 +t] — ett UnitStep [- 1 + t] - e UnitStep [t] + e!+t UnitStep [t] - e!+t UnitStep [t]) Plot [hit], {t, 0, 3}] 30 . 20 05 1 15 2 25. 3 Lyflereniial F + grees sunt wil wee thes bel i” 4 | ante pirec delta function 4 neti nition® pefinition A8 WME. The Pipa, Hlelta femetwem can nt of as @ rectangul At pulee that growe narrower arid yee" ile simultane ’ tt] ” ey wh aly arirwing larger arel ler grr a rh height + te (an total area « | pectin, B® eee six) = lim(b — 0) rect(x, b) Note that the integral of the delta function is the area under pe curve, and has been held constant at 1 throughout the limst | (x) = 1 3.7. Shifting the origin Just as a parabola can be shifted away from the origin by qniting y = (K- X)* instead of just y = x?, any function can be shifted by plugging in x — Xp in place of its usual argument x. y 8(x - Xo) = Xp Shifting the position of the peak doesn’t affect the total area ifthe integral is taken from —- ~ to ». | Bbx-x9 =1 BO Mathematioa (Math Lab-ft) 4.6. Mathmation command @ DiracDeite (x) represents the Dirac delta function g,, @ Diracdelta [x,, es. «] represents the multidimensiar.. Dirwe delta funetion 6(xy, X. ~) &@ DiracDelta(x) returns 0 for all numeric x other than 9 ® DiracDelta can be used in integrals, integral transfor, | and differential equations. ® Some transformations are done automatically wh, DiracDelta appears in a product of terms. @ DiracDelta [x,,x,+] returns 0 if any of the x, are numer, | and not 0. @ DiracDelta has attribute orderless. Example-26. Find the solution of the ODE a -2 2. : = &(t = 1) using initial conditions y(0) = y’(0) = Solution : eqn =y''[t]- 2y'[t] + y[t] == DiracDeita[t- 1]; tt = Laplace Transform|[eqn, t, s] LaplaceTransformlyIt], t, s] + s? LaplaceTransformiy{t], t, s] — 2(s LaplaceTransform l[y[tl, t, s] - y{0]) — sy[0] - y’[0] == e= tt1 = Solveitt, Laplace Transformly{t], t, sl] /. {y '[0] > 0, yioj > {{LaptaceTransform [y(t], t, s] > cise} (-1+s)? es (~ 1 +s)? sol [t_] = Inverse Laplace Transform [tt2, s, t] e't (1, + t) UnitStep [- 1, t] Wa Ordinary Differential Equations Using Laplace tranaforr-4 73 protisol(tl, (t. 0, 2), PlotStyle— Thickness(0.02}); 25 2 15 1 05 08 1 1.5 2 Example-27. The equation governing the amount of current | flowing through a simple resistance-inductance circuit when an ; dl EMF (voltage) E is applied is L at +RI=E. The units for E, I and L are respectively, volts, amperes and penries. If a direct constant of-1 volt is applied at time t = 0 and removed 1 second later, plot the current in the circuit during the first 2 second. Solution : f[t_] = UnitStep[1 - t]; Plot{f[t], {t, 0, 2}, PlotStyle > Thickness [0.02]; t 0.8 0.6 0.4 0.2 L=1;R= 10; eqn = L+i' [t] + R*ilt] == f[t]; that : Let u(x, s) = Mathematica (Math Lab-III) tt=LaplaceTransform [eqn, t, s] —i[0] + 10 LaplaceTransform [it], t, s] +s LaplaceTrapsformli(t}, t. s)- Rs ttl= Solveltt, LaplaceTansformiilt], t, s]] /.il0] > 0 | eCl+e} |{Laplacetransformlilt t.sl> V0 +9) } tt2= ttl[[1, 1, 2]] //Expand _ i ee ‘ s(10 +s) s(10+s) = = nee AnSGe eevee" s, t] 5 (-e} “70 (1. — e10C1+t) UnitStep[- 1 + t] Plotigitl, {t, 0, 2 , PlotStyle > Thickness[0.02]] 0.1 0.5 1 15 2 Example-28. If U(x, t) is defined in-a- O then sh , ow oe vs i) wu S “axe aw (Fe ee sulk, s) — Ux, 0) (iv) L o Au tes (x, s) - sU(x, 0) - Ux, 0). Solution : . LapalceTransform[U{x, tl, t, s] LaplaceTransform|D[U[x, t], {x, 1}], t, s] LaplaceTransform[UU. 0) [x, t], t, s] , pifferential Ravetions t ane Stig apiare eerransform|D[U(x, t} (, Dy, t, 0 ” / transform[U® Ix. t), a| yarn * ervansformniD(Ulx, Ot, 1), taf aceTransform[U[x, t]. t. 8) = Ux, Of le e par ansform[D[U[x, t), {t, i, ¢, 8} papiacerTransform[UL, tl}, t, 8) ~ eUfx, Oh~ U4 a s du * serefore dx = LaplaceTransform[U".% fy, ¢, ¢, of amd Ue 9 ie 1) [x 0} ¢ _ FU example-29- Solve (i) ae x2’ . Uk, 0) = 3 sin 2am U Ki), 9 = 9g y -owhere 0 <*< 1,t>0. vl. eu w) 5c 73x , Ux, 0) = 10 sin (4ny), U(O, t) = 0, UG, 8 =O [NUH-2013 ee : t= LaplaceTransform|[0,, y U(x, t) == 04, 2) Ux. 4.6% sj /. 73 Sin[27x] : LaplaceTransform[UIx, t], t, s] - 3 Sin[2xx] == Laplace sansform(U2 [x, tl ts] ttl= LaplaceTransform|[U(0O, t] == 0, t, s] LaplaceTransform|[U[O, t], t, s] == tt2= LaplaceTransform[U(1, t] == 0, t, s] LaplaceTransform[U[1, t], t,.s] == 0 tt3 =DSolvel{su[x, s] - 3 Sin[2rx] == u?. 9%) [x, s], ufO, s] == O, u {1,s] == O}, ulx, s], x] {ut s] as | 4n2+s us: tt4= tt3[[1, 1, 2]] 3 Sin(2nx] 4n? +5 ° a re 76 Mathematica (Math Labe-lll) InverseLaplaceTransform(tt4, s, t] Sean Sin[2xx] (it) tt=LaplaceTransform|0{t, 1} U[x, t]==2, 0{x, 2} U[x, t] ,t,s]/.U[x, 01-1108i1n 4, s LaplaceTransform[UIx,t],t.s]-10 Sin[4 mx]==2 LaplaceTransform[U? lx,t),¢,.) ; ttl=LaplaceTransform[U[0,t]==0,t,s] LaplaceTransform[U(0,t],t,s]==0 » tt2=LaplaceTransform[U[5,t]==0,t,s] LaplaceTransform[U[5,t],t,s]==0 tt3=DSolve[{su[x,s]-10Sin[42x]==D[U[x,t], {x,2},t,s],ul0,s]==0,u[5,s]==0},ul[x,s], x) {fulx,s]>(10 Sin[4 x x})/s} 2 Example-30. Solve the partial differential equation ra ~ PY a2 t Y = 16x + 20 + 20sin x subject to the condition Y(x, 0) = 16x 4 12sin 2x - 8 sin 3x, Y(0, t) = 0, Y(n, t) = 16n, Y,(x, 0) = Solution : . tt = LaplaceTransform|[0,, 5) YIx, as 40¢«, 2) YIX, t] + Y[x, t] == + 20Sin[z], t, s] t, sJ- 4 LaplaceTransform[Y?. % [x, t io ~ Y, . 16x + 20 Sin[x] Ix, t], t, s] ~ s¥[x, 0] ~ YO. 0 fx, Q] == LaplaceTransformlYI[x, t], t, s] + s2 LaplaceTransform[Y[x, t] ttl = temp /. {Y©. UK, 0] = 0, Yix, 0) 16x i 7 sient = ( + 12 Sin[2x] - 8 Riese t], t, s] + s2 LaplaceTransform[Y[x t] 1 S}J- , 4 LaplaceTransform[y?. 0) Ix, t], t, s] - s(16x + 12 Sin[2x] - 8Sin[3x)) == 48% + 20 Sint] i inf: x] ee ordinary Thfleqmrt hal Reps ation Using Lagtare trarutere-% 77 we LaplaceTransform[Y|0, tj «« 0,1, @) paplaceTransform{Y]0, {], t, a] ee O ae LaplaceTransform[Yin, tj «= 160, ¢, »| apiaceTransformlYin, t,t, 9} a= 168 4 = DSolvellyix. s| wae et: 8] - 4y2. % (x, «| - fix + 12 gisizel- ~ 8Sin[3x]) =-—— 2 Sinz} 10, 8) == 0, yin, oan S| I ysl // Simplify gyix. 8) (4151629 + 54s? + 84) Sinix] + (5 + 5%) (36? (37 + ©) gin{2x] + 2(17 + 8%) (2(37 + 82) x ~ s? Sin[3x1)))) /(9(3145 . 899s? + 59s* +8%))}} #5 = Apart{[ttAl[1, 1, 2]]] 4(340x + 8887x + 45° + 85Sinix] + 5s’Sinix] + 158’Sin[2x] + 3s*Sin{2x) 8(5 +84 (17 +84 8s Sin[3x] 37 +s? InverseLaplaceTransform[tt5, s, t] A(4x + Sin[x] - Cos[V 5t] Sin[x] + 3Cos[V¥17t] Sin[2x} - acos{V37t] Sin{3x]) Example-31. Solve the ODE a og +y = ft), y(0) = 0, y’(0) = where f(t) = t ifO 1, Also plot the solution for [0, 5] wy *% 2% sy-8yO=0y O- where 6 is dirace delta function. Also plot the solution for [0, 2] —_ 78 Mathematica (Math Lab-III) Wy dy a. = 0, y(0) = 0. (it) Ga at * 9Y = (0), yO) = 0, y (0) where f(t) = sint ifO 1. Also plot the | solution for [0, 3]. Solution : Try yourself as above. Example-32. Solve the system of DE dx aty=t gy 4x + Gt = with initial conditions x (0) = 1, y (0) =- 1. [NUH-2013 Solution : eq ={x’ [t] +y [t] ==t, 4x [t] + y’ [t] == 0}; tm = LaplaceTransform [eq, t, s]; tn = Solve[tm, {LaplaceTransform|[x[t], t, s], LaplaceTransforml[y{tl, t, s])] /+{x[0] — 1, y[0] > - 1} -~l-s-s? {{aptacetransform [x[t], t, s] > ee s(- 4 +s?) 4 + 4s? + 3 LaplaceTransform [ylIt], t, eee. P iit t's) - Sra | tp =tn/{[1, 1, 2] tq = tn[[1, 2, 2]] -1l-s-s? s(- 4 + s2) 4+ 4582 +3 s*(- 4 + 2) InverseLaplaceTransform [tp, s, t] . inverseLaplaceTransform [tq, s, t] 1 gO 2+ 3e% + 7e4) 3e2% 7% 4 q +t PO y ; owdinary Tifferenntiol f Cpiations Uaing Laptase treneter 7 gxample-33. Solve the System of NF aX , y = sint si dy stat with initial conditions x(0) = 0, y(0) = 0. solution : eq = {x It] +y [t] ==Sin [t], x[t}+y’ ft] == 4); tm = LaplaceTransform [eq, t, s]; . tn = Solveltm, {LaplaceTransform{x{tl, t, s], taplaceTransform l[y|tl, t, s}}]/- {x[0] > 0, y[0] > 0}; tp=tni[1, 1, 2]] tq = tn[[1, 2, 2]] 1 1 1 8\s7T+e 3? 1-s? 1/1 s l+s? 1-s? InverseLaplaceTransform [tp, s, t] InverseLaplaceTransform [tq,s, t] t+ (Bet-et-2 Cos [t]) th 443et4et+2Sin It) BS 80 Mathematica (Math LabelIl) dx Example-34, Solve the system gq, +y*tsint x mA * bev, with the initial conditions x(0) = y(0) = 0. Solution : DSolvel{x' [t] + ylt] == t » Sin[t], x[t] + y' [t] == t+ Cos/t], x[0] =« ¢ y[0] == 0}, {xIt], yIt]}, t]. {[sta = i et 1+ e%- 2et SinIt]), ylt] > - ; et (1 + et — 2t' Cost] - 4et sint)]] Another way J eg={x' It] +ylt] == t+ Sintt), xt] +y' It == t+ Cosit); tm = LaplaceTransform[eq, t, s]; tn = Solve[tm, {LaplaceTransform[x[t], t, s], ’ LaplaceTransformly|t], t, s}}]/. {x[0] — 0, y[0] > 0}; tp = t[[1, 1, 2] tq = tn{[1, 2, 2]] 1 (- 1 +s?) (1+ 8s?) 3s - s?. ~€14s%) (1 +82) InverseLaplaceTransform|Itp, s, t] InverseLaplaceTransform|tq, s, t] ; (-et+et-2Sin{t) z (- et — et + 2 Cos[t] + 4t Sin[t}) eeneeeeiieniaetinainas: Qt ten OB. Solve the avalon « gran tye ch a axel qx ‘ al ave » ‘ a’ _« vet nt aan tt gritial conditions x(O) © x(0) 6 0. y (Oj ey («0 solution | oq 0 (x [th +y “(th +x It] == 5, y(t) - 2x’ ft} + yit == th; pm « LaplaceTransform leq, t, s}; in = Solveltm, (MaplaceTransform{xit), t,s], LaplaceTransform ryitl t, sI}/+{x10] > 9, x’10] > 0, yio} 5 0, y’ [0] 5 0}; tp = tall, 1, 2)); tq=tn (U1, 2, 2)); InverseLaplaceTransform [tp, s, t] InverseLaplaceTransform{tq, s, t] -8 VS + (3 + 4 V3) Cos (V2 - N34 9 + 4V9) cos (V2 + V3 2V3 12(0+2Vat-VaeW8us+7 Va om WaTdSt +(11 V6 - 3 ¥3+21 V2 - V3) Sin [V2 + V3 t) Example-36. Using Mathematica solve the following differential equations : 1 ~6+473 dx atty= t 4x + 0; x(0) = 1, yO) = Solution : DSolvel{x' [t] + y[t] == t, 4x[t] +y'[t] == 0, x[0] == 1, y [0] ==-1)}, {xit], yitl}, t] 1 {[xty 3 et (3 — Qe" + Ze), y[t] > -3 et (-3 + 7Ze# — 4ert of} i Math Labii-6 , bein 82 Mathematica (Math Lab-II]) Example-37. Solve the system of DE ax . dy ate tat *9x= 15e d? dx Sa 4 ge + Sy = 15 sin 2t with initial conditions x(0) = 35, x’ (0) = - 48, ¥(0) S4 y’@=-55 — 2) Solution : Try yourself as above. Put the solution

You might also like