Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: calculation error in series

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125677] Re: calculation error in series
  • From: Dana DeLouis <dana01 at me.com>
  • Date: Wed, 28 Mar 2012 04:58:41 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

>  ... 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... at 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?





  • Prev by Date: Input vs. InputField for Interactive Applications
  • Next by Date: Re: using Mathematica for solving TSP-like problem with route priorities
  • Previous by thread: Re: calculation error in series
  • Next by thread: Re: calculation error in series