Skip to main content
edited tags
Source Link

The Taylor series (about 0) for the cumulative normal distribution has coefficients:

g[i_] := Piecewise[{{Sqrt[Pi/2], i == 0}, {(-1/2)^((i - 1)/2)/(((i - 1)/2)!*i), Mod[i, 2] == 1}}]/Sqrt[2*Pi]

However,

Sum[g[i]*x^i,{i,0,Infinity}]

gives $e^x$ and not the $\frac{1}{2} + \frac{1}{2} Erf(\frac{x}{\sqrt{2}})$$\frac{1}{2} + \frac{1}{2} \operatorname{erf}\left(\frac{x}{\sqrt{2}}\right)$ expected.

When I

Plot[Sum[g[i]*x^i, {i, 0, 20}], {x, -5, 5}]

I get something looking like an exponential (not expected). But when I

Plot[Evaluate[Sum[g[i]*x^i, {i, 0, 20}]], {x, -5, 5}]

I get something looking like the cumulative normal distribution (expected). Trying to understand the different plots, I looked at

{Limit[Sum[g[i]*x^i, {i, 0, n}], n -> 3], Sum[g[i]*x^i, {i, 0, 3}]}

Which gave $\left\{\frac{e^x \Gamma (4,x)}{6},-\frac{x^3}{6 \sqrt{2 \pi }}+\frac{x}{\sqrt{2 \pi }}+\frac{1}{2}\right\}$ - the choice of n=3 is just for tidiness, similar results hold for all n (that I tried). These are clearly not equal as substituting $x\to 0$ gives $\{1,\frac{1}{2}\}$.

This, presumably, explains why I am getting the incorrect answer for the infinite sum and different plot results depending on the placement of the evaluate. Is there an explanation as to why I get different results with/without the limit and how to work around it (in the infinite sum case)?

The motivation is that I am trying to combine these coefficients in other infinite sums (corresponding to cumulative distribution of a sum of Gaussians centered at different positions) and it is giving results that differ from the series expansion I otherwise would obtain (using Series).

The above was tested on Mathematica 9.01 on Linux.

EDIT Turns out that the sum doesn't evaluate on Mathematica 9.01, there was traces of previous definitions lying around that caused it to evaluate when it shouldn't have. Solution is to avoid the piecewise definition and explicitly only sum the odd terms.

The Taylor series (about 0) for the cumulative normal distribution has coefficients:

g[i_] := Piecewise[{{Sqrt[Pi/2], i == 0}, {(-1/2)^((i - 1)/2)/(((i - 1)/2)!*i), Mod[i, 2] == 1}}]/Sqrt[2*Pi]

However,

Sum[g[i]*x^i,{i,0,Infinity}]

gives $e^x$ and not the $\frac{1}{2} + \frac{1}{2} Erf(\frac{x}{\sqrt{2}})$ expected.

When I

Plot[Sum[g[i]*x^i, {i, 0, 20}], {x, -5, 5}]

I get something looking like an exponential (not expected). But when I

Plot[Evaluate[Sum[g[i]*x^i, {i, 0, 20}]], {x, -5, 5}]

I get something looking like the cumulative normal distribution (expected). Trying to understand the different plots, I looked at

{Limit[Sum[g[i]*x^i, {i, 0, n}], n -> 3], Sum[g[i]*x^i, {i, 0, 3}]}

Which gave $\left\{\frac{e^x \Gamma (4,x)}{6},-\frac{x^3}{6 \sqrt{2 \pi }}+\frac{x}{\sqrt{2 \pi }}+\frac{1}{2}\right\}$ - the choice of n=3 is just for tidiness, similar results hold for all n (that I tried). These are clearly not equal as substituting $x\to 0$ gives $\{1,\frac{1}{2}\}$.

This, presumably, explains why I am getting the incorrect answer for the infinite sum and different plot results depending on the placement of the evaluate. Is there an explanation as to why I get different results with/without the limit and how to work around it (in the infinite sum case)?

The motivation is that I am trying to combine these coefficients in other infinite sums (corresponding to cumulative distribution of a sum of Gaussians centered at different positions) and it is giving results that differ from the series expansion I otherwise would obtain (using Series).

The above was tested on Mathematica 9.01 on Linux.

EDIT Turns out that the sum doesn't evaluate on Mathematica 9.01, there was traces of previous definitions lying around that caused it to evaluate when it shouldn't have. Solution is to avoid the piecewise definition and explicitly only sum the odd terms.

The Taylor series (about 0) for the cumulative normal distribution has coefficients:

