Page 1 of 1

Real-valued CA

Posted: November 2nd, 2016, 5:14 am
by shouldsee
EDIT: For note, Real-valued CA is also known as "coupled map lattice(CML)"

Why not?

convolution filter
1 1 1
1 9 1
1 1 1

or

1 1 1
1 1 1
1 1 1

mapping function
m(x)=tanh(x/10).*sin(x)
where x=floor(10*x)/10

(1) rulecurr=@(a) tanh(a/10).*sin(a)
(2) rulecurr=@(a) tanh(a/5).*sin(a)
(3) rulecurr=@(a) sig(a-4.5);
(4) rulecurr=@(a)sin(a/3)

matlab code

Code: Select all

%%

global cells cells_old n x y rulecurr async
rind=1;
k=rind;
randrule=1;
randrule=0;
name='nerd';
loadrule
getrule;

n=160;
x=2:n+1;
y=2:n+1;
cells=zeros(n+2,n+2);
async=0;
siz=size(cells);
[x1,x2]=ndgrid(x,y);
xyid=sub2ind(siz,x1,x2);
p0=0.5;

%%
cells=rand(n+2,n+2)*5;
%cells=zeros(n+2,n+2);
% cells(10:15,10:15)=rand(6,6)/2;
cells=torus(cells);
fi=imagesc(cells(xyid)',[0 1]);
rulecurr=@(a) 1-(mod(100*a,100)/100);
% rulecurr=@(a) (mod(a,4))/4;
rulecurr=@(a) tanh(a/10).*sin(a)

px=linspace(-7,7,n+2);
py=linspace(-7,7,n+2);
px=px(x1);
py=py(x2);
stepmax=1000000;

stepnum=1;
intl=6;
div=1;


% px=px(128,1);
% % py=py(1,96);
px=repmat(linspace(px(70,1),px(81,1),n)',1,n);
py=repmat(linspace(py(1,30),py(1,45),n),n,1);

px=repmat(linspace(px(25,1),px(35,1),n)',1,n);
py=repmat(linspace(py(1,135),py(1,150),n),n,1);
tl=sprintf('div=%d',div);
title(tl)
f1='sin(Sinput(xyid)./px)./py;';
f2='mod(Sinput(xyid),px)./py;';
xlabel('px');
ylabel('py');
ax=gca;
set(gca,'XTickLabels',cellstr(num2str(px(ax.XTick,1),3)));
set(gca,'YTickLabels',cellstr(num2str(py(1,ax.YTick)',3)));

while stepnum<stepmax
    %%
Sinput=conv2(cells,FIR.Sinput,'same');
Sinput=(floor(div*Sinput)/div);
% cells=rulecurr(Sinput);
Sinput(xyid)=eval(f1);
Sinput(xyid)=eval(f2);
% Sinput(xyid)=mod(Sinput(xyid),px)./py;
cells(xyid)=Sinput(xyid);
cells=torus(cells);
stepnum=stepnum+1;
if mod(stepnum,intl)==0
set(fi,'CData',cells(xyid)')

mv=mean(cells(:));
MAX=max(cells(:));
MIN=min(cells(:));
tl=sprintf(['div=%d,\n',...
    'mean=%.2d ' ,...
    'min=%.2d max=%.2d \n',...
    '%s \n',...
    '%s'],div,mv,MIN,MAX,f1,f2);
% set(gca,'Title','1')
title(gca,tl)
drawnow
pause(0.05)
% stepnum=stepnum-intl+1;
end

end

Re: Real-valued CA

Posted: November 2nd, 2016, 6:33 pm
by shouldsee
So familiar
These plots are lovely tools to explore bifurcations/phase transition.

Re: Real-valued CA

Posted: November 3rd, 2016, 8:12 pm
by shouldsee
A somewhat analogue to outer-semi-totalistic rule.

I am quite re-assured that real-valued CA (rvCA) shares many features with discretized CA from the simulations. These including strips, gliders, synchronized patches, bistable states, surface waves, etc...

How could rvCA and dCA share so many features? My speculation is "spontaneous discretization"(SpD), namely the continuous peak spontaneous split into 2 peaks, responding to a change in parameter (similarly to bifurcation in dynamic systems). The fact that the lattice is spatially discrete should aid the process, but probably not an essential for such SpD process (as reflected by M. Rob's study on DE-based Gray-Scott model). How to analytically deduce the manifold where SpD took place, where SpD took a phase-transition nature, would be an open problem.

More importantly, these phenomena exhibit a nice transition on varying some real-valued parameter (px and py), and sometimes a sharp transition. The 1st quadrant gives a particularly nice visualization of such transitions, where you have gliders sandwiched between emptiness and ordered states, and ordered states transiting into more ordered strips. Depending on the parametrization and the distribution of parameters' values, we shall obtain different visualisation with desired advantages.

If we consider a tiny patch of the parametrized phase space, and zoom in on this tiny patch, we can then ignore the variability in the parameters and assume a homogeneous space where every cell follows the same set of recurrence rules (same in the sense of identical set of parameters). In this sense, the derivative direction of any point on the parametrized rvCA manifold can be expanded into a homogeneous rvCA space. This nice property allows fine adjustment of the granularity/scale of the model.

The limitation of such method lies in manual choice of the kernel function. i.e. the function we choose to parametrize. The original outer-semi-totalistic is a fragmented space with a discrete topology. How to project this DCA space is somewhat arbitrary, yet implicitly constrained. How to make sensible choice of the manifold would remain an intriguing open question.

PS: This study is strongly influenced by M. Rob's study on the Gray-Scott model. http://mrob.com/pub/comp/xmorphia/

Re: Real-valued CA

Posted: November 4th, 2016, 4:50 am
by apg
For future reference, 'M. Rob' --> 'Robert Munafo'.

Re: Real-valued CA

Posted: November 4th, 2016, 12:46 pm
by shouldsee
[min_px, min_py;
max_px, max_py]
=
8.4879 -3.9412
8.4933 -3.9384

return map histogram that shows Spontaneous discretisation
ohyi6U4.gif
ohyi6U4.gif (3.01 MiB) Viewed 1545 times
accompanying CA
60L0fvk.gif
60L0fvk.gif (9.3 MiB) Viewed 1545 times

Re: Real-valued CA

Posted: November 12th, 2016, 1:33 pm
by shouldsee
A read-valued representation of B3/S23 and other outer-semi-totalistic rules, where the detection of gliders is equivalent to detection of moving bubbles.
Image

Peak representation
Image

And of B01358/S03

Low-density
Image

High-density
Image

Re: Real-valued CA

Posted: November 14th, 2016, 12:10 pm
by Scorbie
Wow! It's interesting to see your CAs. Too bad I don't know how to use matlab nor can I get it right now...

Re: Real-valued CA

Posted: November 14th, 2016, 3:37 pm
by shouldsee
Scorbie wrote:Wow! It's interesting to see your CAs. Too bad I don't know how to use matlab nor can I get it right now...
Thank you Scorbie. The structure of these CA are inherently simple. The trick is to make sure the updating function has a bounded value-range so that nothing explodes. It's important that you remind me that not all forum users can access matlab which I falsely assumed.

The main hurdles for me to programme (let's say python) elsewhere than matlab is to do efficient updates and to visualise the output. In matlab, using conv2()/convn() to do convolution instead of a for loop significantly speeds up the updating, I am not aware of any equivalent command in python. Visualising output in matlab is straightforward using imagesc() and set(,'CData',). In contrast, I knows nothing about python gui.

A forloop equivalent of conv2 would looks like

Code: Select all

cells=random initial 0'1 grid.
Sinput=blank,same size as cells
for cell in cells;
    Sinput(cell.index)=weighted sum of (cell)'s neighbor. %% essentially a convolution process
    # cellsnew(cell.index)=updateFcn(Sinput).
end
# cells=cellsnew
Having said that, implementation elsewhere than matlab should be straightforward to people with proficient in their programming language .(Matlab is the easiest programming language for me and that's why I stick to it. Another reason for using matlab is that much of this is experimental so writing in matlab allow me to change the structure quickly. (So that I spend all day coding and miss my deadlines :? ))

PS: As indicated in the pictures I have played with several updateFcn, including cosine() sine() mod() floor() and their scaled composition. The real power lies in the ability to smoothly vary the function by changing the scale parameter, namely px and py.
PPS: As for recent post for outer-totalistic rules, it was born out my attempt to canalising CA pictures by finding the edges. And it seems to work fine so far.

Re: Real-valued CA

Posted: November 14th, 2016, 8:44 pm
by apg
shouldsee wrote:The main hurdles for me to programme (let's say python) elsewhere than matlab is to do efficient updates and to visualise the output. In matlab, using conv2()/convn() to do convolution instead of a for loop significantly speeds up the updating, I am not aware of any equivalent command in python. Visualising output in matlab is straightforward using imagesc() and set(,'CData',). In contrast, I knows nothing about python gui.
The Python library scipy contains functions such as convolve, convolve2d, and fftconvolve. It's built on top of Python's linear algebra package numpy, which uses the same old Fortran libraries (BLAS and LAPACK) used by Matlab under the hood.

Also, the plotting library pyplot (aka matplotlib) gives you Matlab-style plotting capabilities from Python.

I can speak from experience of having used scipy, numpy and matplotlib -- they're really intuitive and complement each other very well. Indeed, Python seems decidedly deficient without these libraries.

Re: Real-valued CA

Posted: November 15th, 2016, 11:49 am
by shouldsee
calcyman wrote: The Python library scipy contains functions such as convolve, convolve2d, and fftconvolve. It's built on top of Python's linear algebra package numpy, which uses the same old Fortran libraries (BLAS and LAPACK) used by Matlab under the hood.

Also, the plotting library pyplot (aka matplotlib) gives you Matlab-style plotting capabilities from Python.

I can speak from experience of having used scipy, numpy and matplotlib -- they're really intuitive and complement each other very well. Indeed, Python seems decidedly deficient without these libraries.
Thanks for the tips. Will give a try had I any time.

Re: Real-valued CA

Posted: November 17th, 2016, 6:12 pm
by shouldsee
An unexpected continuous CA analogous to Brain's Brain.
Image

With homogeneous parameter, we have:
Image

I also made a guess about the shape of separatrix, with a rescaled sigmoid function, where sig(x)=[1+erf(x)]/2.
ACTUALLY, the separatrix simpifies to px=7*erf(py), possibly connected to the use of mod(Sinput,8) and mod(cells,1).
ZLLKYdg.jpg
ZLLKYdg.jpg (27.34 KiB) Viewed 1537 times
fNNLeh5.jpg
fNNLeh5.jpg (38.28 KiB) Viewed 1537 times
conv filter is:
1 1 1
1 0 1
1 1 1

Re: Real-valued CA

Posted: November 19th, 2016, 12:28 pm
by shouldsee
Bubbles at px=-14.8 py=2.1
mod1=8,mod2=1;
px/py ~= 7 == mod1-mod2

Image

Re: Real-valued CA

Posted: December 5th, 2016, 8:38 pm
by shouldsee
I made an implementation of this system on Ready, which features OpenCL and supports a rich extension of CA.

Remember to initialise the system before running it.

Re: Real-valued CA

Posted: December 17th, 2016, 8:19 pm
by CaveBacon
I've also been working on a program in D to run a continuous-valued equivalent of B3/S23, but my results haven't looked anything like yours. Would you mind clarifying how the update rule works for that cvCA?

Here's what I've done,

Radius = 1:
Radius_1.gif
Radius_1.gif (193.06 KiB) Viewed 10959 times
Radius = 2:
Radius_2.gif
Radius_2.gif (123 KiB) Viewed 10959 times

I'm using the sigmoid functions from this page: https://0fps.net/2012/11/19/conways-gam ... es-part-1/

I've used 5/16 to 7/16 as the birth interval, and
The gifs below were recorded with alpha_n = 1/16, alpha_m = 1/2. I've experimented with others, but none have produced the ring-like patterns you posted.
alpha_n is width of sigmoid for # of neighbors, alpha_m is the width of the sigmoid for cell state

The transition function looks like this:
transition.png
transition.png (5.96 KiB) Viewed 10959 times
x axis is average of neighbors, y axis is cell state (top = 0 bottom = 1)

Re: Real-valued CA

Posted: December 18th, 2016, 2:59 pm
by shouldsee
CaveBacon wrote:I've also been working on a program in D to run a continuous-valued equivalent of B3/S23, but my results haven't looked anything like yours. Would you mind clarifying how the update rule works for that cvCA?
Hello CaveBacon,

To clarify, I want to list things I have and have not done:

Done:
1. Extend the state values to a continuous set. Correspondingly, use continuous mapping function to update the configuration. This mapping function is in the form of s(x,t+1)=f( s(x,t), mean( s(y,t) for y neighboring x) ).
The map function look like this if heat-colored. (This one involves taking modulus, where f(a,b)=c0*mod(a,m)+c1*mod(b,m) )
l9cSyWb.jpg
l9cSyWb.jpg (46.07 KiB) Viewed 1540 times
2. Apply Gaussian filter to B3/S23 to identify the edge and make it look better.

Not done:
3. Smoothen the lattice (Which is done in SmoothLife)

Hope these info help.
Kind regards

Re: Real-valued CA

Posted: December 19th, 2016, 1:39 am
by PHPBB12345

Re: Real-valued CA

Posted: December 20th, 2016, 9:21 pm
by shouldsee
seesaw 2D replicator in Gary-Scott system
READY implementation

Notice this replicator follow roughly a seesaw growth rate, as opposed to steady growth rate seen in previous GS replicator

Image

compare its dynamics with a 2D replicator in classical CA.

Code: Select all

x = 4, y = 60 rule = B34c/S2-i34wy5ay6i
b2o$2obo$o2bo$2obo$b2o50$b2o$2obo$o2bo$2obo$b2o!

Re: Real-valued CA

Posted: February 15th, 2017, 7:39 am
by shouldsee
It'd be great if someone can find a glider in this extended logistic rule.
WWmlly7.jpg
WWmlly7.jpg (156.13 KiB) Viewed 1538 times

Re: Real-valued CA

Posted: May 29th, 2021, 11:52 pm
by kaarel
(large bump)



I've been exploring a simple real-valued-state CA rulespace with only 2 (real-valued) parameters using a bad piece of C++ code I've written. Each cell updates like this:
n is the sum of the cell neighborhood (including the cell itself)
new_value = max(0, -(x - a)^2 + b)

The rule is similar to B3/S2 when a=3, b=1. When b=1, the critical a is between 2.92 and 2.93. When b (and a) are lowered, the rules get more blobby. The rule a=0.1, b=0.7 is like Walled Cities (B45678/S2345), but slowly expanding. a=1.5,b=0.5 is similar to 34-Life (B34/S34). There might be a "triple point" for the parameters, below which the rule will transition directly from exploding/class 3 to never-expanding/class 2

Also, I accidentally discovered some (seemingly monochromatic) replicators and spaceships in a=5, b=10.

The colors are weird. a increases to the right and b downwards.
smallmap.png
smallmap.png (880.7 KiB) Viewed 3329 times

This image shows a "dead zone" between explosive rules and stable ash, caused by instability of the ash. a ranges from 6 to 9 and b from 2.8 to 3.2.
deadzone.png
deadzone.png (276.61 KiB) Viewed 3329 times

Bigger map. Some weird gaps are visible.
map3.png
map3.png (563.63 KiB) Viewed 3329 times