Jump to content

Maclaurin series of the error function


hobz

Recommended Posts

Hi. I am trying to figure out what the Maclaurin series of the error function looks like.

 

I use the reference from Wikipedia to check my results, but I cannot seem to get it right.

 

with [math] f(x) = \int_0^x e^{-\frac1{2} t^2}~dt[/math]

 

I would expect [math]f(0) = 0[/math] and [math]f'(0)=-\frac1{2}[/math] and thus the first two terms of the Maclaurin series to be [math]\frac1{1!}x + \left(-\frac1{2}\right) \frac1{2!} x^2[/math]

but this does not seem to be correct.

 

What am I doing wrong?

 

Anyone?

Link to comment
Share on other sites

With [math]f(x)=\int_0^x e^{-1/2 t^2} dt[/math] Taylor expanded around a=0 leading to the Maclaurin series.

 

[math]f(0)=\int_0^0 e^{-1/2 t^2} dt[/math] which must be equal to zero because of identical limits I presume.

 

[math]f'(0)= e^{-1/2\cdot 0^2} = 1[/math]

 

[math]f''(0)= -1/2 \cdot e^{-1/2\cdot 0^2} = -1/2[/math]

 

[math]f'''(0)= (-1/2)^2 \cdot e^{-1/2 \cdot 0^2} = (-1/2)^2[/math]

 

And thus I get the first three Maclaurin terms to be [math] f(0) + \frac{f'(0)}{1!}x + \frac{f''(0)}{2!}x + \frac{f'''(0)}{3!}x = 0 + \frac{1}{1!}x + \frac{(-1/2)}{2!}x^2 + \frac{(-1/2)^2}{1!}x^3 [/math] which clearly differs from the series defined at MathWorld.

 

I realize that I exchange all [math]t[/math]'s with the value for [math]x=0[/math], but I have no idea what else to do.

Link to comment
Share on other sites

I think you need to be using the Leibniz rule for differentiating an integral:

 

http://mathworld.wolfram.com/LeibnizIntegralRule.html

 

I'll try to take a look at the problem a little later today...

 

Edited to add: Actually, a pretty neat trick would be to put in the series approximation of e^(-x^2) into the integral first, then do the integral, then do the differentiation.

Link to comment
Share on other sites

The series for e^x is

1 + x + x^2/2 + ... + x^n/n! + ...

So the series for e^(-x^2/2) is

1 - x^2/2 + x^4/4 - x^6/(3!2^3) + ... + (-1)^n x^(2n)/(2^n n!) + ...

Therefore, the series for erf(x) is

C + x - x^3/6 + x^5/20 - x^7/(7*3!*2^3) + ... + (-1)^n x^(2n + 1)/(2^n n! 2n+1) + ...

C = 0, so the series is

erf(x) = x - x^3/6 + x^5/20 - x^7/(7*3!*2^3) + ... + (-1)^n x^(2n + 1)/(2^n n! 2n+1) + ...

=Uncool-

Link to comment
Share on other sites

with [math] f(x) = \int_0^x e^{-\frac1{2} t^2}~dt[/math]

 

What am I doing wrong?

 

That is not the error function. The standard definition is

 

[math]\mathrm{erf}(x) = \frac 2 {\surd \pi} \int_0^x e^{-t^2}dt[/math]

 

The Maclaurin series for erf(x) as reported at mathworld uses the defintion I reported, not the function in your original post.

 

BTW, wikipedia has the same definition for erf(x) as mathworld.

Link to comment
Share on other sites

That is not the error function. The standard definition is

 

[math]\mathrm{erf}(x) = \frac 2 {\surd \pi} \int_0^x e^{-t^2}dt[/math]

 

The Maclaurin series for erf(x) as reported at mathworld uses the defintion I reported, not the function in your original post.

 

BTW, wikipedia has the same definition for erf(x) as mathworld.

 

Yes I am sorry. I did not mean erf(x).

Link to comment
Share on other sites

[math]f(0)=\int_0^0 e^{-1/2 t^2} dt[/math] which must be equal to zero because of identical limits I presume.

That's correct, but the I presume doesn't sound promising.

[math]f'(0)= e^{-1/2\cdot 0^2} = 1[/math]

That's correct too, but not quite right in formulation. This statement at the bottom of post #3 is at the bottom is what led you astray:

I realize that I exchange all [math]t[/math]'s with the value for [math]x=0[/math], but I have no idea what else to do.

By the fundamental theorem of calculus,

[math]\frac d{dx} \int_a^x f(t)dt = f(x)[/math]

