Solving ODE with Laplace transform

Click For Summary

Homework Help Overview

The discussion revolves around solving an initial value problem involving a first-order ordinary differential equation (ODE) using the Laplace transform. The specific equation is given by x'(t) + x(t) = f(t), where f(t) is defined piecewise as sin(t) for 0 ≤ t < π and 0 otherwise, with the initial condition x(0) = 0.

Discussion Character

  • Mixed

Approaches and Questions Raised

  • Participants explore the application of the Laplace transform to the given ODE, discussing the transformation of both sides of the equation and the implications of using the Heaviside function to define f(t).
  • Some participants question the correctness of the transformations and the resulting expressions, particularly regarding the handling of the Heaviside function and the convolution integral.
  • There are attempts to clarify the steps involved in deriving the Laplace transform of f(t) and the subsequent algebraic manipulations.
  • Discrepancies in the expressions for the Laplace transform and the inverse Laplace transform are noted, prompting further examination of the calculations and identities used.

Discussion Status

The discussion is ongoing, with participants actively identifying potential errors and clarifying steps in the solution process. Some guidance has been offered regarding the use of identities for sine functions and the implications of the Heaviside function, but no consensus has been reached on the final form of the solution.

Contextual Notes

Participants are working under the constraints of the homework problem, which requires the use of Laplace transforms and does not allow for direct solutions to be provided. There are indications of confusion regarding specific algebraic manipulations and the interpretation of the piecewise function.

Incand
Messages
334
Reaction score
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
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   Reactions: Incand
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.
 
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
\mathscr{L}\left( f(t) \right) = \frac{1\; {\large \bf +} \; e^{\pi z}}{(z^2+1)(z+1)}
 
  • Like
Likes   Reactions: Incand
Ray Vickson said:
You should have
\mathscr{L}\left( f(t) \right) = \frac{1\; {\large \bf +} \; e^{\pi z}}{(z^2+1)(z+1)}
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!
 
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   Reactions: Incand
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:
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   Reactions: Incand

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 16 ·
Replies
16
Views
2K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
3
Views
2K