[Date Index]
[Thread Index]
[Author Index]
Re: Creating a Random Function to Select an Irrational Number
*To*: mathgroup at smc.vnet.net
*Subject*: [mg102259] Re: Creating a Random Function to Select an Irrational Number
*From*: divisor <congruentialuminaire at yahoo.com>
*Date*: Mon, 3 Aug 2009 05:46:01 -0400 (EDT)
*References*: <h4uf6j$j2q$1@smc.vnet.net>
Hello BenT:
If I understand correctly, 2 of those definitions can be implemented
thusly:
randomIrr[n_Integer]:=Pi^n
randomIrr1[n_Integer] := Module[
{a=RandomInteger[n], b=RandomInteger[n], c, d}
, c = First /@ FactorInteger[a];
d = First /@ FactorInteger[b];
If[c != d, Log[a, b],(* what to do?? *)0]
]
and invoking these seems to work:
N[randomIrr[500],25]
N[randomIrr1[500],25]
Note that N[] produces inexact numbers.
Also, note that I have only implemented the MathWorld definitions and
have not proved their irrationality.
Regards..
Roger Williams
Franklin Laboratory
On Jul 31, 2:57 am, BenT <brt... 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?
Prev by Date:
**Re: error with Sum and Infinity**
Next by Date:
**Making a LOOP (DO)**
Previous by thread:
**Re: freeing memory used by Import[]**
Next by thread:
**Making a LOOP (DO)**
| |