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

  • #1
Robaj
13
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
  • #2
Why don't you solve
[tex]y'+y=2,y(0)=0[/tex]?
 
  • Like
Likes Robaj
  • #3
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 [itex]t < 1[/itex] the upper limit of the first integral is not [itex]1[/itex] but [itex]t[/itex]. The second integral vanishes whatever the value of [itex]t[/itex].
 
  • Like
Likes Robaj
  • #4
anuttarasammyak said:
Why don't you solve
[tex]y'+y=2,y(0)=0[/tex]?
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##.
 
  • #5
pasmith said:
If [itex]t < 1[/itex] the upper limit of the first integral is not [itex]1[/itex] but [itex]t[/itex]. The second integral vanishes whatever the value of [itex]t[/itex].

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.
 
  • #6
I guess the question is: how can I get to ##y(t)=2(e-1)e^{-t}## when ##g(t)=0##?
 
  • #7
Solving
[tex]y'+y=c[/tex]
[tex]y=ae^{-t}+c[/tex]
From below to t=1 together with y(t=0)=0
[tex]y=-2e^{-t}+2=-2e^{-1}+2[/tex]
From above to t=1
[tex]y=ae^{-t}=ae^{-1}[/tex]
So that they equal
[tex](a+2)e^{-1}=2[/tex]
 
  • #8
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 [itex]y' + y = 0[/itex] then [itex](e^{t}y)' = 0[/itex]. Integrating you find [tex]
e^t y(t) - e^1 y(1) = 0[/tex] ie. [itex]y(t) = y(1) e^{1-t}[/itex].

Alternatively, from [itex]y'/y = -1[/itex] it follows that [tex]
\int_{y(1)}^{y(t)} \frac1u\,du = \int_1^t(-1)\,ds[/tex] and hence [itex]\ln|y(t)| - \ln|y(1)| = 1 - t[/itex] as expected.
 
  • Like
Likes Robaj
  • #9
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:[tex] Y(s) = \frac{2}{s(s +1)} \left( 1 - e^{-s} \right) [/tex]
where the second term in the bracket ## e^{-s} ## is a time-shift. Then we can use partial fractions to get:
[tex] Y(s) = \left(\frac{2}{s} - \frac{2}{s+1}\right) \left( 1- e^{-s} \right) [/tex]
Then we can take the inverse Laplace transform, by applying some basic time-shift rules, to get:
[tex] y(t) = 2u(t)(1 - e^{-t}) - 2u(t - 1) \left( 1 - e^{-(t - 1)} \right) [/tex]
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.
 
Back
Top