Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Please Help with Sums with the same StandardForm but

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89026] Re: [mg89002] Please Help with Sums with the same StandardForm but
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Sat, 24 May 2008 03:52:18 -0400 (EDT)
  • References: <200805230708.DAA25851@smc.vnet.net>

Jose Luis Gomez wrote:
> (* Dear group
> 
> In Mathematica 6.0 it is possible to generate Sums with the same
> StandardForm but different InputForm
 >
> In other words, they look exactly the same for the final user, but they are
> considered different by Mathematica
> 
> Please evaluate: 
> 
> (PLEASE NOTICE THAT HERE INDEX j GOES FIRST)
> 
> *)
> 
> Clear[f,j,k,ja,jb,ka,kb];
> Sum[f[j,k],{j,ja,jb},{k,ka,kb}] 
> 
> (* You obtain the sum in "sigma notation" (StandardForm).
> 
> Next evaluate the following
> 
> (PLEASE NOTICE THAT HERE INDEX k GOES FIRST)
> 
>  *) 
> 
> Sum[  Sum[f[j,k],{k,ka,kb}],  {j,ja,jb}]
>  
> (*As you can see, both expressions display exactly the same, they look the
> same in StandardForm,
> 
>  However they are considered different by Mathematica.
> 
> To see this, evaluate:
> 
> *) 
> 
> Sum[f[j,k],{j,ja,jb},{k,ka,kb}] == Sum[  Sum[f[j,k],{k,ka,kb}],  {j,ja,jb}]  
> 
> (* I was expecting to obtain True, as both Sums look exactly the same in the
> Mathematica notebook.
> 
> However Mathematica does Not answer True or False, it just returns
> unevaluated,  
> 
> So I have the following questions for those who would like to help me:
> 
> FIRST: Am I right? Both expressions are the same? Or is there a situation
> where these two expressions, which look almost identical in StandardFrom,
> are actually different? 
> 
> SECOND: I have try FullSimplify, Reduce and Refine, trying to obtain True,
> but it does Not work. Is there any command or simplification to make
> Mathematica answer True, maybe under certain assumptions?
> 
> THIRD: Could this behavior be considered a bug?
> 
> I am using Mathematica 6.0
> 
> Thank you for your time and help
>  
> Jose
> 
> Mexico
> 
> *)
> 

They are not identical, and there is a bug.

i1 = Sum[f[j, k], {j, ja, jb}, {k, ka, kb}]

i2 = Sum[Sum[f[j, k], {k, ka, kb}], {j, ja, jb}]

If I convert the StandardForm to InputForm for each result, then I get 
identical results:

Sum[f[j, k], {j, ja, jb}, {k, ka, kb}]

The FullForm shows they are different, and in particular, that i2 
remains a nested Sum.

In[14]:= FullForm[i2]
Out[14]//FullForm= Sum[Sum[f[j,k],List[k,ka,kb]],List[j,ja,jb]]

Thus this as a bug in InputForm.

Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Integrating Interpolation functions
  • Next by Date: Re: LeastSquares using LinearProgramming?
  • Previous by thread: Please Help with Sums with the same StandardForm but different InputForm
  • Next by thread: "Reduce" wierdness (or too slow?)