MathGroup Archive 2009

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

Search the Archive

Re: SumOfSquaresRepresentations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103502] Re: SumOfSquaresRepresentations
  • From: janos <janostothmeister at gmail.com>
  • Date: Fri, 25 Sep 2009 05:58:10 -0400 (EDT)
  • References: <200909240351.XAA13419@smc.vnet.net> <h9fmf0$sfq$1@smc.vnet.net>

Thank to All,

To All,

This is not MY program, I have taken it from the help, more precisely
from here: Compatibility/tutorial/NumberTheory/NumberTheoryFunctions

To Andrzej,

You are right in the last point: there are 32 integers with no
decompositions between 1 and 200,
and not one, my claim was well founded by a mistake.
Still, a function like the one I have taken from the help, IS needed, because
 PowersRepresentations only gives the numbers of different
representations.

To Bob,
Thanks for fixing the problem, it should be included into the help
and into the corresponding item of mathworld as well.

Best wishes,

J=E1nos

On szept. 24, 13:50, Andrzej Kozlowski <a... at mimuw.edu.pl> wrote:
> First of all, you do not need to define yourself a function that does  
> this, since one already exists:
>
>   PowersRepresentations[15, 3, 2]
>
>   {}
>
> Now, this also tells you the solution to your problem! The solution is =
 
> that there are no solutions and you have written your program assuming =
 
> that there always are going to be any. Really, to see that all you  
> needed was to look at the output of:
>
> With[{a = Array[x, 3]}, Reduce[a.a == 15, a, Integers]]
>
> False
>
> Actually, your program will also not work correctly in other cases  
> when there are no solutions. Here are the numbers of ways of  
> representing the first 10 integers as sum of squares
>
> SquaresR[3, Range[10]]
>
> {6,12,8,6,24,24,0,12,30,24}
>
> We can see that for n = 7 there are no solutions and your code will  
> produce:
>
>   Module[{x,
>    a}, (a = Array[x, 3]) /. {ToRules[Reduce[a.a == 7, a, Intege=
rs]]}]
>
> {x$2267(1),x$2267(2),x$2267(3)}
>
> So how come you claim that 15 is the only integer between 1 and 200  
> for which this happens??
>
> Andrzej Kozlowski
>
> On 24 Sep 2009, at 12:51, janos wrote:
>
> > To be on the safe side:
> > ClearAll[d, n, x, a, SumOfSquaresRepresentations];
>
> > Take this from the help:
> > SumOfSquaresRepresentations[d_, n_] :=
> > Module[{x,
> >   a}, (a = Array[x, d]) /. {ToRules[Reduce[a.a == n, a, Integer=
s]]}]
>
> > Let's apply it:
> > SumOfSquaresRepresentations[3, 15]
> > {x$110[1], x$110[2], x$110[3]}
>
> > And this is the only case that you get this funny result
> > writing any integer between 1 and 200 in the place of 15.
>
> > Any idea?
>
> > Thank you.
>
> > J=E1nos



  • Prev by Date: Re: OneIdentity
  • Next by Date: Re: Notation (x)^(0. x)
  • Previous by thread: Re: SumOfSquaresRepresentations
  • Next by thread: Re: SumOfSquaresRepresentations