Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9257

Re: calculation error in series

From Dana DeLouis <dana01@me.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: calculation error in series
Date 2012-03-28 10:00 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jkunfe$asd$1@smc.vnet.net> (permalink)

Show all headers | View raw


>  ... Is it the result of an accumulated imprecision ...

Hi.  Just for fun, here's an opposite view, where we think we have precise input.
I've never understood the algorithm, but it appears that if the input has a large numerator or denominator, then this situation appears to change the algorithm.
Here are 2 examples.

You had 2 sum functions, so just to be different, I'll use one.
First, we adjust your posted equations:

equ1=Divide[1,Power[2,(n+1)]];
equ2=(Power[-1,k](Binomial[n,k]E^(-(k/2))));

Sum[equ1*equ2,{n,0,Infinity},{k,0,n}]

Sqrt[E]/(1+Sqrt[E])

The above checks with what you have.

Here are 2 numbers, that are considered (almost) equal.

w1=14.134725141734695;
w2=Rationalize[w1,0];

w1==w2
True

One might think w2 would produce the more accurate answer.  However, the algorithm gives different answers.

Sum[equ1*equ2*Cos[w1*k],{n,0,Infinity},{k,0,n}]  //Chop
0.730559

Sum[equ1*equ2*Cos[w2*k],{n,0,Infinity},{k,0,n}]  //N
0.36528 +0.221225 I

Here are 2 numbers that are as close together as possible.
Yet, they give different answers.

w1=(2/3)-$MachineEpsilon;
w2=Rationalize[w1,0];

w1==w2
True

Sum[equ1*equ2*Cos[w1*k],{n,0,Infinity},{k,0,n}]  //Chop
0.636162

Sum[equ1*equ2*Cos[w2*k],{n,0,Infinity},{k,0,n}]  //N//Chop
0.318081 +0.0807899 I

= = = = = = = = = = = =
I just find it interesting
HTH  :>)
Dana DeLouis
Mac & Math 8
= = = = = = = = = = = =


On Mar 24, 3:04 am, Maurice Coderre <mauricecode...@gmail.com> wrote:
> 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?


Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: calculation error in series Dana DeLouis <dana01@me.com> - 2012-03-28 10:00 +0000

csiph-web