g[i_] := Piecewise[{{Sqrt[Pi/2], i == 0}, {(-1/2)^((i - 1)/2)/(((i - 1)/2)!*i), Mod[i, 2] == 1}}]/Sqrt[2*Pi]

However,

Sum[g[i]*x^i,{i,0,Infinity}]

gives $e^x$ and not the $\frac{1}{2} + \frac{1}{2} \operatorname{erf}\left(\frac{x}{\sqrt{2}}\right)$ expected.

When I

Plot[Sum[g[i]*x^i, {i, 0, 20}], {x, -5, 5}]

I get something looking like an exponential (not expected). But when I

Plot[Evaluate[Sum[g[i]*x^i, {i, 0, 20}]], {x, -5, 5}]

I get something looking like the cumulative normal distribution (expected). Trying to understand the different plots, I looked at

{Limit[Sum[g[i]*x^i, {i, 0, n}], n -> 3], Sum[g[i]*x^i, {i, 0, 3}]}

Which gave $\left\{\frac{e^x \Gamma (4,x)}{6},-\frac{x^3}{6 \sqrt{2 \pi }}+\frac{x}{\sqrt{2 \pi }}+\frac{1}{2}\right\}$ - the choice of n=3 is just for tidiness, similar results hold for all n (that I tried). These are clearly not equal as substituting $x\to 0$ gives $\{1,\frac{1}{2}\}$.

This, presumably, explains why I am getting the incorrect answer for the infinite sum and different plot results depending on the placement of the evaluate. Is there an explanation as to why I get different results with/without the limit and how to work around it (in the infinite sum case)?

The motivation is that I am trying to combine these coefficients in other infinite sums (corresponding to cumulative distribution of a sum of Gaussians centered at different positions) and it is giving results that differ from the series expansion I otherwise would obtain (using Series).

The above was tested on Mathematica 9.01 on Linux.

EDIT Turns out that the sum doesn't evaluate on Mathematica 9.01, there was traces of previous definitions lying around that caused it to evaluate when it shouldn't have. Solution is to avoid the piecewise definition and explicitly only sum the odd terms.

added 263 characters in body
Source Link

The Taylor series (about 0) for the cumulative normal distribution has coefficients:

g[i_] := Piecewise[{{Sqrt[Pi/2], i == 0}, {(-1/2)^((i - 1)/2)/(((i - 1)/2)!*i), Mod[i, 2] == 1}}]/Sqrt[2*Pi]

However,

Sum[g[i]*x^i,{i,0,Infinity}]

gives $e^x$ and not the $\frac{1}{2} + \frac{1}{2} Erf(\frac{x}{\sqrt{2}})$ expected.

When I

Plot[Sum[g[i]*x^i, {i, 0, 20}], {x, -5, 5}]

I get something looking like an exponential (not expected). But when I

Plot[Evaluate[Sum[g[i]*x^i, {i, 0, 20}]], {x, -5, 5}]

I get something looking like the cumulative normal distribution (expected). Trying to understand the different plots, I looked at

{Limit[Sum[g[i]*x^i, {i, 0, n}], n -> 3], Sum[g[i]*x^i, {i, 0, 3}]}

Which gave $\left\{\frac{e^x \Gamma (4,x)}{6},-\frac{x^3}{6 \sqrt{2 \pi }}+\frac{x}{\sqrt{2 \pi }}+\frac{1}{2}\right\}$ - the choice of n=3 is just for tidiness, similar results hold for all n (that I tried). These are clearly not equal as substituting $x\to 0$ gives $\{1,\frac{1}{2}\}$.

This, presumably, explains why I am getting the incorrect answer for the infinite sum and different plot results depending on the placement of the evaluate. Is there an explanation as to why I get different results with/without the limit and how to work around it (in the infinite sum case)?

The motivation is that I am trying to combine these coefficients in other infinite sums (corresponding to cumulative distribution of a sum of Gaussians centered at different positions) and it is giving results that differ from the series expansion I otherwise would obtain (using Series).

The above was tested on Mathematica 9.01 on Linux.

EDIT Turns out that the sum doesn't evaluate on Mathematica 9.01, there was traces of previous definitions lying around that caused it to evaluate when it shouldn't have. Solution is to avoid the piecewise definition and explicitly only sum the odd terms.

The Taylor series (about 0) for the cumulative normal distribution has coefficients:

g[i_] := Piecewise[{{Sqrt[Pi/2], i == 0}, {(-1/2)^((i - 1)/2)/(((i - 1)/2)!*i), Mod[i, 2] == 1}}]/Sqrt[2*Pi]

However,

Sum[g[i]*x^i,{i,0,Infinity}]

gives $e^x$ and not the $\frac{1}{2} + \frac{1}{2} Erf(\frac{x}{\sqrt{2}})$ expected.

