Group Abstract Group Abstract

Message Boards Message Boards

0
|
5K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Compile substitution system?

Posted 7 years ago

I'm trying to loop a substitution system where I want the initial condition to be user-defined but the rules that the substitution follows is randomized with each iteration so I thought of compiling a function where x and n are the user input where x is the initial condition and n is the number of iterations required I'm getting all sorts of errors and I would appreciate any assistance.

RandomSA = 
 Compile[{x, {n, _Integer}}, 
  Module[{f, numb = 0}, 
   f = SubstitutionSystem[{1 -> 
       Table[RandomInteger[{1, 0}], {3}, {3}, {3}], 
      0 -> Table[0, {3}, {3}, {3}]}, x, 1]; 
   While[numb < n, 
    f = SubstitutionSystem[{1 -> 
        Table[RandomInteger[{1, 0}], {3}, {3}, {3}], 
       0 -> Table[0, {3}, {3}, {3}]}, f, 1]; numb++]; f]]
POSTED BY: Omar Mahmoud
2 Replies
Posted 7 years ago

giving up compiling seemed logical as many errors occurred, as for the output I wanted was to use the substitution system with a known initial condition and randomize the substitution rule with each iteration but it always randomize the first rule and keep using it

POSTED BY: Omar Mahmoud
POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard