MathGroup Archive 2009

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

Search the Archive

Re: Creating a Random Function to Select an Irrational

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102196] Re: [mg102176] Creating a Random Function to Select an Irrational
  • From: Mark McClure <mcmcclur at unca.edu>
  • Date: Sat, 1 Aug 2009 03:58:43 -0400 (EDT)
  • References: <200907310957.FAA19545@smc.vnet.net>

On Jul 31, 2009, at 5:57 AM, BenT <brtubb at pdmusic.org> wrote:

> I need to select a random irrational number. ...
> Numbers of the form n^(1/m) are irrational unless n is the mth power
> of an integer.
>
> Can anyone define a function to allow a similar capability as Random[]
> in selecting a "member" from the above defined "set" of values, ...?

It's fairly easy to do this particular construction:
ran := Module[{m},
  While[Element[Sqrt[m =
    RandomInteger[{2, 10}]], Integers]];
  RandomInteger[{2, 100}]^(1/m)]
ran // InputForm
58^(1/6)

But I can't imagine what you're going to use this for.  How do you
want your numbers distributed?

Mark McClure


  • Prev by Date: Re: Slow start to AstronomicalData[]
  • Next by Date: Re: Help with concatenating a list with &&
  • Previous by thread: Re: Slow start to AstronomicalData[]
  • Next by thread: Re: Creating a Random Function to Select an Irrational