When I

Plot[Sum[g[i]*x^i, {i, 0, 20}], {x, -5, 5}]

I get something looking like an exponential (not expected). But when I

Plot[Evaluate[Sum[g[i]*x^i, {i, 0, 20}]], {x, -5, 5}]

I get something looking like the cumulative normal distribution (expected). Trying to understand the different plots, I looked at

{Limit[Sum[g[i]*x^i, {i, 0, n}], n -> 3], Sum[g[i]*x^i, {i, 0, 3}]}

Which gave $\left\{\frac{e^x \Gamma (4,x)}{6},-\frac{x^3}{6 \sqrt{2 \pi }}+\frac{x}{\sqrt{2 \pi }}+\frac{1}{2}\right\}$ - the choice of n=3 is just for tidiness, similar results hold for all n (that I tried). These are clearly not equal as substituting $x\to 0$ gives $\{1,\frac{1}{2}\}$.

This, presumably, explains why I am getting the incorrect answer for the infinite sum and different plot results depending on the placement of the evaluate. Is there an explanation as to why I get different results with/without the limit and how to work around it (in the infinite sum case)?

The motivation is that I am trying to combine these coefficients in other infinite sums (corresponding to cumulative distribution of a sum of Gaussians centered at different positions) and it is giving results that differ from the series expansion I otherwise would obtain (using Series).

The above was tested on Mathematica 9.01 on Linux.

The Taylor series (about 0) for the cumulative normal distribution has coefficients:

g[i_] := Piecewise[{{Sqrt[Pi/2], i == 0}, {(-1/2)^((i - 1)/2)/(((i - 1)/2)!*i), Mod[i, 2] == 1}}]/Sqrt[2*Pi]

However,

Sum[g[i]*x^i,{i,0,Infinity}]

gives $e^x$ and not the $\frac{1}{2} + \frac{1}{2} Erf(\frac{x}{\sqrt{2}})$ expected.

When I

Plot[Sum[g[i]*x^i, {i, 0, 20}], {x, -5, 5}]

I get something looking like an exponential (not expected). But when I

Plot[Evaluate[Sum[g[i]*x^i, {i, 0, 20}]], {x, -5, 5}]

I get something looking like the cumulative normal distribution (expected). Trying to understand the different plots, I looked at

{Limit[Sum[g[i]*x^i, {i, 0, n}], n -> 3], Sum[g[i]*x^i, {i, 0, 3}]}

Which gave $\left\{\frac{e^x \Gamma (4,x)}{6},-\frac{x^3}{6 \sqrt{2 \pi }}+\frac{x}{\sqrt{2 \pi }}+\frac{1}{2}\right\}$ - the choice of n=3 is just for tidiness, similar results hold for all n (that I tried). These are clearly not equal as substituting $x\to 0$ gives $\{1,\frac{1}{2}\}$.

This, presumably, explains why I am getting the incorrect answer for the infinite sum and different plot results depending on the placement of the evaluate. Is there an explanation as to why I get different results with/without the limit and how to work around it (in the infinite sum case)?

The motivation is that I am trying to combine these coefficients in other infinite sums (corresponding to cumulative distribution of a sum of Gaussians centered at different positions) and it is giving results that differ from the series expansion I otherwise would obtain (using Series).

The above was tested on Mathematica 9.01 on Linux.

EDIT Turns out that the sum doesn't evaluate on Mathematica 9.01, there was traces of previous definitions lying around that caused it to evaluate when it shouldn't have. Solution is to avoid the piecewise definition and explicitly only sum the odd terms.

Version information
Source Link

The Taylor series (about 0) for the cumulative normal distribution has coefficients:

g[i_] := Piecewise[{{Sqrt[Pi/2], i == 0}, {(-1/2)^((i - 1)/2)/(((i - 1)/2)!*i), Mod[i, 2] == 1}}]/Sqrt[2*Pi]

However,

Sum[g[i]*x^i,{i,0,Infinity}]

gives $e^x$ and not the $\frac{1}{2} + \frac{1}{2} Erf(\frac{x}{\sqrt{2}})$ expected.

When I

Plot[Sum[g[i]*x^i, {i, 0, 20}], {x, -5, 5}]

I get something looking like an exponential (not expected). But when I

Plot[Evaluate[Sum[g[i]*x^i, {i, 0, 20}]], {x, -5, 5}]

I get something looking like the cumulative normal distribution (expected). Trying to understand the different plots, I looked at

{Limit[Sum[g[i]*x^i, {i, 0, n}], n -> 3], Sum[g[i]*x^i, {i, 0, 3}]}

