Solve En­gi­neer­ing Prob­lems with Laplace Trans­forms

Laplace trans­forms are in­te­gral math­e­mat­i­cal trans­forms widely used in physics and en­gi­neer­ing. In this 21st ar­ti­cle in the se­ries on math­e­mat­ics in open source, the au­thor demon­strates Laplace trans­forms through Max­ima.

OpenSource For You - - FOR U & ME LET'S TRY -

In higher math­e­mat­ics, trans­forms play an im­por­tant role. A trans­form is math­e­mat­i­cal logic to trans­form or con­vert a math­e­mat­i­cal ex­pres­sion into another math­e­mat­i­cal ex­pres­sion, typ­i­cally from one do­main to another. Laplace and Fourier are two very common ex­am­ples, trans­form­ing from the time do­main to the fre­quency do­main. In gen­eral, such trans­forms have their cor­re­spond­ing in­verse trans­forms. And this com­bi­na­tion of di­rect and in­verse trans­forms is very pow­er­ful in solv­ing many real life en­gi­neer­ing prob­lems. The fo­cus of this ar­ti­cle is Laplace and its in­verse trans­form, along with some prob­lem-solv­ing in­sights.

The Laplace trans­form

Math­e­mat­i­cally, the Laplace trans­form F(s) of a func­tion f(t) is de­fined as fol­lows:

…where ‘t’ rep­re­sents time and ‘s’ rep­re­sents com­plex an­gu­lar fre­quency.

To demon­strate it, let’s take a sim­ple ex­am­ple of f(t) = 1. Sub­sti­tut­ing and in­te­grat­ing, we get F(s) = 1/s. Max­ima has the func­tion laplace() to do the same. In fact, with that, we can choose to let our vari­ables ‘t’ and ‘s’ be any­thing else as well. But, as per our math­e­mat­i­cal no­ta­tions, pre­serv­ing them as ‘t’ and ‘s’ would be the most ap­pro­pri­ate. Let’s start with some ba­sic Laplace trans­forms. (Note that string() has been used to just flat­ten the ex­pres­sion.) $ max­ima -q

(%i1) string(laplace(1, t, s)); (%o1) 1/s

(%i2) string(laplace(t, t, s));

(%o2) 1/s^2

(%i3) string(laplace(t^2, t, s));

(%o3) 2/s^3

(%i4) string(laplace(t+1, t, s));

(%o4) 1/s+1/s^2

(%i5) string(laplace(t^n, t, s));

Is n + 1 pos­i­tive, neg­a­tive, or zero? p; /* Our in­put */

(%o5) gamma(n+1)*s^(-n-1)

(%i6) string(laplace(t^n, t, s));

Is n + 1 pos­i­tive, neg­a­tive, or zero? n; /* Our in­put */

(%o6) gam­ma_in­com­plete(n+1,0)*s^(-n-1)

(%i7) string(laplace(t^n, t, s));

Is n + 1 pos­i­tive, neg­a­tive, or zero? z; /* Our in­put, mak­ing it non-solv­able */

(%o7) ‘laplace(t^n,t,s)

(%i8) string(laplace(1/t, t, s)); /* Non-solv­able */

(%o8) ‘laplace(1/t,t,s) (%i9) string(laplace(1/t^2, t, s)); /* Non-solv­able */

(%o9) ‘laplace(1/t^2,t,s)

(%i10) quit();

In the above ex­am­ples, the ex­pres­sion is pre­served as is, in case of non-solv­abil­ity.

laplace() is de­signed to un­der­stand var­i­ous sym­bolic func­tions, such as sin(), cos(), sinh(), cosh(), log(), exp(), delta(), erf(). delta() is the Dirac delta func­tion, and erf() is the er­ror func­tion—oth­ers be­ing the usual math­e­mat­i­cal func­tions. $ max­ima -q

(%i1) string(laplace(sin(t), t, s));

(%o1) 1/(s^2+1)

(%i2) string(laplace(sin(w*t), t, s));

(%o2) w/(w^2+s^2)

(%i3) string(laplace(cos(t), t, s));

(%o3) s/(s^2+1)

(%i4) string(laplace(cos(w*t), t, s));

(%o4) s/(w^2+s^2)

(%i5) string(laplace(sinh(t), t, s));

(%o5) 1/(s^2-1)

(%i6) string(laplace(sinh(w*t), t, s));

(%o6) -w/(w^2-s^2)

(%i7) string(laplace(cosh(t), t, s));

(%o7) s/(s^2-1)

(%i8) string(laplace(cosh(w*t), t, s));

(%o8) -s/(w^2-s^2)

(%i9) string(laplace(log(t), t, s));

(%o9) (-log(s)-%gamma)/s

(%i10) string(laplace(exp(t), t, s));

(%o10) 1/(s-1)

(%i11) string(laplace(delta(t), t, s));

(%o11) 1 (%i12) string(laplace(erf(t), t, s));

(%o12) %e^(s^2/4)*(1-erf(s/2))/s

(%i13) quit();

In­ter­pret­ing the trans­form

