Solving ODE with Laplace transform

In summary: I made a sign error earlier. So my Laplace transform should be##\mathscr{L}\left(f(t)\right) = \frac{1+e^{\pi s}}{(z^2+1)(z+1)}##Now I need to convolute this with ##\frac{e^{-t}}{2}## which I get when I take inverse Laplace transform of ##\frac{1}{z+1}##. This gives me##x(t) = \int_{-\infty}^\infty \left( e^{y-t}\frac{1+e^{y+\pi}}{2}\right)dy = \frac{e^{-t
  • #1
Incand
334
47

Homework Statement


Let
##f(t)=
\begin{cases}
\sin t , \; \; 0 \le t < \pi \\
0 , \; \; \; \; \; \text{else.}
\end{cases}##
Use Laplace transform to solve the initial value problem
##x'(t)+x(t)=f(t), \; \; \; x(0)=0.##

Homework Equations


Some useful Laplace transforms:
##\mathscr{L}\left(f'(t)\right) = z\mathscr{L}\left(f(z)\right)-f(0)##
##\mathscr{L}\left(H(t-a)f(t-a)\right) = e^{-az}\mathscr{L}\left(f(z) \right)##
for ##a >0## and ##H(t)## is the Heaviside function. (i.e. we shift the function)
##\mathscr{L}\left( \sin ct\right) = \frac{c}{z^2+c^2}##
##\mathscr{L}\left(t^ve^{ct}\right) = \frac{\Gamma (v+1)}{(z-c)^{v+1}}##
for ##v > -1## and ##\Gamma## is the gamma function.

The Attempt at a Solution


We write ##f(t) = (H(t)-H(t-\pi))\sin t##. Transforming the ODE we get
##z\mathscr{L}\left(x(t)\right)-x(0)+\mathscr{L}\left(x(t)\right)=\mathscr{L}\left(f(t)\right) ##
Rearranging (We don't actually need compute the Laplace transform here I think as long as we're convinced it does exist.)
##\mathscr{L}\left( x(t) \right) = \frac{1}{z+1}\mathscr{L}\left(f(t)\right)##
Taking the inverse Laplace transform we have
##x(t) = (e^{-t})*((H(t)-H(t-\pi)\sin t)##
Computing the convolution we have
##x(t) = \int_{-\infty}^\infty \left(e^{y-t}(H(-y)-H(-y+\pi)\sin -y \right)dy = \int_{-\infty}^0 -e^{y-t}\sin y dy + \int_{-\infty}^\pi e^{y-t}\sin y dy = \frac{e^{-t}}{2} + \frac{e^{-t}+\pi}{2} = \frac{e^{-t}}{2}(1+e^{\pi})##

Not entirely sure what I'm doing wrong here. The solution should be
##x(t) = \begin{cases}
\frac{e^{-t}-\cos t + \sin t}{2} \; \; t < 0 < \pi\\
\frac{e^{-t}}{2}(1+e^{\pi}) \; \; t > \pi
\end{cases}##
The solution for ##t > \pi## looks suspiciously alike to my solution.

On the other hand if we calculate the Laplace transform earlier we have
##\mathscr{L}\left( H(t-\pi)\sin(t) \right) = \mathscr{L}\left( -H(t-\pi)\sin(t-\pi) \right) = \frac{-e^{\pi z}}{z^2+1}## so we have
##\mathscr{L}\left( f(t) \right) = \frac{1-e^{\pi z}}{(z^2+1)(z+1)}##
Interesting enough the first part ##\frac{1}{(z^2+1)(z+1)}## has the Inverse Laplace transform
##\frac{e^{-t}-\cos t + \sin t}{2}## which also looks similar.

I kept out most of the integral calculations to make the post a bit shorter, they're all pretty much integration by parts twice. I also checked them with wolfram alpha to make sure they're correct.
 
Last edited:
Physics news on Phys.org
  • #2
I see something wrong in the second step.

You want to solve:

$$x' + x = [u(t) - u(t - \pi)] sin(t), \quad x(0) = 0$$

When you take the Laplace transform of both sides you should get:

$$sX(s) - x(0) + X(s) = \mathscr{L} \{ u(t) sin(t) \} - \mathscr{L} \{ u(t - \pi) sin(t) \}$$

Cleaning things up a bit:

$$X(s) [s + 1] = \frac{1}{s^2 + 1} - \mathscr{L} \{ u(t - \pi) sin([t - \pi] + \pi) \}$$

Now use the identity ##\sin(A + B) = \sin(A) \cos(B) + \sin(B) + \cos(A)## to find the remaining Laplace transform. You will also have to make use of the fact ##\sin(A - B) = \sin(A) \cos(B) - \sin(B) + \cos(A)## along the way.
 
  • Like
