# Thread: how to solve this

1. ## how to solve this

find the continuous solution of $\displaystyle \frac{dy}{dx}+y=g(x), 0<x<\infty, y(0)=2$ where $\displaystyle g(x)=3, 0<x<\frac{\pi}{2}$
$\displaystyle =\cos x, x\geq\frac{\pi}{2}$

for the first part, i got $\displaystyle -ln(3-y)=x$. but how can i solve it for the second part?

2. Solving for $\displaystyle y$ in the first part of your solution yields

$\displaystyle y=3-e^{-x}.$

We get $\displaystyle y(\pi/2)=3-e^{-\pi/2}.$ This is the initial condition for the next region's DE.

So now you're solving $\displaystyle y'(x)+y(x)=\cos(x),$ subject to $\displaystyle y(\pi/2)=3-e^{-\pi/2}.$ Ideas?

3. unfortunately, no. i have done solving algebraic equation subject to some constraint, but not differential equation. How to do this?

4. Hmm. I suggest you take a look at Chris's DE tutorial. You can find the technique you need there.

5. Originally Posted by Ackbeet
Solving for $\displaystyle y$ in the first part of your solution yields

$\displaystyle y=3-e^{-x}.$

We get $\displaystyle y(\pi/2)=3-e^{-\pi/2}.$ This is the initial condition for the next region's DE.

So now you're solving $\displaystyle y'(x)+y(x)=\cos(x),$ subject to $\displaystyle y(\pi/2)=3-e^{-\pi/2}.$ Ideas?
The solution You proposed is not properly adequate because the 'queue' of the y(x) due to the 'head' of g(x) doesn't vanish for x>3. The best approach to a problem of this type is the Laplace Transform...

Kind regards

$\displaystyle \chi$ $\displaystyle \sigma$

6. solving by integrating factor, i got $\displaystyle ye^x=\frac{e^x(\sin x + \cos x)}{2} + C$
from the condition given in question, i am getting C=4.

7. solving by integrating factor, i got $\displaystyle ye^x=\frac{e^x(\sin x + \cos x)}{2} + C$
from the condition given in question, i am getting C=4.

I'm not following you. What do you mean by "queue" and "head"? I would agree that the LT is a very convenient method of solution for this problem (non-homogeneous IVP's, especially with respect to piece-wise defined functions). However, as Sambit appears not to be familiar with DE's in general, I think the problem is more basic than that.

I would argue that the way I've set the problem up, you will theoretically get a continuous solution on the desired interval. I mean, the initial condition for the region x >= 3 is as I've given, correct?

Good so far. What next?

10. as you said, $\displaystyle y(\pi/2)$ should be equal to $\displaystyle 3-e^{-\pi/2}$ but it does not hold here.

11. ...but it does not hold here...
Why not? Are there no values of C which can make that happen? Incidentally, in post # 6, I was confused by your assertion that C = 4. How did you arrive at that? Is there a part of the problem statement that you haven't posted?

12. in my question, i have $\displaystyle y(0)=2$. What does this mean? i think it means at x=0, y is 2. or am i wrong?

13. Right, but you've already found the solution for the region 0 < x < pi/2. You're now finding a solution for pi/2 < x < infty. You'll have a piece-wise defined solution, just like you have a piece-wise defined RHS of the DE. Therefore, the condition y(0) = 2 does not apply to the piece you're trying to find now.

14. so am i now to find a value of C such that $\displaystyle y(\pi/2)=3-e^{-\pi/2}.$ holds?

15. is $\displaystyle C=6-2e^{-\pi/2}$?

Page 1 of 2 12 Last