### 2.53.2 Laplace transform and inverse Laplace transform : `laplace ilaplace`

`laplace` and `ilaplace` takes one, two or three arguments : an expression and optionnaly the name(s) of the variable(s).
The expression is an expression of the current variable (here x) or an expression of the variable given as second argument.
`laplace` returns the Laplace transform of the expression given as argument and `ilaplace` the inverse Laplace transform of the expression given as argument. The result of `laplace` and `ilaplace` is expressed in terms of the variable given as third argument if supplied or second argument if supplied or x otherwise.

Laplace transform (`laplace`) and inverse Laplace transform (`ilaplace`) are useful to solve linear differential equations with constant coefficients. For example :

y ′ ′ +p. y ′+q. y = f(x)

y(0)=a, y′(0)=b

Denoting by L the Laplace transform, the following relations hold :

L(y)(x) | = |
∫ |
+∞
0
| e−x.uy(u)du
L−1(g)(x) | = |
1
2iπ
| ∫ |
C
| ez.xg(z)dz

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

`laplace(sin(x))`

The expression (here sin(x)) is an expression of the current variable (here x) and the answer will also be an expression of the current variable x.
Output :

`1/((-x)```^```2+1)`

Or input :

`laplace(sin(t),t)`

here the variable name is t and this name is also used in the answer.
Output :

`1/((-t)```^```2+1)`

Or input :

`laplace(sin(t),t,s)`

here the variable name is t and the variable name of the answer is s.
Output:

`1/((-s)```^```2+1)`

The following properties hold :

L(y′)(x) | = | −y(0)+x.L(y)(x)
L(y″)(x) | = | −y′(0)+x.L(y′)(x)
| = | −y′(0)−x.y(0)+x2.L(y)(x)

If y ′ ′(x) +p. y ′(x)+q. y(x) = f(x), then :

L(f)(x) | = | L(y″+p.y′+q.y)(x)
| = | −y′(0)−x.y(0)+x2.L(y)(x)−p.y(0)+p.x.L(y)(x))+q.L(y)(x)
| = | (x2+p.x+q).L(y)(x)−y′(0)−(x+p).y(0)

Therefore, if a=y(0) et b=y′(0), we have

L(f)(x)=(x2+p.x+q).L(y)(x)−(x+p).a−b

and the solution of the differential equation is :

y(x)= L−1((L(f)(x)+(x+p).a +b)/(x2+p.x+q))

Example :
Solve :

y′ ′ −6. y′+9. y = x. e3. x, y(0)=c_0, y′(0)=c_1

Here, p=−6, q=9.
Input :

`laplace(x*exp(3*x))`

Output :

`1/(x```^```2-6*x+9)`

Input :

`ilaplace((1/(x```^```2-6*x+9)+(x-6)*c_0+c_1)/(x```^```2-6*x+9))`

Output :

`(216*x```^```3-3888*x*c_0+1296*x*c_1+1296*c_0)*exp(3*x)/1296`

After simplification and factorisation (`factor` command) the solution y is :

`(-18*c_0*x+6*c_0+x```^```3+6*x*c_1)*exp(3*x)/6`

Note that this equation could be solved directly, input :

`desolve(y’’-6*y’+9*y=x*exp(3*x),y)`

Output :

`exp(3*x)*(-18*c_0*x+6*c_0+x```^```3+6*x*c_1)/6`