# CA Continuous

### 2 collaborators

Uri Wilensky (Author)
Eytan Bakshy (Author)

### Tags

cellular automata

Tagged by Reuven M. Lerner about 11 years ago

computer science

Tagged by Reuven M. Lerner about 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 492 times • Downloaded 88 times • Run 0 times

## WHAT IS IT?

This is a continuous cellular automaton, otherwise known as a "coupled map lattice." (See CA 1D Elementary and CA 1D Totalistic if you are unfamiliar with cellular automata.) It operates just like a standard cellular automaton, except for the fact that its states are not discrete, but continuous values.

In this particular continuous cellular automaton, the cell's values range from 0.0 to 1.0, 0.0 being black and 1.0 being green.

Unlike two- or three-state cellular automata, each cell in a continuous cellular automaton can ideally have infinite states, but is limited by the precision of the computer (in this case the maximum is 16 decimal places, which is the most NetLogo can handle). The continuous nature of the CA and its particular rules allow this model to generate a great deal of complex behavior under almost any settings.

## HOW IT WORKS

The rules are a cross between a totalistic cellular automaton and an iterated map.

An iterated map is a fixed map, or function, that is applied to a number repeatedly. The iterated map that is used in this model takes in a number, adds a constant (ADD-CONSTANT) between 0 and 1, and then the fractional part of that number is taken. For example, if the given number is 0.8 and the add-constant is 0.6, the sum would be 1.4, and the fractional part would be 0.4.

The cellular automaton is totalistic, which means that at every time step, each cell's new state is determined by taking the average of itself and its nearest neighbors, and then passing it through the iterated map.

The precision of the values in the cells is determined by the PRECISION slider.

## HOW TO USE IT

Set up:

• SETUP SINGLE initializes the model with a single cell set to 1 in the center.
• SETUP RANDOM initializes the model with each initial cell being a random value ranging from 0 to MAX-VALUE

Parameters:

• ADD-CONSTANT is the constant added to the average value of the nearest cells before the fractional part is taken.
• PRECISION-LEVEL is the precision of the value of each cell, with a slider value of 1 being an accuracy of 1 decimal place, and 16 being an accuracy of 16 decimal places.

Running the model:

• GO begins running the model with the currently set parameters. It continues until it reaches the last row of patches. If it is clicked again, GO will continue the run from the top.
• AUTO-CONTINUE? automatically wraps to the top once it reaches the last row when the switch is on

## THINGS TO NOTICE

Like their discrete counterparts, continuous cellular automata exhibit certain classes of behavior: Class I - cellular automaton is ordered and always ends up in a uniform state. Class II - cellular automaton is ordered and produces repetitive patterns. Class III - cellular automaton is "chaotic," or almost completely random. Class IV - cellular automaton is neither in class I, II, or III. It exhibits "complex" behavior, which often lies between order and chaos.

Can you find any cellular automaton configurations that exhibit these properties? What does this tell you about the nature of cellular automata?

Unlike elementary two-state cellular automata, certain configurations grow outwards at a rate that may be faster or slower than others, and less linear than the permitted one-cell per step growth in two-state cellular automata. Why do you think this is? What might this tell you about the relationship between the number of states and the growth of cellular automata?

The growth of continuous cellular automata is closely related to the continuity of space that it can produce. With certain ADD-VALUES, this model is able to produce very smooth curves. This is a sharp contrast to the jagged triangular patterns often found in two or three state cellular automata. Why do you think this happens? What might this tell you about the relationship between the number of states and spatial continuity in cellular automata?

Structures might seem to spontaneously occur from parts that seem very regular, especially when the model is run with initial random conditions with a with a very small MAX-VALUE. It is important to note that this is generally caused by small changes in cell values that cannot be seen due to the color limitations of NetLogo, and ultimately the human eye.

## THINGS TO TRY

Try these with single point initial conditions:

Run the model with ADD-CONSTANT set to 0.0 and 1.0. Why do they produce the same pattern?

Why does it make sense that an ADD-CONSTANT of 0.5 produces relatively solid alternating green and black patterns? Why does the line produced by the rule diffuse faster when the ACCURACY is higher?

Set the MAX-VALUE slider to a number between 0 and 0.10, and click setup random. Run the model a couple of times with different values for MAX-VALUE:

• Why do you think there is a delay in the occurrence of complex structures?
• Is there a relationship between the initial MAX-VALUE and the length of the delay? If so, Why?