A Laplace trans­form is typ­i­cally a frac­tional ex­pres­sion con­sist­ing of a nu­mer­a­tor and a de­nom­i­na­tor. Solv­ing the de­nom­i­na­tor, by equat­ing it to zero, gives the var­i­ous com­plex fre­quen­cies as­so­ci­ated with the orig­i­nal func­tion. Th­ese are called the poles of the func­tion. For ex­am­ple, the Laplace trans­form of sin(w * t) is w/(s^2 + w^2), where the de­nom­i­na­tor is s^2 + w^2. Equat­ing that to zero and solv­ing it, gives the com­plex fre­quency s = +iw, -iw; thus, in­di­cat­ing that the fre­quency of the orig­i­nal ex­pres­sion sin(w * t) is ‘w’, which in­deed it is. Here are a few demon­stra­tions of the same:

$ max­ima -q

(%i1) string(laplace(sin(w*t), t, s));

(%o1) w/(w^2+s^2)

(%i2) string(de­nom(laplace(sin(w*t), t, s))); /* The De­nom­i­na­tor */

(%o2) w^2+s^2

(%i3) string(solve(de­nom(laplace(sin(w*t), t, s)), s)); /* The Poles */

(%o3) [s = -%i*w,s = %i*w]

(%i4) string(solve(de­nom(laplace(sinh(w*t), t, s)), s)); (%o4) [s = -w,s = w]

(%i5) string(solve(de­nom(laplace(cos(w*t), t, s)), s));

(%o5) [s = -%i*w,s = %i*w]

(%i6) string(solve(de­nom(laplace(cosh(w*t), t, s)), s));

(%o6) [s = -w,s = w]

(%i7) string(solve(de­nom(laplace(exp(w*t), t, s)), s));

(%o7) [s = w]

(%i8) string(solve(de­nom(laplace(log(w*t), t, s)), s));

(%o8) [s = 0]

(%i9) string(solve(de­nom(laplace(delta(w*t), t, s)), s));

(%o9) []

(%i10) string(solve(de­nom(laplace(erf(w*t), t, s)), s));

(%o10) [s = 0]

(%i11) quit();

In­volved Laplace trans­forms

laplace() also un­der­stands de­riv­a­tive() / diff(), in­te­grate(), sum(), and ilt() - the in­verse Laplace trans­form. Here are some in­ter­est­ing trans­forms show­ing the same:

$ max­ima -q

(%i1) laplace(f(t), t, s);

(%o1) laplace(f(t), t, s)

(%i2) string(laplace(de­riv­a­tive(f(t), t), t, s));

(%o2) s*’laplace(f(t),t,s)-f(0)

(%i3) string(laplace(in­te­grate(f(x), x, 0, t), t, s));

(%o3) ‘laplace(f(t),t,s)/s

(%i4) string(laplace(de­riv­a­tive(sin(t), t), t, s));

(%o4) s/(s^2+1)

(%i5) string(laplace(in­te­grate(sin(t), t), t, s));

(%o5) -s/(s^2+1)

(%i6) string(sum(t^i, i, 0, 5));

(%o6) t^5+t^4+t^3+t^2+t+1

(%i7) string(laplace(sum(t^i, i, 0, 5), t, s));

(%o7) 1/s+1/s^2+2/s^3+6/s^4+24/s^5+120/s^6

(%i8) string(laplace(ilt(1/s, s, t), t, s));

(%o8) 1/s

(%i9) quit();

Note the us­age of ilt() - in­verse Laplace trans­form in the %i8 of the above ex­am­ple. Call­ing laplace() and ilt() one after the other can­cels their ef­fect—that is what is meant by in­verse. Let’s look into some common in­verse Laplace trans­forms.

In­verse Laplace trans­forms

$ max­ima -q

(%i1) string(ilt(1/s, s, t));

(%o1) 1

(%i2) string(ilt(1/s^2, s, t));

(%o2) t

(%i3) string(ilt(1/s^3, s, t));

(%o3) t^2/2

(%i4) string(ilt(1/s^4, s, t));

(%o4) t^3/6

(%i5) string(ilt(1/s^5, s, t));

(%o5) t^4/24

(%i6) string(ilt(1/s^10, s, t));

(%o6) t^9/362880

(%i7) string(ilt(1/s^100, s, t));

(%o7) t^99/933262154439441526816992388562667004907159682643816 21468592963895217599993229915608941463976156518286253697920827 2237582511852109168640000000000000000000000 (%i8) string(ilt(1/(s-a), s, t));

(%o8) %e^(a*t)

(%i9) string(ilt(1/(s^2-a^2), s, t));

(%o9) %e^(a*t)/(2*a)-%e^-(a*t)/(2*a)

(%i10) string(ilt(s/(s^2-a^2), s, t));

(%o10) %e^(a*t)/2+%e^-(a*t)/2

(%i11) string(ilt(1/(s^2+a^2), s, t));

Is a zero or nonzero? n; /* Our in­put */

(%o11) sin(a*t)/a

(%i12) string(ilt(s/(s^2+a^2), s, t));

Is a zero or nonzero? n; /* Our in­put */

(%o12) cos(a*t)

