Find a continuous solution to an ODE that includes a step function

Click For Summary
The discussion focuses on solving a non-homogeneous first-order ordinary differential equation (ODE) with a step function as the forcing term. The initial solution for the case when t > 1 is derived using an integrating factor, resulting in y(t) = 2(e-1)e^{-t}. Participants clarify that for the interval 0 ≤ t ≤ 1, the upper limit of the integral should be t instead of 1, leading to the correct solution y(t) = 2(1-e^{-t}). The conversation also touches on using Laplace transforms as an alternative method to derive the solution, emphasizing the simplicity provided by zero initial conditions. This approach confirms the continuity of the solution across the defined intervals.
Robaj
Messages
13
Reaction score
3
Homework Statement
Find a continuous solution of the initial value problem ##y'+y=g(t)##, ##y(0)=0## where $$g(t)=\begin{cases}
2, & 0\le t \le 1 \\
0, & t \gt 1
\end{cases}$$

This is Ex. 17 from Braun's Differential Equations and Their Applications. I can get the answer for the second case but not the first.
Relevant Equations
The answer is given as
$$y(t)=\begin{cases}
2(1-e^{-t}),&\, 0\le t \le 1 \\
2(e-1)e^{-t},& \, t \gt 1
\end{cases}
$$
Non-homegenous first order ODE so start with an integrating factor ##\mu##
$$\mu=\textrm{exp}\left(\int a dt\right)=e^t.$$
Then rewrite the original equation as
$$\frac{d}{dt}\mu y = \mu g(t).$$
Using definite integrals and splitting the integration across the two cases,
$$\begin{align} ye^t-0e^0 &= \int_0^1 2e^s ds + \int_1^t 0e^s ds\\
ye^t &= 2\left[e^s\right]_0^1+0\left[e^s\right]_1^t \\
ye^t &= 2e^1-2 \\
y(t) &= 2(e-1)e^{-t}.\end{align}$$

This is Braun's answer for the case ##t \gt 1##. How can I get the solution for ##0\le t \le 1##? Have I done something wrong with the second definite integral (integrating 0)?

Thanks.
 
Physics news on Phys.org
Why don't you solve
y'+y=2,y(0)=0?
 
  • Like
Likes Robaj
Robaj said:
Homework Statement:: Find a continuous solution of the initial value problem ##y'+y=g(t)##, ##y(0)=0## where $$g(t)=\begin{cases}
2, & 0\le t \le 1 \\
0, & t \gt 1
\end{cases}$$

This is Ex. 17 from Braun's Differential Equations and Their Applications. I can get the answer for the second case but not the first.
Relevant Equations:: The answer is given as
$$y(t)=\begin{cases}
2(1-e^{-t}),&\, 0\le t \le 1 \\
2(e-1)e^{-t},& \, t \gt 1
\end{cases}
$$

Non-homegenous first order ODE so start with an integrating factor ##\mu##
$$\mu=\textrm{exp}\left(\int a dt\right)=e^t.$$
Then rewrite the original equation as
$$\frac{d}{dt}\mu y = \mu g(t).$$
Using definite integrals and splitting the integration across the two cases,
$$\begin{align} ye^t-0e^0 &= \int_0^1 2e^s ds + \int_1^t 0e^s ds\\
ye^t &= 2\left[e^s\right]_0^1+0\left[e^s\right]_1^t \\
ye^t &= 2e^1-2 \\
y(t) &= 2(e-1)e^{-t}.\end{align}$$

This is Braun's answer for the case ##t \gt 1##. How can I get the solution for ##0\le t \le 1##? Have I done something wrong with the second definite integral (integrating 0)?

Thanks.

If t < 1 the upper limit of the first integral is not 1 but t. The second integral vanishes whatever the value of t.
 
  • Like
Likes Robaj
anuttarasammyak said:
Why don't you solve
y'+y=2,y(0)=0?
Thanks, this gives me the result for ##0\le t\le 1##, although now I'm not sure about the case for ##t\gt 1##.
 
pasmith said:
If t < 1 the upper limit of the first integral is not 1 but t. The second integral vanishes whatever the value of t.

Thanks for pointing out my mistake. How can I solve for ##y(t)## when ##g(t)=0## if the second integral always vanishes?

If ##g(t)=0## then
$$
\begin{align}
\frac{y'}{y} &= -1\\
\ln y &= -\int_1^t 0e^s ds +c = 0
\end{align}
$$
Perhaps I'm confusing the integration limits with the initial conditions.
 
I guess the question is: how can I get to ##y(t)=2(e-1)e^{-t}## when ##g(t)=0##?
 
Solving
y'+y=c
y=ae^{-t}+c
From below to t=1 together with y(t=0)=0
y=-2e^{-t}+2=-2e^{-1}+2
From above to t=1
y=ae^{-t}=ae^{-1}
So that they equal
(a+2)e^{-1}=2
 
Robaj said:
Thanks for pointing out my mistake. How can I solve for ##y(t)## when ##g(t)=0## if the second integral always vanishes?

If ##g(t)=0## then
$$
\begin{align}
\frac{y'}{y} &= -1\\
\ln y &= -\int_1^t 0e^s ds +c = 0
\end{align}
$$
Perhaps I'm confusing the integration limits with the initial conditions.

Definite integrals do not result in arbitrary constants.

If y&#039; + y = 0 then (e^{t}y)&#039; = 0. Integrating you find <br /> e^t y(t) - e^1 y(1) = 0 ie. y(t) = y(1) e^{1-t}.

Alternatively, from y&#039;/y = -1 it follows that <br /> \int_{y(1)}^{y(t)} \frac1u\,du = \int_1^t(-1)\,ds and hence \ln|y(t)| - \ln|y(1)| = 1 - t as expected.
 
  • Like
Likes Robaj
Thanks both, it seems trivial in hindsight!
 
  • #10
Hi,

I know this has been solved now but just thought it was worth pointing out that perhaps Laplace transforms help to get the full solution as well. Also, we have zero initial conditions, which makes the algebra even easier.

For example, we can take the Laplace transform of the differential equation to get:Y(s) = \frac{2}{s(s +1)} \left( 1 - e^{-s} \right)
where the second term in the bracket ## e^{-s} ## is a time-shift. Then we can use partial fractions to get:
Y(s) = \left(\frac{2}{s} - \frac{2}{s+1}\right) \left( 1- e^{-s} \right)
Then we can take the inverse Laplace transform, by applying some basic time-shift rules, to get:
y(t) = 2u(t)(1 - e^{-t}) - 2u(t - 1) \left( 1 - e^{-(t - 1)} \right)
where ## u(t - a) ## is the step function and is 0 for ## t < a ##. I think the expression simplifies to the required solutions.

Hope that made some sense. Could use this as a way to check a solution.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
1K
Replies
6
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
Replies
8
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
Replies
2
Views
1K
Replies
12
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K