Change ADD-CONSTANT back to 0.47, and experiment with different values of the ACCURACY slider:

• How does the accuracy affect the patterns?
• How come the effect of the accuracy is more noticeable after a large number of steps? - Why might low accuracies create incongruities in the cellular automata?

Try out different ADD-CONSTANTS under various the ACCURACY slider values. Now ask yourself, what disadvantages do computer-simulated continuous cellular automata have that discrete cellular automata do not?

## EXTENDING THE MODEL

There are many iterated maps that could be used to produce chaotic or complex behavior in a continuous cellular automaton. Try coming up with your own iterated map function.

Try increasing the spatial continuity of the model by increasing the number of neighbors each cell has on either side.

Try making your own number data structure that has a greater accuracy than the normal NetLogo math primitives permit.

Can you come up with a new coloring function to represent values using a wider array of colors, not just a gradient between green and black?

## RELATED MODELS

CA 1D Elementary- the elementary two-state 1D cellular automaton CA 1D Totalistic- a three-state totalistic 1D cellular automaton Turbulence (in the Chemistry & Physics section)- a 1D continuous cellular automaton which demonstrates turbulence

## CREDITS AND REFERENCES

Pattern Dynamics in Spatiotemporal Chaos: Kunihiko Kaneko. 1989 Physics D 34 1-41 A New Kind of Science. Wolfram, S. 2002. Wolfram Media Inc. Champaign, IL.

Thanks to Eytan Bakshy for his work on this model.

## HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

• Wilensky, U. (2003). NetLogo CA Continuous model. http://ccl.northwestern.edu/netlogo/models/CAContinuous. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
• Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

This model was created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

Click to Run Model

```globals
[
row             ;; current row we are now calculating
done?           ;; flag used to allow you to press the go button multiple times
]

patches-own
[
value           ;; some real number between 0 and 1
]

;; Setup general working environment.  The other setup procedures call this.

to setup-general
set row max-pycor   ;; Set the current row to be the top
set done? false
cp ct
end

;; Setup for a single point

to setup-single
setup-general
reset-ticks
;; Set only the middle patch to be 1 on the top row
ask patches with [pycor = row]
[
ifelse pxcor = 0
[ set value 1 ]
[ set value 0 ]
color-patch
]
end

;; Setup for a random top row

to setup-random
setup-general
reset-ticks
;; Randomize the values of the top row
ask patches with [pycor = row]
[
set value random-float max-value
color-patch
]
end

;; This is called when auto-continue? is enabled or go is clicked after a run.
;; Setup the patches to continue a particular model run.  This will copy the i
;; bottom row of patches to the top row.

to setup-continue
let value-list []
if not done?  ;; make sure go has already been called
[ stop ]

set value-list map [[value] of ?] sort patches with [pycor = row]  ;; copy cell states from bottom row to a list
setup-general
ask patches with [pycor = row]  ;; copy states from list to top row
[
set value item (pxcor + max-pxcor) value-list
color-patch
]
set done? false
end

;; Run the model.

to go
;; Did we reach the bottom row?
if row = min-pycor
[
;; If auto-continue? is enabled or we are clicking go again,
;; we continue from the top, otherwise we stop
ifelse auto-continue? or done?
[
set done? true
display    ;; ensure all the patches get drawn before we clear
setup-continue
]
[
set done? true
stop
]
]

;; Go down a row
set row (row - 1)

;; Calculate the values for the current row
ask patches with [pycor = row]
[
calculate-value
color-patch
]
tick
end

to calculate-value  ;; patch procedure
;; Retrieve the three patches that touch this patch one row above it
let top-neighbors neighbors with [pycor = [pycor] of myself + 1]

;; Calculate the average of their values
let mean-value mean [value] of top-neighbors

;; Perform a function to the average and set it as our value
set value iterated-map mean-value
end

;; This is a simple function that takes in a number, adds a constant to it and
;; only reports the decimal portion rounded to a given number of decimal places.

to-report iterated-map [x]
report precision (fractional-part (add-constant + x))
precision-level
end

;; Scales the patch's color according to its value

to color-patch  ;; patch procedure
set pcolor scale-color green value 0 2
end

;; Reports only the decimal part of the number

to-report fractional-part [x]
report x - (int x)
end

```

There are 10 versions of this model.

Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky almost 12 years ago Updated version tag Download this version
Uri Wilensky almost 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 12 years ago Updated to NetLogo 5.0 Download this version