Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg102255] Re: Creating a Random Function to Select an Irrational
  • From: BenT <brtubb at pdmusic.org>
  • Date: Mon, 3 Aug 2009 05:45:17 -0400 (EDT)
  • References: <200907310957.FAA19545@smc.vnet.net> <200908010801.EAA07130@smc.vnet.net>

To Andrzej Kozlowski,

I have just read all the replies to my original email, and especially
the several you made "replying" to yourself <g>. I have since visited
a site called RANDOM.ORG which defines both "pseudo" and "true" random
numbers, for which, of the second type they claim can be generated
from their site based on atmospheric noise. Although I am not
interested in cryptograpy or statistic probabilities for which
"random" numbers are typically used, if not "relied" on, my biggest
concern, that your use of WorkingPrecision partly addresses, is the
prevention of repeating digits within the "random" value which would
imply some sort of "rationality" to the number. As to matters of
"regularity" (and "coordination"), I'll be using Joseph Schillinger's
methodologies for resultants of interference with distribution and
involution groups with and without "fractioning" around an "axis of
symmetry".

Schillinger was notably the author of two books which I'm using for
developing my Mathematica "inspired" efforts for algorithmic music
composition. The books are "The Schillinger Method of Musical
Composition" and "The Mathematical Basis of the Arts" -- both of which
I'm been studying for over thirty years.

In any case, I do appreciate you taking the time to reply.

Another "definition" which you implied, could also be used, that
hadn't occurred to me <g> and more than provides me with what I want;
besides which the "probability" of their being a repeating sequence of
numbers is also virtually zero -- and this "method" is much easier to
implement, and runs faster <g>.

rnd[digits_Integer,base_Integer]:=
Module[{dvs},
	For[dvs = "";x = 1,x < digits, x++,
	dvs = dvs <> ToString[RandomInteger[base-1]] <> ","];
dvs = dvs <> ToString[RandomInteger[base-1]]]

(* testing the function definition *)
rnd[100,10]

4,1,5,4,2,3,8,4,7,6,7,8,2,6,9,1,0,6,4,6,3,6,3,9,7,3,1,5,4,9,5,0,5,9,0,8,2,6,6,5,7,2,5,8,8,7,7,0,5,5,4,7,9,7,2,8,4,9,5,2,7,7,1,8,9,3,2,2,6,5,3,4,9,2,1,7,7,4,8,4,1,7,4,3,7,9,1,7,9,9,1,0,6,8,9,4,9,1,0,2

For all bases greater than 10, their base 10 "digit" values are fine
for my use.

Actually, it has occurred to me that using the above in conjunction
with RealDigits and FromDigits, that random real numbers (in any base)
of any range and decimal "precision" can be generated from integers
only. I haven't quite figured out how to take the "rnd" string output
and convert it back into one number, but I'm working on it, since the
output must fist be redefined as a list with integer elements.

I've tried the following code to treat the values directly as numbers
for a list, but cannot figure out how to correct the code. The error
refers to the array element 101 which is not used in the "For"
function.

rnd[digits_Integer, base_Integer] :=
  Module[{dvs, dv},
   For[Array[dvs, digits]; dv = {}; x = 1, x <= digits, x++,
    dvs[x] = RandomInteger[base - 1]];
   dv[[x]] = dvs[x]];dv

In[79]:= rnd[100,7]
During evaluation of In[79]:= Set::partw: Part 101 of {} does not
exist. >>
Out[79]= dvs$3853[101]

- - - -
BenT
using Mathematica 7


  • Prev by Date: Re: publicon
  • Next by Date: Re: Assume and $Assumptions and Results
  • Previous by thread: Re: Re: Creating a Random Function to Select an Irrational
  • Next by thread: Re: Re: Creating a Random Function to Select an Irrational