Previous Up Next

12.4.2 Laplace transform

Denoting by L the Laplace transform, you get the following:

     
  L(y)(x)
=
+∞


0
exuy(u)du
         
L−1(g)(x)
=
1
2iπ
 


C
ezxg(z) dz
         

where C is a closed contour enclosing the poles of g.

The laplace command finds the Laplace transform of a function.

The ilaplace or invlaplace command finds the inverse Laplace transform of a function.

You also can use the addtable command Laplacians of unspecified functions (see Section 19.4.3). The Laplace transform has the following properties:

     
  L(y′)(x)=−y(0)+xL(y)(x)         
L(y′′)(x)=−y′(0)+xL(y′)(x)         
 =−y′(0)−xy(0)+x2L(y)(x)          

These properties make the Laplace transform and inverse Laplace transform useful for solving linear differential equations with constant coefficients. For example, suppose you have

     
 y′′ +py′ +qy=f(x)         
 y(0)=a,  y′(0)=b          

then

     
  L(f)(x)=L(y′′+py′+qy)(x)          
 =−y′(0)−xy(0)+x2L(y)(x)−py(0)+pxL(y)(x))+qL(y)(x)          
 =(x2+px+q) L(y)(x)−y′(0)−(x+p) y(0)          

Therefore, if a=y(0) and b=y′(0), you get

  L(f)(x)=(x2+px+q)L(y)(x)−(x+p) ab

and the solution of the differential equation is:

  y(x)=L−1


L(f)(x)+(x+p) a +b
x2+px+q



.

Examples

laplace(sin(x))
     
1
x2+1
          

With t as the original variable:

laplace(sin(t),t)
     
1
t2+1
          

With t as the original variable and s as the transform variable:

L:=laplace(sin(t),t,s)
     
1
s2+1
          

Apply the inverse transform to obtain the original function:

ilaplace(L,s,t)
     
sint           

Solve y′′ −6 y′+9 y=x e3 x, y(0)=c0, y′(0)=c1. Here, p=−6 and q=9.

laplace(x*exp(3*x))
     
1
x2−6 x+9
          
ilaplace((1/(x^2-6*x+9)+(x-6)*c_0+c_1)/(x^2-6*x+9))
     
1
6

x3−18 xc0+6 xc1+6 c0
e3 x
          

Note that this equation could be solved directly:

desolve(y''-6*y'+9*y=x*exp(3*x),y)
     
e3 x
c0x+c1
+
1
6
x3e3 x
          

Applications

Laplace transform is useful in analysis of eletric circuits. A simple RL circuit is shown in Figure 12.1. Given the input voltage Vin, the problem is to find the current I(t). From Kirchhoff laws:

VL+VR=LI′(t)+RI(t)=Vin. 

By transforming both sides of the above equation and assuming I(0)=0, you get

LsL(I)(s)+RL(I)(s)=L(Vin)(s), 

from which follows

I(t)=L−1


L(Vin)(s)
Ls+R



. 

Figure 12.1: RL circuit (source)

Let Vin(t)=V0sin(ω t). You find I(t) by entering:

assume(omega>0):; I:=ilaplace(laplace(V0*sin(omega*t),t,s)/(L*s+R),s,t):; factor(I)
     


−ω Lcos
ω t
+ω Le
Rt
L
 
+Rsin
ω t


V0
R2+L2 ω2
          

Let now Vin be a single rectangular pulse Vin={

V0,0≤ t≤ 1,
0,t>1.

. It is easily defined by using the boxcar command (see Section 19.1.1):

Vin:=V0*boxcar(0,1,t):; I:=ilaplace(laplace(Vin,t,s)/(L*s+R),s,t):; normal(piecewise(I))
     








V0e
Rt
L
 
+V0
R
,
1>t
V0e
Rt
L
 
+V0e
RtR
L
 
R
,
otherwise
          

Laplace transform can be used with arbitrary periodic functions. For example, Let Vin=V0(1−(t−1)2) for t∈[0,2] define a periodic function with period T=2.

Vin:=V0*periodic(1-(t-1)^2,t=0..2):; I:=ilaplace(laplace(Vin,t,s)/(L*s+R),s,t)
     



2 L
R+L
e
R


t−2 


t
2






L
 
+4 R2


t
2






t


t
2



−1


t
t−2
R2−4 R


t
2



L+2 L
RtRL



V0
R3
          

Subexpressions in the above result are factored manually for a more readable presentation. Xcas computes this result by using symbolic periodic summation.

Applying the above technique to more complex circuits involving resistors, capacitors and inductors is straightforward; contour analysis by Kirchhoff laws produces a system of linear differential equations which is transformed to a system of linear equations by Laplace transform. From there, it is easy to find transforms of contour currents.


Previous Up Next