MathGroup Archive 2002

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

Search the Archive

Re: Listing

  • To: mathgroup at smc.vnet.net
  • Subject: [mg34131] Re: [mg34114] Listing
  • From: BobHanlon at aol.com
  • Date: Sun, 5 May 2002 04:48:37 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 5/4/02 6:04:32 AM, ab106 at pixie.co.za writes:

>I am working on a project investigating the Pell equation x^2-d*y^2=1,
>where
>I calculate the values of d keeping y constant and determining the periodic
>behaviour of x and d. I have found using Mathematica most useful to find
>the
>integer values of x and d. However, when I use Table[{(x^2-1)/y^2},{x,n,m}],
>it lists all the rational fractions over the complete range of n to m which
>I choose, where I am interested only in getting the Integer values of x
>and
>d while y is kept constant for one set of calculations.
>I wonder if it is possible for someone to advise me on how I must change
>my
>Table listing to only give the Integer values of x and d. I have tried
>several changes but none worked.
>

For a given (y, m, n) use either

Cases[Table[{x, (x^2-1)/y^2},{x,m,n}],
 
  {_, _Integer}]

or

Select[Table[{x, (x^2-1)/y^2},{x,m,n}],
 
  Head[#[[2]]]==Integer&]


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Re: Re: Question about pattern matching
  • Next by Date: Re: How to modify postscript code of generated graphs
  • Previous by thread: RE: Listing
  • Next by thread: Problems with SIMPLIFY and SOLVE