Re: Creating a Random Function to Select an Irrational
- To: mathgroup at smc.vnet.net
- Subject: [mg102224] Re: [mg102176] Creating a Random Function to Select an Irrational
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 1 Aug 2009 04:04:25 -0400 (EDT)
- Reply-to: hanlonr at cox.net
RandomIrrational[m_, n_] :=
Module[{x = 1},
While[IntegerQ[x],
x = RandomInteger[{2, m}]^
(1/RandomInteger[{2, n}])];
x] /; m >= 2 && n >= 2
Bob Hanlon
---- BenT <brtubb at pdmusic.org> wrote:
=============
Although Mathematica has built-in functiona to obtain random integers and real
numbers, I need to select a random irrational number. At this
webpage,
http://mathworld.wolfram.com/IrrationalNumber.html
several definitions are given for known conditions to create
irrational numbers, such as
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, or any
other of the definitions listed on the same webpage?