# Solving a first order differential equation with initial conditions

• arhzz
In summary, the conversation discusses solving a given ODE with initial conditions using Wolfram Alpha. The solution obtained is verified to be correct and then plugged back into the ODE to get a final solution. However, there is a small error in the calculation which results in a different solution than what Wolfram Alpha gives. The error is corrected and the result matches with that of Wolfram Alpha.

#### arhzz

Homework Statement
Solve the equation
Relevant Equations
-
Hello!

Consider this ODE;

$$x' = sin(t) (x+2)$$ with initial conditions x(0) = 1;

Now I've solved it and according to wolfram alpha it is correct (I got the homogenous and the particular solution)

$$x = c * e^{-cos(t)} -2$$ and now I wanted to plug in the initial conditions and this is how i did it;

$$1 = c * e^{-cos(0)} -2$$ now we can rewrite that as ## 1 = \frac{c}{e} -2 ## and now we want c we multiply by e

$$e = c -2$$ c should be c = e +2

Now I plug that back into my x

$$x = e + 2 * e^{-cos(t)} -2$$ and I get ## x = e * e^{-cos(t)} ##

Now wolfram alpha is giving me a diffrent result; ## x = 3e^{-cos(t)+1} -2 ##

I don't see how they get to this? I am not sure if I am doing something wrong,could it be that wolfram alpha is not really solving the ODE I input?

Thanks!

arhzz said:
Consider this ODE;
$$x' = sin(t) (x+2)$$ with initial conditions x(0) = 1
Now I've solved it and according to wolfram alpha it is correct (I got the homogenous and the particular solution)
$$x = c * e^{-cos(t)} -2$$ and now I wanted to plug in the initial conditions and this is how i did it;

$$1 = c * e^{-cos(0)} -2$$ now we can rewrite that as ## 1 = \frac{c}{e} -2 ## and now we want c we multiply by e

$$e = c -2$$ c should be c = e +2
You forgot to multiply the last term on the right side by e.
arhzz said:
Now I plug that back into my x

$$x = e + 2 * e^{-cos(t)} -2$$ and I get ## x = e * e^{-cos(t)} ##

Now wolfram alpha is giving me a diffrent result; ## x = 3e^{-cos(t)+1} -2 ##

I don't see how they get to this? I am not sure if I am doing something wrong,could it be that wolfram alpha is not really solving the ODE I input?

Thanks!
I get the same result as Wolfram.

bob012345
Mark44 said:
You forgot to multiply the last term on the right side by e.

I get the same result as Wolfram.
Yea I get it too now,my bad.Thanks for pointing the error out.Cheers