Re: Bug ???
- To: mathgroup at smc.vnet.net
- Subject: [mg81838] Re: Bug ???
- From: Peter Pein <petsie at dordos.net>
- Date: Thu, 4 Oct 2007 04:33:02 -0400 (EDT)
- References: <200710020928.FAA28247@smc.vnet.net> <200710030635.CAA29450@smc.vnet.net> <fdvra7$qrb$1@smc.vnet.net>
Artur schrieb:
> Why doesn't work:
> a={};Do[k=n^2-(Floor[n^2(2/3)])^2;If[k=0,
> AppendTo[a,{k,n^2}]],{n,1,1000}];a
> but working
> a={};Do[k=n^2-(Floor[n^2(2/3)])^2;If[k<1,
> AppendTo[a,{k,n^2}]],{n,1,1000}];a
>
> Artur Jasinski, Poland
>
>
Hi Artur,
1. If [k=0,...] assigns 0 to k and becomes If[0,...] and 0 != True.
2. k<1 is a completely other test than k==0.
But wouldn't it be much easier to use
{{0, n^2}} /. ToRules @ Reduce[Floor[2n^2/3] == n > 0, n, Integers]
to get the same result?
(and is it necessary to use a CAS for this anyway)?
Peter
- References:
- help with polynomial solutions
- From: "Jules P. Aronson" <aronson@nlm.nih.gov>
- Re: help with polynomial solutions
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- help with polynomial solutions