Differential equation with non-elementary function

201 Views Asked by At

Can a solution be found to the following differential equation: $$ \dfrac {dy}{dx}=e^{-x^2}$$ given the initial conditions $y(0) = c$ - some constant? I know that $y(x)$ is a non-elementary function but could a solution be obtained numerically?

2

There are 2 best solutions below

0
On

$$\dfrac {dy}{dx}=e^{-x^2}\iff y(x)=\int \:e^{-x^2}dx$$

where $y(x)=\frac{\sqrt{\pi }}{2}\text{erf}\left(x\right)+k, \, k\in \mathbb R$. Being a Cauchy problem with the initial condition $y(0) = c \ $ you can to find the value of $k$.

Remember that $\operatorname{erf}(x)$ the error function (also called Gauss error function):

$$\operatorname{erf}(x)= \frac{2}{\sqrt{\pi}}\sum_{n=0}^\infty\frac{(-1)^n x^{2n+1}}{(2n+1)n!} =\frac{2}{\sqrt{\pi}} \left(x-\frac{x^3}{3}+\frac{x^5}{10}-\frac{x^7}{42}+\frac{x^9}{216}-\ \cdots\right)$$

0
On

The solution is $$y=c+\frac{\sqrt{\pi }}{2} \text{erf}(x)$$ If you cannot use the error function, you could use, as an approximation, $$\text{erf}(x)\sim \sqrt{1-\exp\Big(-\frac 4 {\pi}\,\frac{1+\alpha x^2}{1+\beta x^2}\,x^2 \Big)}$$ where $$\alpha=\frac{10-\pi ^2}{5 (\pi -3) \pi }\qquad \text{and} \qquad\beta=\frac{120-60 \pi +7 \pi ^2}{15 (\pi -3) \pi }$$ or much better (just made for you) $$\text{erf}(x)\sim \sqrt{1-\exp\Big(-\frac 4 {\pi}\,\frac{1+\frac{509 }{4044}x^2+\frac{391 }{29717}x^4}{1+\frac{505 }{3239}x^2+\frac{35 }{2306}x^4}\,x^2 \Big)}$$ I have the exact expression of the coefficients but they are really messy. This last formula gives a maximum absolute error of $10^{-5}$ around $x=2$.