(%i13) as­sume(a < 0) or as­sume(a > 0)$

(%i14) string(ilt(1/(s^2+a^2), s, t));

(%o14) sin(a*t)/a

(%i15) string(ilt(s/(s^2+a^2), s, t));

(%o15) cos(a*t)

(%i16) string(ilt((s^2+s+1)/(s^3+s^2+s+1), s, t));

(%o16) sin(t)/2+cos(t)/2+%e^-t/2

(%i17) string(laplace(sin(t)/2+cos(t)/2+%e^-t/2, t, s));

(%o17) s/(2*(s^2+1))+1/(2*(s^2+1))+1/(2*(s+1))

(%i18) string(rat(laplace(sin(t)/2+cos(t)/2+%e^-t/2, t, s)));

(%o18) (s^2+s+1)/(s^3+s^2+s+1)

(%i19) quit();

Ob­serve that if we take the Laplace trans­form of the above %o out­puts, they would give back the ex­pres­sions, which are in­put to ilt() of the cor­re­spond­ing %i’s. %i18 specif­i­cally shows one such ex­am­ple. It does laplace() of the out­put at %o16, giv­ing back the ex­pres­sion, which was in­put to ilt() of %i16.

Solv­ing dif­fer­en­tial and in­te­gral equa­tions

Now, with th­ese in­sights, we can eas­ily solve many in­ter­est­ing and oth­er­wise com­plex prob­lems. One of them is solv­ing dif­fer­en­tial equa­tions. Let’s ex­plore a sim­ple ex­am­ple of solv­ing f’(t) + f(t) = e^t, where f(0) = 0. First, let’s take the Laplace trans­form of the equa­tion. Then sub­sti­tute the value for f(0), and sim­plify to ob­tain the Laplace of f(t), i.e., F(s). Fi­nally, com­pute the in­verse Laplace trans­form of F(s) to get the so­lu­tion for f(t).

$ max­ima -q

(%i1) string(laplace(diff(f(t), t) + f(t) = exp(t), t, s));

(%o1) s*’laplace(f(t),t,s)+’laplace(f(t),t,s)-f(0) = 1/(s-1)

Sub­sti­tut­ing f(0) as 0, and then sim­pli­fy­ing, we get laplace(f(t),t,s) = 1/((s-1)*(s+1)), for which we do an in­verse Laplace trans­form:

(%i2) string(ilt(1/((s-1)*(s+1)), s, t));

(%o2) %e^t/2-%e^-t/2

(%i3) quit();

That gives us f(t) = (e^t – e^-t) / 2, i.e., sinh(t), which def­i­nitely sat­is­fies the given dif­fer­en­tial equa­tion.

Sim­i­larly, we can solve equa­tions with in­te­grals. And not just in­te­grals, but also equa­tions with both dif­fer­en­tials and in­te­grals. Such equa­tions come up very of­ten when solv­ing prob­lems linked to elec­tri­cal cir­cuits with re­sis­tors, ca­pac­i­tors and in­duc­tors. Let’s again look at a sim­ple ex­am­ple that demon­strates the fact. Let’s as­sume we have a 1 ohm re­sis­tor, a 1 farad ca­pac­i­tor, and a 1 henry in­duc­tor in se­ries be­ing pow­ered by a si­nu­soidal volt­age source of fre­quency ‘w’. What would be the cur­rent in the cir­cuit, as­sum­ing it to be zero at t = 0? It would yield the fol­low­ing equa­tion: R * i(t) + 1/C * ∫ i(t) dt + L * di(t)/dt = sin(w*t), where R = 1, C = 1, L =1.

So, the equa­tion can be sim­pli­fied to i(t) + ∫ i(t) dt + di(t)/ dt = sin(w*t). Now, fol­low­ing the pro­ce­dure as de­scribed above, let’s carry out the fol­low­ing steps:

$ max­ima -q

(%i1) string(laplace(i(t) + in­te­grate(i(x), x, 0, t) + diff(i(t), t) = sin(w*t), t, s));

(%o1) s*’laplace(i(t),t,s)+’laplace(i(t),t,s)/ s+’laplace(i(t),t,s)-i(0) = w/(w^2+s^2)

Sub­sti­tut­ing i(0) as 0, and sim­pli­fy­ing, we get laplace(i(t), t, s) = w/((w^2+s^2)*(s+1/s+1)). Solv­ing that by in­verse Laplace trans­form, we very eas­ily get the com­plex ex­pres­sion for i(t) as fol­lows:

(%i2) string(ilt(w/((w^2+s^2)*(s+1/s+1)), s, t));

Is w zero or nonzero? n; /* Our in­put: Non-zero fre­quency */

(%o2) w^2*sin(t*w)/(w^4-w^2+1)-(w^3-w)*cos(t*w)/(w^4-w^2+1)+%e^(t/2)*(sin(sqrt(3)*t/2)*(-(w^3-w)/(w^4-w^2+1)-2*w/(w^4-w^2+1))/ sqrt(3)+cos(sqrt(3)*t/2)*(w^3-w)/(w^4-w^2+1))

(%i3) quit();

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.