Likes Incand
  • #3
Zondrina said:
Cleaning things up a bit:
$$X(s) [s + 1] = \frac{1}{s^2 + 1} - \mathscr{L} \{ u(t - \pi) sin([t - \pi] + \pi) \}$$
Now use the identity ##\sin(A + B) = \sin(A) \cos(B) + \sin(B) + \cos(A)## to find the remaining Laplace transform. You will also have to make use of the fact ##\sin(A - B) = \sin(A) \cos(B) - \sin(B) + \cos(A)## along the way.
Sorry I interchanged ##f## and ##x## in some places, also I made a sign error. Was there a larger error? When you say second step is that second line or the equation below that?

I guess you misstyped in an extra plus-sign in the identities here. As far as I can tell using those identities they only tell me that ##\sin (x\pm \pi ) = -\sin (x\pm \pi)## if I'm supposed to use them right away. I still end up with the same Laplace transform
##(s+1)X(s) = \frac{1}{s^2+1}+\mathscr{L}[u(t-\pi)\sin (t-\pi) = \frac{1}{s^2+1}+\frac{e^{-\pi s}}{s^2+1}##
which give us
##X(s) = \frac{1+e^{-\pi s}}{(z^2+1)(z+1)}##.
Is it correct this far or this wasn't what you meant? I had a sign error here earlier.
 
  • #4
Incand said:

Homework Statement


Let
##f(t)=
\begin{cases}
\sin t , \; \; 0 \le t < \pi \\
0 , \; \; \; \; \; \text{else.}
\end{cases}##
Use Laplace transform to solve the initial value problem
##x'(t)+x(t)=f(t), \; \; \; x(0)=0.##

Homework Equations


Some useful Laplace transforms:
##\mathscr{L}\left(f'(t)\right) = z\mathscr{L}\left(f(z)\right)-f(0)##
##\mathscr{L}\left(H(t-a)f(t-a)\right) = e^{-az}\mathscr{L}\left(f(z) \right)##
for ##a >0## and ##H(t)## is the Heaviside function. (i.e. we shift the function)
##\mathscr{L}\left( \sin ct\right) = \frac{c}{z^2+c^2}##
##\mathscr{L}\left(t^ve^{ct}\right) = \frac{\Gamma (v+1)}{(z-c)^{v+1}}##
for ##v > -1## and ##\Gamma## is the gamma function.

The Attempt at a Solution


We write ##f(t) = (H(t)-H(t-\pi))\sin t##. Transforming the ODE we get
##z\mathscr{L}\left(x(t)\right)-x(0)+\mathscr{L}\left(x(t)\right)=\mathscr{L}\left(f(t)\right) ##
Rearranging (We don't actually need compute the Laplace transform here I think as long as we're convinced it does exist.)
##\mathscr{L}\left( x(t) \right) = \frac{1}{z+1}\mathscr{L}\left(f(t)\right)##
Taking the inverse Laplace transform we have
##x(t) = (e^{-t})*((H(t)-H(t-\pi)\sin t)##
Computing the convolution we have
##x(t) = \int_{-\infty}^\infty \left(e^{y-t}(H(-y)-H(-y+\pi)\sin -y \right)dy = \int_{-\infty}^0 -e^{y-t}\sin y dy + \int_{-\infty}^\pi e^{y-t}\sin y dy = \frac{e^{-t}}{2} + \frac{e^{-t}+\pi}{2} = \frac{e^{-t}}{2}(1+e^{\pi})##

Not entirely sure what I'm doing wrong here. The solution should be
##x(t) = \begin{cases}
\frac{e^{-t}-\cos t + \sin t}{2} \; \; t < 0 < \pi\\
\frac{e^{-t}}{2}(1+e^{\pi}) \; \; t > \pi
\end{cases}##
The solution for ##t > \pi## looks suspiciously alike to my solution.

On the other hand if we calculate the Laplace transform earlier we have
##\mathscr{L}\left( H(t-\pi)\sin(t) \right) = \mathscr{L}\left( -H(t-\pi)\sin(t-\pi) \right) = \frac{-e^{\pi z}}{z^2+1}## so we have
##\mathscr{L}\left( f(t) \right) = \frac{1-e^{\pi z}}{(z^2+1)(z+1)}##
Interesting enough the first part ##\frac{1}{(z^2+1)(z+1)}## has the Inverse Laplace transform
##\frac{e^{-t}-\cos t + \sin t}{2}## which also looks similar.

I kept out most of the integral calculations to make the post a bit shorter, they're all pretty much integration by parts twice. I also checked them with wolfram alpha to make sure they're correct.