Which gave $\left\{\frac{e^x \Gamma (4,x)}{6},-\frac{x^3}{6 \sqrt{2 \pi }}+\frac{x}{\sqrt{2 \pi }}+\frac{1}{2}\right\}$ - the choice of n=3 is just for tidiness, similar results hold for all n (that I tried). These are clearly not equal as substituting $x\to 0$ gives $\{1,\frac{1}{2}\}$.

This, presumably, explains why I am getting the incorrect answer for the infinite sum and different plot results depending on the placement of the evaluate. Is there an explanation as to why I get different results with/without the limit and how to work around it (in the infinite sum case)?

The motivation is that I am trying to combine these coefficients in other infinite sums (corresponding to cumulative distribution of a sum of Gaussians centered at different positions) and it is giving results that differ from the series expansion I otherwise would obtain (using Series).

The above was tested on Mathematica 9.01 on Linux.

The Taylor series (about 0) for the cumulative normal distribution has coefficients:

g[i_] := Piecewise[{{Sqrt[Pi/2], i == 0}, {(-1/2)^((i - 1)/2)/(((i - 1)/2)!*i), Mod[i, 2] == 1}}]/Sqrt[2*Pi]

However,

Sum[g[i]*x^i,{i,0,Infinity}]

gives $e^x$ and not the $\frac{1}{2} + \frac{1}{2} Erf(\frac{x}{\sqrt{2}})$ expected.

When I

Plot[Sum[g[i]*x^i, {i, 0, 20}], {x, -5, 5}]

I get something looking like an exponential (not expected). But when I

Plot[Evaluate[Sum[g[i]*x^i, {i, 0, 20}]], {x, -5, 5}]

I get something looking like the cumulative normal distribution (expected). Trying to understand the different plots, I looked at

{Limit[Sum[g[i]*x^i, {i, 0, n}], n -> 3], Sum[g[i]*x^i, {i, 0, 3}]}

Which gave $\left\{\frac{e^x \Gamma (4,x)}{6},-\frac{x^3}{6 \sqrt{2 \pi }}+\frac{x}{\sqrt{2 \pi }}+\frac{1}{2}\right\}$ - the choice of n=3 is just for tidiness, similar results hold for all n (that I tried). These are clearly not equal as substituting $x\to 0$ gives $\{1,\frac{1}{2}\}$.

This, presumably, explains why I am getting the incorrect answer for the infinite sum and different plot results depending on the placement of the evaluate. Is there an explanation as to why I get different results with/without the limit and how to work around it (in the infinite sum case)?

The motivation is that I am trying to combine these coefficients in other infinite sums (corresponding to cumulative distribution of a sum of Gaussians centered at different positions) and it is giving results that differ from the series expansion I otherwise would obtain (using Series).

The Taylor series (about 0) for the cumulative normal distribution has coefficients:

g[i_] := Piecewise[{{Sqrt[Pi/2], i == 0}, {(-1/2)^((i - 1)/2)/(((i - 1)/2)!*i), Mod[i, 2] == 1}}]/Sqrt[2*Pi]

However,

Sum[g[i]*x^i,{i,0,Infinity}]

gives $e^x$ and not the $\frac{1}{2} + \frac{1}{2} Erf(\frac{x}{\sqrt{2}})$ expected.

When I

Plot[Sum[g[i]*x^i, {i, 0, 20}], {x, -5, 5}]

I get something looking like an exponential (not expected). But when I

Plot[Evaluate[Sum[g[i]*x^i, {i, 0, 20}]], {x, -5, 5}]

I get something looking like the cumulative normal distribution (expected). Trying to understand the different plots, I looked at

{Limit[Sum[g[i]*x^i, {i, 0, n}], n -> 3], Sum[g[i]*x^i, {i, 0, 3}]}

Which gave $\left\{\frac{e^x \Gamma (4,x)}{6},-\frac{x^3}{6 \sqrt{2 \pi }}+\frac{x}{\sqrt{2 \pi }}+\frac{1}{2}\right\}$ - the choice of n=3 is just for tidiness, similar results hold for all n (that I tried). These are clearly not equal as substituting $x\to 0$ gives $\{1,\frac{1}{2}\}$.

This, presumably, explains why I am getting the incorrect answer for the infinite sum and different plot results depending on the placement of the evaluate. Is there an explanation as to why I get different results with/without the limit and how to work around it (in the infinite sum case)?

The motivation is that I am trying to combine these coefficients in other infinite sums (corresponding to cumulative distribution of a sum of Gaussians centered at different positions) and it is giving results that differ from the series expansion I otherwise would obtain (using Series).

The above was tested on Mathematica 9.01 on Linux.

Source Link
Loading