Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #9215 > unrolled thread
| Started by | Maurice Coderre <mauricecoderre@gmail.com> |
|---|---|
| First post | 2012-03-24 07:04 +0000 |
| Last post | 2012-03-25 05:17 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
calculation error in series Maurice Coderre <mauricecoderre@gmail.com> - 2012-03-24 07:04 +0000
Re: calculation error in series Peter Pein <petsie@dordos.net> - 2012-03-25 05:17 +0000
| From | Maurice Coderre <mauricecoderre@gmail.com> |
|---|---|
| Date | 2012-03-24 07:04 +0000 |
| Subject | calculation error in series |
| Message-ID | <jkjrlc$435$1@smc.vnet.net> |
In[52]:= \!\( \*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]\( FractionBox[\(1\), SuperscriptBox[\(2\), \((n + 1)\)]] \( \*UnderoverscriptBox[\(\[Sum]\), \(k = 0\), \(n\)]\(( SuperscriptBox[\((\(-1\))\), \(k\)] \((\(( \*FractionBox[\(n!\), \(\(\((n - k)\)!\) \(k!\)\)])\) \*SuperscriptBox[\(E\), \(- \*FractionBox[\(k\), \(2\)]\)]\ )\) Cos[14.134725141734695 k])\)\)\) \) Out[52]= 0.730559318177 + 5.55111512313*10^-17 I In[53]:= \!\( \*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]\( FractionBox[\(1\), SuperscriptBox[\(2\), \((n + 1)\)]] \( \*UnderoverscriptBox[\(\[Sum]\), \(k = 0\), \(n\)]\(( SuperscriptBox[\((\(-1\))\), \(k\)] \((\(( \*FractionBox[\(n!\), \(\(\((n - k)\)!\) \(k!\)\)])\) \*SuperscriptBox[\(E\), \(- \*FractionBox[\(k\), \(2\)]\)]\ )\))\)\)\)\) Out[53]= Sqrt[E]/(1 + Sqrt[E]) Why does the insertion of a purely real trigonometric function in a purely real infinit series, as shown above, give a complex result? Is it the result of an accumulated imprecision in the numerical evaluation?
[toc] | [next] | [standalone]
| From | Peter Pein <petsie@dordos.net> |
|---|---|
| Date | 2012-03-25 05:17 +0000 |
| Message-ID | <jkm9ou$bus$1@smc.vnet.net> |
| In reply to | #9215 |
Am 24.03.2012 08:04, schrieb Maurice Coderre:
> In[52]:= \!\(
> \*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]\(
> FractionBox[\(1\),
> SuperscriptBox[\(2\), \((n + 1)\)]] \(
> \*UnderoverscriptBox[\(\[Sum]\), \(k = 0\), \(n\)]\((
> SuperscriptBox[\((\(-1\))\), \(k\)] \((\((
> \*FractionBox[\(n!\), \(\(\((n - k)\)!\) \(k!\)\)])\)
> \*SuperscriptBox[\(E\), \(-
> \*FractionBox[\(k\), \(2\)]\)]\ )\) Cos[14.134725141734695 k])\)\)\)
> \)
>
> Out[52]= 0.730559318177 + 5.55111512313*10^-17 I
>
> In[53]:= \!\(
> \*UnderoverscriptBox[\(\[Sum]\), \(n = 0\), \(\[Infinity]\)]\(
> FractionBox[\(1\),
> SuperscriptBox[\(2\), \((n + 1)\)]] \(
> \*UnderoverscriptBox[\(\[Sum]\), \(k = 0\), \(n\)]\((
> SuperscriptBox[\((\(-1\))\), \(k\)] \((\((
> \*FractionBox[\(n!\), \(\(\((n - k)\)!\) \(k!\)\)])\)
> \*SuperscriptBox[\(E\), \(-
> \*FractionBox[\(k\), \(2\)]\)]\ )\))\)\)\)\)
>
> Out[53]= Sqrt[E]/(1 + Sqrt[E])
>
> Why does the insertion of a purely real trigonometric function in a
> purely real infinit series, as shown above, give a complex result? Is
> it the result of an accumulated imprecision in the numerical
> evaluation?
>
Hi Maurice,
one can not expect exact results from inexact input. You can get rid of
the floatingpoint-noise by applying Chop to the result or - preferably -
by calculating the sum for an exact constant and replacing the
approximate value later:
In[3]:= Sum[(1/2^(n + 1))*
Sum[(-1)^k*(n!/E^(k/2))*Cos[c*k]/
((n - k)!*k!), {k, 0, n}],
{n, 0, Infinity}]//ExpToTrig//FullSimplify
Out[3]= (E+Sqrt[E] Cos[c])/(1+E+2 Sqrt[E] Cos[c])
In[4]:= %/.c->14.134725141734695
Out[4]= 0.730559
Peter
P.S.: please use "Copy as Plain Text" (Shift-Strg-C) to copy/paste parts
of your notebooks. Thanks
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web