So I am supposed to solve this differential equation in maple:

$\displaystyle 2*y'+x*y=2$

where y(0)=c and c is a real number.

However, I have no idea how to solve this equation in general. What would be the best method for this?

Printable View

- Feb 6th 2011, 11:33 AMshaunthepandaSolving a Differential
So I am supposed to solve this differential equation in maple:

$\displaystyle 2*y'+x*y=2$

where y(0)=c and c is a real number.

However, I have no idea how to solve this equation in general. What would be the best method for this? - Feb 6th 2011, 11:40 AMTheEmptySet
- Feb 6th 2011, 11:49 AMshaunthepanda
That is actually what I tried intially, but the thing is that I end up with an imaginary number when I put it in maple... Here is what I get:

$\displaystyle

y(x) = (-I*sqrt(Pi)*erf((1/2*I)*x)+1)*exp(-(1/4)*x^2)$ - Feb 6th 2011, 12:16 PMTheEmptySet
hmmm so the equation is

$\displaystyle \displaystyle y'+\frac{x}{2}y=1$ so the integrating factor is

$\displaystyle \displaystyle I(x)=e^{\int \frac{x}{2}dx}=e^{\frac{x^2}{4}}$

Multiplying the ODE by this gives

$\displaystyle e^{\frac{x^2}{4}}y' + \frac{x}{2}e^{\frac{x^2}{4}}y=e^{\frac{x^2}{4}}$

Using the product rule backwards gives

$\displaystyle \displaystyle \frac{d}{dx}\left[ e^{\frac{x^2}{4}}y\right]= e^{\frac{x^2}{4}} \iff e^{\frac{x^2}{4}}y=\int_{0}^{x} e^{\frac{t^2}{4}}dt+C$

$\displaystyle y(x)=Ce^{\frac{-x^2}{4}}+e^{\frac{-x^2}{4}}\int_{0}^{x} e^{\frac{t^2}{4}}dt$

You can check by taking the derivative that this satisfies the ODE.

P.S the error function

$\displaystyle \displaystyle erf(x)=\frac{2}{\sqrt{\pi}}\int_{0}^{x}e^{-t^2}dt$

I don't know what maple is giving you a complex part of the erf function. - Feb 6th 2011, 12:33 PMTheEmptySet
So I just learned something new.

$\displaystyle \displaystyle erf\left( \frac{i}{2}x\right)=\frac{2}{\sqrt{\pi}} \int_{0}^{\frac{i}{2}x} e^{-t^2}dt$

Now let $\displaystyle \displaystyle u=\frac{2t}{i} \implies du=\frac{2}{i}dt$

This gives

$\displaystyle \displaystyle \frac{2}{\sqrt{\pi}}\int_{0}^{\frac{i}{2}x} e^{-t^2}dt =\frac{i}{\sqrt{\pi}} \int_{0}^{x}e^{\frac{u^2}{4}}du $

So we can use this to rewrite the previous solution.

$\displaystyle \displaystyle y(x)=Ce^{\frac{-x^2}{4}}+e^{\frac{-x^2}{4}}\int_{0}^{x} e^{\frac{t^2}{4}}dt=Ce^{\frac{-x^2}{4}}+e^{\frac{-x^2}{4}} \left( i \sqrt{\pi} erf\left( \frac{i}{2}x\right)\right)= \left [C+ i \sqrt{\pi} erf\left( \frac{i}{2}x\right)\right] e^{\frac{-x^2}{4}}$

This is how maple chose to write the solution.