1

How to plot numerically function $F(x)=\int e^{-x^2}dx$ ?

user109447
  • 111
  • 2

2 Answers2

1

Consider the error function $\operatorname{erf} x$. It is defined by $$\operatorname{erf} x = \frac{2}{\sqrt{\pi}}\int_0^x \operatorname{e}^{-t^2} \, \operatorname{d}\!t$$

The graph of $y=\operatorname{erf} x$ is given by

enter image description here

Fly by Night
  • 32,272
1

You probably want to plot $F(x)=\int_0^xe^{-t^2}dt$ An indefinite integral doesn't have a value you can plot because of the constant of integration. There are many ways to do numerical integration, which are described in numerical analysis texts. Since you can calculate $e^{-x^2}$ at any point, you can break up $[0,x]$ into a number of short intervals and use one of the many rules on the intervals. The error decreases as you increase the number of intervals, by an amount that depends on the rule you use. For example, for $x=1$, the extended trapezoidal rule, and two intervals, you get $F(1)\approx \frac 14e^0+\frac 12e^{-\frac 14}+\frac 14e^{-1}$

Ross Millikan
  • 374,822