Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6129229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:43:04+00:00 2026-05-23T16:43:04+00:00

In the book Modelling Cellular automata Simulations with mathematica , the author is using

  • 0

In the book Modelling Cellular automata Simulations with mathematica , the author is using the following code to simulate cellular automata in a two dimensional lattice,

From the Moore Neighbourhood the update rule is

update[site, N, E, S, W, NE, SE, SW, NW]

where N =North, E= East , S=South, W=West, NE= North East, SE=South East, SW= South East, NW=North West. Those arguments represent the values of the nearest neigbours in the Moor Neighbourhood. To apply those rules it uses the code below,

Moore[func_, lat_]:= MapThread[func,Map[RotateRight[lat,#]&,
{{0,0},{1,0},{0,-1},{-1,0},{0,1},
{1,-1},{-1,-1},{-1,1},{1,1}}],2]

For a table like the following (page 144 from the book)

pasture= Table[Floor[Random[]+(preyDensity+predDensity)]*
Floor[1+Random[]+predDensity/(preyDensity+predDensity)],{n},{n}]/. 
2:>{RND,Random[Integer, {1,3}],Random[Integer,{1,5}]}

RND:= Random[Integer, {1,4}]

he is using the following update rule

update[{_,0,0},_,_,_,_,_,_,_,_]  := {RND, 3,5}

My question is: By using a four dimensional table like the following? Can I also apply the following update rule?

InitialMatrix[x_, y_, age_, disease_] :=
  ReplacePart[
    Table[3, {x}, {y}, {age}, {disease}], {{_, _, 1, _} -> 
  0, {_, _, 2, 1} -> 
  Floor[dogpopulation*0.2/cellsno], {_, _, 2, 3} -> 
  Floor[dogpopulation*0.05/cellsno], {_, _, 3, 1} -> 
  Floor[dogpopulation*0.58/cellsno], {_, _, 3, 3} -> 
  Floor[dogpopulation*0.15/cellsno]}] /. 
  3 :> If[RandomReal[] > 0.2, 0, RandomInteger[{1, 2}]];


update[{{x_,0,0},{y_,z_,w_},{a_,b_,c_}},_,_,_,_,_,_,_,_] :=
                                            {{x-1,0,0},{y+z,0,w},{a,b,c}}

This is an example of how I think I can use my table to work with cellular automata. Can I do something like that? Or I am wrong?

Edit my table

By changing my table into the following code below can I use the update rule above?

MyMatrix[x_, y_, age_, disease_] :=
  Table[0, {x}, {y}] /. 
    0 :> ReplacePart[
      Table[3, {age}, {disease}], {{1, _} -> 0, {2, 1} -> 
    Floor[dogpopulation*0.2/cellsno], {2, 3} -> 
    Floor[dogpopulation*0.05/cellsno], {3, 1} -> 
    Floor[dogpopulation*0.58/cellsno], {3, 3} -> 
    Floor[dogpopulation*0.15/cellsno]}] /. 
   3 :> If[RandomReal[] > 0.2, 0, RandomInteger[{1, 2}]];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:43:05+00:00Added an answer on May 23, 2026 at 4:43 pm

    The book Modelling Cellular automata Simulations with mathematica was written more than 15 years ago, so would recommend looking at the CellularAutomaton[] function in Mathematica.

    The function CellularAutomaton[] is a little complex, but if you want to do 2D Moore CA this is how you call this function:

    CellualrAutomaton[{func[#]&,{},{1,1}},initialMatrixVal, numIterations];

    What the above code will do is call function func[], with the Moore neighborhood as fn param for each and every node in initialMatrixVal for “numIterations” times.

    The CellularAutomaton[] function assumes Periodic boundary conditions.

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Book I’ learning from claims that intArray has two dimensions. But since calling intArray.GetLength(1)
I'm following Steve Sanderson's example from this ASP.NET MVC book on creating a model
The book of IronPython In Action has the following code to read python script
A) Book I’m learning from says that if we handle Login.Authenticate event, then we
Each book can have many authors. And each author can author many books. class
Almost every Java book I read talks about using the interface as a way
Django book and Real World Haskell are using some similarly-looking web publishing platforms (with
My Book model has an author attribute which today is simply a CharField. The
The book says The WPF Button class only adds two simple concepts on top
With Book and Author domain classes as follows: class Book { static belongsTo =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.