The Leibniz Integral Rule (see Bignose's post) generalizes the concept of differentiation under the integral sign. Applying this here,

[math]f'(x) = \frac d{dx}\int_0^x e^{-\,\frac {t^2} 2} dt = e^{-\,\frac {x^2} 2}[/math]

You don't simply substitute zeros for the ts. You substitute xs, and then set x=0 after performing all intermediate steps (i.e., calculating n derivatives).

A little more explicitly then,

[math]f'(0) = f'(x)|_{x=0} = e^{-\,\frac {x^2} 2}|_{x=0} = 1[/math]

You're shorthand started getting you in trouble here:

[math]f''(0)= -1/2 \cdot e^{-1/2\cdot 0^2} = -1/2[/math]

Everything that follows is off as well. Being explicit,

[math]f''(x) = \frac d{dx}f'(x) = \frac d{dx}e^{-\,\frac {x^2} 2} = e^{-\,\frac {x^2} 2}\frac d{dx}(-\,\frac {x^2} 2) = -xe^{-\,\frac {x^2} 2}[/math]

Thus [math]f''(0) = f''(x)|_{x=0} = 0[/math], not -1/2.

 

It looks like a pattern is developing here! I posit that the nth derivative of f(x) is a product of a polynomial and f'(x):

[math]f^{(n)}(x) = p_n(x) e^{-\,\frac {x^2} 2}[/math]

This is obviously true for n=1, with p_1(x)=1. If this pattern is true, we should have

[math]f^{(n+1)}(x) = p_{n+1}(x) e^{-\,\frac {x^2} 2}\frac d{dx} f^{(n)}(x) = p_n^{\prime}(x) e^{-\,\frac {x^2} 2} - xp_n(x) e^{-\,\frac {x^2} 2} [/math]

or

[math]p_{n+1}(x) = p_n^{\prime}(x) - xp_n(x)[/math]

which gives a recursive relation for the nth polynomial.

 

From above, we have [math]f''(x) = -xe^{-\,\frac {x^2} 2}[/math], from which [math]p_2(x) = -x[/math]. The recursive relation gives the same result. The relation holds for n=1 and n=2, and by induction, for all n>=1.

 

So what is [math]f^{(n)}(0)[/math]? Evaluating the general expression [math]f^{(n)}(x) = p_n(x) e^{-\,\frac {x^2} 2}[/math] at x=0 yields [math]f^{(n)}(0) = p_n(0)[/math]. We only need to evaluate the polynomials. The first few are

[math]p_1(x) = 1[/math]

[math]p_2(x) = -x[/math]

[math]p_3(x) = -1 -x(-x) = -1 + x^2[/math]

[math]p_4(x) = 2x -x(-1+x^2) = 3x - x^3[/math]

[math]p_5(x) = 3 - 3x^2 - x(3x-x^3) = 3 - 6x^2 + 3x^4[/math]

from which

[math]f'(0) = p_1(0) = 1[/math]

[math]f''(0) = p_2(0) = 0[/math]

[math]f'''(0) = p_3(0) = -1[/math]

[math]f''''(0) = p_4(0) = 0[/math]

[math]f'''''(0) = p_5(0) = 3[/math]

 

The Maclaurin series is

[math]f(x) = \sum_{n=0}^{\infty}\frac{f^{(n)}(0)}{n!}[/math]

which becomes

[math]f(x) = 0 + x - \frac 1 6 x^3 + \frac 1 {40} x^5 + \cdots[/math]

 

How does this compare to the series at mathworld? Using the standard definition of erf(x), you should be able to derive that

[math]\int_0^x e^{-\,\frac {t^2} 2} dt = \sqrt{\frac{\pi}2} \mathrm{erf}\left(\frac x {\surd 2}\right)[/math]

 

From mathworld,

[math]\mathrm{erf}(x) = \frac 2{\surd\pi} \left(x-\frac 1 3 x^3 + \frac 1 {10} x^5 + \cdots\right)[/math]

Evaluating [math]\mathrm{erf}(x/\surd 2)[/math],

[math]\mathrm{erf}\left(\frac x {\surd 2}\right) = \frac 2{\surd\pi} \left(\frac 1{\surd 2}x-\frac 1 3 \frac 1 {2\surd 2} x^3 + \frac 1 {10} \frac 1 {4\surd 2} x^5 + \cdots\right)[/math]

which simplifies to

[math]\mathrm{erf}\left(\frac x {\surd 2}\right) = \sqrt{\frac 2{\pi}}\left(x-\frac 1 6 x^3 + \frac 1 {40} x^5 + \cdots\right)[/math]

Multiplying by [math] \surd{\pi}/\surd 2[/math] recovers the series for f(x).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.