PDA

View Full Version : First Order ODE Question...


bsodmike
Dec2-08, 12:24 PM
1. The problem statement, all variables and given/known data

y' = -y + sin(t)

2. Relevant equations

y' = \dfrac{dy}{dt} = f(t,y)

3. The attempt at a solution

The solution should be, according to my text book, as follows,
y(t)= \dfrac{3}{2}e^{-t}+\dfrac{1}{2}\left({sin(t)-cos(t)}\right)

I have looked at the various 'typical' forms of ODEs and cannot seem to find one for this particular case. My problem here is in recognising the ODE form, even if I put it as:

\dfrac{dy}{dt}+y= sin(t)

would I have to use something like,

y(t)=e^{-t}\left[Ae^{it}+Be^{-it}\right]

I am quite rusty with ODEs and would greatly appreciate anyone willing to walk me through this one.

This question was also posted here (http://www.physicsforums.com/showthread.php?t=276427), but I thought I'd shift it to the right place, especially since I am quite stuck on this one.

Thanks
Mike

heshbon
Dec2-08, 12:42 PM
Try writing sin(t) in its exponential form...ie Sin(t)= [e^(it) - e(-it)]/2i

bsodmike
Dec2-08, 01:02 PM
\dfrac{dy}{dt}+y=\dfrac{1}{2i}\left(e^{it}-e^{-it}\right)

Should I use an Integrating Factor to solve the Linear ODE?, i.e.

y'+p(t)y=q(t)

and use an integrating factor \mu(t)=e^{\int{p(t)dt}}

\mu(t)\left[y'+p(t)y\right]=\mu(t)q(t)

\left(\mu(t)y\right)'=\mu(t)q(t)

\mu(t)y=\int{\mu(t)q(t)dt+C}

...and divide through by \mu(t) ???

Going back to the beginning,
\dfrac{dy}{dt}+y=sin(t)

In this case, p(t)=1 and q(t)=sin(t),

Therefore, \mu(t)=e^t

and,

e^ty=\int{e^tsin^tdt+C} would be the solution? sin(t) can be further substituted with it's exponential form if needed?

Dick
Dec2-08, 04:01 PM
That's one way to do it. The other way is to solve the homogeneous problem dy/dt+y=0 and note that the solutions are C*exp(-t). You now want a solution to the inhomogeneous problem (a particular solution). Substitute a trial solution of A(t)*exp(-t) into the ODE and integrate the result to find A(t). This is called variation of parameters. But you'll get an expression much like the one you've already got. You are actually almost done. Now you just have to integrate e^t*sin(t).

bsodmike
Dec2-08, 04:05 PM
You are actually almost done. Now you just have to integrate e^t*sin(t).

Thanks Dick :) I take it this would be a simple matter of integration by parts, i.e.
\int{u}\,dv=uv-\int{v}\,du

I seem to be getting a run away expansion going on here:
\int{e^tsin(t)\,dt}=\int{f(t)g(t)dt}

Let,
\begin{cases} u=g(t) = sin(t)\\
dv=f(x)\,dx=e^t
\end{cases}

Hence,
\begin{cases} du=g'(t) = cos(t)\\
v=\int{f(x)\,dx}=e^t
\end{cases}

Therefore,
\int{e^tsin(t)\,dt}=e^tsin(t)-\int{e^tcos(t)\,dt} + C

The second integral goes onto become,
\int{e^tcos(t)\,dt}=e^tcos(t)+\int{e^tsin(t)\,dt} + C

Any ideas?

Dick
Dec2-08, 05:17 PM
Sure! Substitute the second expression for the integral of e^t*cos(t) into the first. Now you have two integrals of e^t*sin(t). Move them to the same side of the equation and solve.

bsodmike
Dec2-08, 07:03 PM
Move them to the same side of the equation and solve.

How come the \dfrac{3}{2}e^{-t} is missing?!? Constant of integration or some initial values?

Thanks a lot Dick for all your help, this has been bugging me quite a bit :p (I hate giving up...)

This is the second integral (as obtained previously),
\int{e^tcos(t)\,dt}=e^tcos(t)+\int{e^tsin(t)\,dt} + C

Substitute it into the first integral obtained by the integration by parts, for
\int{e^tsin(t)\,dt}=e^tsin(t)-\left[e^tcos(t)+\int{e^tsin(t)\,dt} + C\right] + C

Further simplification yields,
\int{e^tsin(t)\,dt}=\dfrac{1}{2}e^t\left(sin(t)-cos(t)\right)+C

Substituting back, gives,
e^ty=\dfrac{1}{2}e^t\left(sin(t)-cos(t)\right)+C

y=\dfrac{1}{2}\left(sin(t)-cos(t)\right)+\dfrac{C}{e^t}=\dfrac{1}{2}\left(sin (t)-cos(t)\right)+Ce^{-t}

Dick
Dec2-08, 09:37 PM
The correct general solution is y(t)=(1/2)*(sin(t)-cos(t))+C*e^(-t). That's what happens to the C in your solution. If they gave an answer where C=(3/2) then they must have given you an initial value.

bsodmike
Dec2-08, 09:38 PM
Dick, I just figured it out!! Am updating my tex solutions to include Ce^(-t)...thanks!!!

bsodmike
Dec2-08, 09:50 PM
y=\dfrac{1}{2}\left(sin(t)-cos(t)\right)+Ce^{-t}

The initial value is y(0) = 1, therefore,

1=\dfrac{1}{2}\left(0-1\right)+C\cdot1

C=1+\dfrac{1}{2}=\dfrac{3}{2}

Hence, we finally arrive at the solution,
y=\dfrac{3}{2}e^{-t}+\dfrac{1}{2}\left(sin(t)-cos(t)\right)

Dick
Dec2-08, 09:51 PM
Well done.

bsodmike
Dec2-08, 11:25 PM
Thanks a lot Dick. I have completed my Masters (technically), although I was ill for about two months as I contracted an inner ear infection. Short version: I was granted a replacement exam for one that was missed in January ~ Adv. Numerical Methods.

This question was really good practice for 'remembering' to solve ODEs analytically rather than completely being 'spoilt' by MATLAB/SIMULINK.

All the best,
Mike

Dick
Dec2-08, 11:28 PM
Good luck. I think you'll have it. You are actually pretty good at this stuff.