You should have
[tex] \mathscr{L}\left( f(t) \right) = \frac{1\; {\large \bf +} \; e^{\pi z}}{(z^2+1)(z+1)} [/tex]
 
  • Like
Likes Incand
  • #5
Ray Vickson said:
You should have
[tex] \mathscr{L}\left( f(t) \right) = \frac{1\; {\large \bf +} \; e^{\pi z}}{(z^2+1)(z+1)} [/tex]
Love the large plus sign! I think this was what zondrina pointed out earlier as well and I fixed in the next post. I however believe it should be ##e^{\Huge{-}\pi z}##.
I got it now. Here's the rest of the solution:
##\mathscr{L}\frac{1+e^{-\pi t}}{(z+1)(z^2+1)} = \frac{e^{-t}-\cos t+\sin t}{2}+ H(t-\pi )\frac{e^{-t+\pi}+\cos x - \sin x}{2}##
which is equal too the answer for the intervals! Thanks both of you!
 
  • #6
Just a small error I see in the solution. You should have:

$$X(s) = \frac{1 + e^{- \pi s}}{(s+1) (s^2 + 1)}$$

From here a partial fraction expansion will yield ##x(t)##.
 
  • Like
Likes Incand
  • #7
Zondrina said:
Just a small error I see in the solution. You should have:

$$X(s) = \frac{1 + e^{- \pi s}}{(s+1) (s^2 + 1)}$$

From here a partial fraction expansion will yield ##x(t)##.
Yea I typed the wrong variable (again). Partial fractions is a really cool way of doing it. I didn't think of that. It however seems like quite a lot of work. I tried it now but after juggling 9 different variables in my ansatz for 15 min I just decided to be happy with the solution I already did.
How I did it was using that the Laplace transform of the convolution of two functions is the product of two functions. You end up with a really simple integral that way since the heaviside functions actually make it easier. In the end all you have to compute is ##e^{-t}\int_0^t e^y\sin y dy## which can be done with integration by parts twice. The integrating limits follow directly from the heaviside functions.
 
Last edited:
  • #8
Incand said:
Partial fractions is a really cool way of doing it. I didn't think of that. It however seems like quite a lot of work. I tried it now but after juggling 9 different variables in my ansatz for 15 min I just decided to be happy with the solution I already did.

The partial fraction method is arguably one of the fastest. You should try it for some simple cases just to get used to setting up the equations.

The convolution theorem can be useful, but it is also time consuming. Two integration by parts probably take longer on average than solving a few linear equations, but choose whichever method you prefer.
 
  • Like
Likes Incand

1. What is the Laplace transform and why is it useful in solving ODEs?

The Laplace transform is a mathematical tool used to solve differential equations, including ordinary differential equations (ODEs). It transforms a time-domain function into a frequency-domain function, making it easier to solve the equation using algebraic methods. This is useful in solving ODEs because it can reduce complex problems into simpler ones, making it easier to find solutions.

2. How do you use the Laplace transform to solve an ODE?

To solve an ODE using the Laplace transform, you first need to take the Laplace transform of both sides of the equation. This will result in a new equation in terms of the transformed function. Then, you can use algebraic methods to solve for the transformed function. Finally, you can take the inverse Laplace transform to obtain the solution in the time-domain.

3. Can the Laplace transform be used to solve any type of ODE?

No, the Laplace transform can only be used to solve linear ODEs with constant coefficients. It cannot be applied to non-linear equations or equations with variable coefficients.

4. What are the advantages and disadvantages of using the Laplace transform to solve ODEs?

The advantages of using the Laplace transform include its ability to solve complex ODEs, its effectiveness in reducing the problem to simpler ones, and its usefulness in solving initial value problems. However, its main disadvantage is that it can only be applied to a limited set of equations and it may not always yield an analytical solution.

5. Are there any tips for using the Laplace transform to solve ODEs more efficiently?

Yes, some tips for using the Laplace transform more efficiently include choosing an appropriate initial value for the transformed function, using partial fraction decomposition to simplify the equation, and using tables or software to calculate the inverse Laplace transform. It is also important to carefully check the solution for any mistakes or errors.

Similar threads

  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
732
  • Calculus and Beyond Homework Help
Replies
16
Views
474
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
1
Views
491
  • Calculus and Beyond Homework Help
Replies
3
Views
353
  • Calculus and Beyond Homework Help
Replies
1
Views
94
  • Calculus and Beyond Homework Help
Replies
1
Views
597
  • Calculus and Beyond Homework Help
Replies
10
Views
1K
  • Calculus and Beyond Homework Help
Replies
7
Views
710
Back
Top