4
$\begingroup$

I was trying to find an approximate solution to the following:

$\DeclareMathOperator\erf{erf}$

$$\frac12 \sqrt{\pi} \erf\left (\frac{x-2}{\sqrt{10}}\right) + \frac12 \sqrt{\pi} \erf \left(\frac{x+2}{\sqrt{10}}\right) = \frac25 \sqrt{\pi}$$

This naturally equals

$$\int_0^{\frac{x-2}{\sqrt{10}}} e^{-t^2} dt+ \int_0^{\frac{x+2}{\sqrt{10}}} e^{-t^2} dt = \frac25 \sqrt\pi$$

What I tried then was to use the taylor approximation and then solve the polynomial equations.. but the results I obtained were not consistently getting close to the correct solution ($x \sim 1.71$), obtained with wolfram alpha

In fact, using $\displaystyle \int_0^x e^{-t^2}dt = x - \frac{x^3}{3} + \frac{x^5}{10} - \frac{x^7}{42} + \dots$

I obtained the following approximations ($x_i$ indicates the result obtained considering the terms until $x^i$) $$x_1 \sim 1.12\ \ \ \ x_3 = -4.975 \ \ \ x_5 = 1.59 \ \ \ x_7 = -4.718 | 3.729 | 1.755 \ \ \ \ x_9 = 1.70$$

Questions

1) If I take into account the whole series, what assures me that only one solution will be found (with $x_7$, for example, I find $3$ real solutions)

2) I understand that as long as I am near $0$, the solution will be good approximation. But a priori I don't know what values $x$ is going to take, so the error can be large as large as $x$ and the taylor approximation is useless.

3) Why is (eventually) the error going to $0$ if one takes the whole series?

I don't think I have a clear understanding of the passage between taylor polynomial (valid only near a point $x_0$) and series (why exactly they are convergent everywhere (well, at least in the case of $e^x$) if we consider an an infinite amount of terms)

$\endgroup$
1
$\begingroup$

Approximations of $\erf$ according to the Handbook of Mathematical Functions:

http://people.math.sfu.ca/~cbm/aands/page_299.htm

$\endgroup$
  • 1
    $\begingroup$ And the Handbook references Hasting's classic "Approximations for digital computers", published in 1954 which I bought probably fifty years ago and is currently available on the web. Fun to read it again after all these years. $\endgroup$ – marty cohen Jun 16 '17 at 16:56
0
$\begingroup$

As you suspect, Taylor series expansions are only accurate near one point. To obtain a polynomial approximation that's good over an entire interval, the standard technique is to use Chebyshev approximation. The easiest approach is to just do interpolation at some carefully chosen nodes (the Chebyshev nodes). If you have access to Matlab, there is an add-on called Chebfun that does a very good job of constructing these sorts of approximations.

$\endgroup$
  • $\begingroup$ so taylor only yields the correct answer when I take into account infinite amount of terms, otherwise there is no way to predict how small the error will be, right? (also, why the error vanishes with infinite amount of terms? ) $\endgroup$ – Ant May 4 '14 at 19:50
  • $\begingroup$ Polynomial approximations (and approximations in general) all involve error. All you can do is keep the size and distribution of the error under control. The Chebyshev approach is good because it spreads the error uniformly over the interval of interest. Many approximation methods have error bounds. The Taylor approximation certainly does. Look up "error in Taylor series" or something like that. Higher degree polynomials have more degrees of freedom, therefore more approximating power, so they will generally give smaller errors. In the limit, an infinite number of terms gives zero error. $\endgroup$ – bubba May 4 '14 at 22:48
  • $\begingroup$ Don't be afraid of approximation error. It's happening behind the scenes whenever you do anything with a computer or calculator. Like in trigonometric functions, for example. In computers, these are just approximated by polynomial or rational functions. $\endgroup$ – bubba May 4 '14 at 22:54
  • $\begingroup$ Yes, but the error in taylor series is $o((x-x_0)^n)$. If $x >> x_0$, the error can become huge.. So why does it go to $0$ even when $x >> x_0$? $\endgroup$ – Ant May 5 '14 at 19:53
  • $\begingroup$ I don't know. I never use Taylor series expansions. As far as I'm concerned, they are not useful in practical applications. $\endgroup$ – bubba May 6 '14 at 2:50
0
$\begingroup$

use this $$\text{Solve}\left[\frac{x \left(-2 \left(\sqrt{2 \left(\sqrt{2}+2\right) \pi } \left(\text{erf}\left(\frac{\sqrt{2-\sqrt{2}}-4}{2 \sqrt{10}}\right)+\text{erf}\left(\frac{\sqrt{2-\sqrt{2}}+4}{2 \sqrt{10}}\right)\right)-\sqrt{2 \left(2-\sqrt{2}\right) \pi } \left(\text{erf}\left(\frac{\sqrt{\sqrt{2}+2}-4}{2 \sqrt{10}}\right)+\text{erf}\left(\frac{\sqrt{\sqrt{2}+2}+4}{2 \sqrt{10}}\right)\right)\right) x^2-\left(\sqrt{2}-1\right) \sqrt{\left(2-\sqrt{2}\right) \pi } \left(\text{erf}\left(\frac{\sqrt{\sqrt{2}+2}-4}{2 \sqrt{10}}\right)+\text{erf}\left(\frac{\sqrt{\sqrt{2}+2}+4}{2 \sqrt{10}}\right)\right)+\left(\sqrt{2}+1\right) \sqrt{\left(\sqrt{2}+2\right) \pi } \left(\text{erf}\left(\frac{\sqrt{2-\sqrt{2}}-4}{2 \sqrt{10}}\right)+\text{erf}\left(\frac{\sqrt{2-\sqrt{2}}+4}{2 \sqrt{10}}\right)\right)\right)}{2 \sqrt{2}}=\frac{2 \sqrt{\pi }}{5},x\right]$$ gives x aproximately 1.7106147726585592

$\endgroup$
0
$\begingroup$

Since $\erf'(x) =\dfrac{2}{\sqrt{\pi}}e^{-x^2/2} $, once you have a routine for $\erf(x)$, you can use Newton's iteration $\left(x_{n+1} =x_n-\dfrac{f(x_n)}{f'(x_n)} \right)$ to find the root of $f(x) = 0$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.