Cree una nueva regla de autómatas celulares en Mathematica

I need to create a new CA RULE in Mathematica. How can I do? I mean, I need to create a CA with 3 colors (Black, White and Grey). May you help me?

preguntado el 04 de julio de 12 a las 10:07

1 Respuestas

One way to specify a custom rule is to define a function which, given a list of neighbours and time step, will output the updated value. For example

fun[lst_, t_] := Mod[Total[lst], 3]

which will simply calculate the sum of all neighbours of an element modulo 3. This function can then be used in CellularAutomaton como sigue

With[{init = {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, nsteps = 10, r = 1},
   res = CellularAutomaton[{fun, {}, r}, init, nsteps]]


Gráficos de Mathematica

Respondido 04 Jul 12, 12:07

Many Thanks. For Example, If I want to have the following output using three colors: {0,1,1,0,2,2,1,0}, may I set a function starting from it? - daniel ricci

@DanieleRicci What exactly do you mean? The arguments provided to fun in my example above are the neighbourhood of a cell and the timestep, so for a 1D CA with a neighbourhood radius of 1 and possible states 0, 1, 2, you would need to specify fun[{0, 0, 0}, t], fun[{0, 0, 1}, t], ... , y fun[{2, 2, 2}, t] sin que importe t is the time step. - Heike

Dear Heike, I mean sorry for my stupid questions: I want to havet the following rule: white (0), black (1), Grey (2) --> 0, 0, 0 --> 0; 0,0,1--> - daniel ricci

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.