Popular recipes tagged "chaos"http://code.activestate.com/recipes/tags/chaos/2015-10-16T19:52:02-07:00ActiveState Code RecipesReaction Diffusion Simulation (Python)
2015-10-16T19:52:02-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/579114-reaction-diffusion-simulation/
<p style="color: grey">
Python
recipe 579114
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/images/">images</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/physics/">physics</a>, <a href="/recipes/tags/simulation/">simulation</a>).
Revision 2.
</p>
<p>Reaction-Diffusion Simulation using Gray-Scott Model.</p>
Dynamical Billiards Simulation (Python)
2013-06-20T06:57:57-07:00Steve Wadleyhttp://code.activestate.com/recipes/users/4186942/http://code.activestate.com/recipes/578572-dynamical-billiards-simulation/
<p style="color: grey">
Python
recipe 578572
by <a href="/recipes/users/4186942/">Steve Wadley</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/random/">random</a>).
</p>
<p>It simulates reflections of a ball on a billiards table that has one or more circular obstacles.
(This can also be thought as a 2d ray-tracing.)</p>
<p>Most of the time the path of the ball would be chaotic (meaning, if another ball started from any slightly different location or direction then its path would be very different after a short while). </p>
<p>See Wikipedia for more info:
<a href="http://en.wikipedia.org/wiki/Dynamical_billiards" rel="nofollow">http://en.wikipedia.org/wiki/Dynamical_billiards</a></p>
Spring-Mass System Simulation (Python)
2011-05-02T01:59:45-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577681-spring-mass-system-simulation/
<p style="color: grey">
Python
recipe 577681
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/physics/">physics</a>, <a href="/recipes/tags/simulation/">simulation</a>).
</p>
<p>It simulates a damped spring-mass system driven by sinusoidal force.</p>
Complex Polynomial Roots Fractal (Python)
2013-04-29T14:35:53-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577866-complex-polynomial-roots-fractal/
<p style="color: grey">
Python
recipe 577866
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>).
Revision 2.
</p>
<p>The code generates complex polynomials that has random real coefficients; each +1 or -1.
Later it plots the roots.</p>
<p>Warning: The calculation may take 15 minutes or so!</p>
Synchronized Chaos using Lorenz Attractor (Python)
2011-08-02T03:53:03-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577816-synchronized-chaos-using-lorenz-attractor/
<p style="color: grey">
Python
recipe 577816
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>).
</p>
<p>2 chaotic Lorenz dynamical systems get synchronized with time.
(Notice 2 y and 2 z values start differently but approach each other later.)</p>
<p>I used the x variable as the synchronization signal but y or z can also be used.</p>
Fuzzy Logic Fractal (Python)
2011-08-14T23:09:08-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577841-fuzzy-logic-fractal/
<p style="color: grey">
Python
recipe 577841
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>).
</p>
<p>This fractal created by converting logic statements into equations using fuzzy logic operators:</p>
<p>X: X is as true as Y is true</p>
<p>Y: Y is as true as X is false</p>
<p>See: Scientific American Magazine, February 1993, "A Partly True Story"</p>
Dynamical Billiards Simulation (Python)
2010-10-30T06:22:28-07:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577445-dynamical-billiards-simulation/
<p style="color: grey">
Python
recipe 577445
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/pil/">pil</a>, <a href="/recipes/tags/random/">random</a>).
</p>
<p>It simulates reflections of a ball on a billiards table that has one or more circular obstacles.
(This can also be thought as a 2d ray-tracing.)</p>
<p>Most of the time the path of the ball would be chaotic (meaning, if another ball started from any slightly different location or direction then its path would be very different after a short while). </p>
<p>See Wikipedia for more info:
<a href="http://en.wikipedia.org/wiki/Dynamical_billiards" rel="nofollow">http://en.wikipedia.org/wiki/Dynamical_billiards</a></p>
Feigenbaum constant calculation (Python)
2010-11-16T06:00:51-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577464-feigenbaum-constant-calculation/
<p style="color: grey">
Python
recipe 577464
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>).
</p>
<p>Feigenbaum constant calculation.</p>
<p>For more info:</p>
<p><a href="http://en.wikipedia.org/wiki/Feigenbaum_constant" rel="nofollow">http://en.wikipedia.org/wiki/Feigenbaum_constant</a></p>
Gumowski-Mira Strange Attractor (Python)
2010-12-07T09:54:51-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577486-gumowski-mira-strange-attractor/
<p style="color: grey">
Python
recipe 577486
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/pil/">pil</a>).
Revision 4.
</p>
<p>It draws a random Gumowski-Mira Strange Attractor.
(It would retry until a good one is found to display.)</p>
Chaotic Function Analysis Graph (Python)
2010-12-10T03:31:50-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577487-chaotic-function-analysis-graph/
<p style="color: grey">
Python
recipe 577487
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/graph/">graph</a>, <a href="/recipes/tags/graphics/">graphics</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>).
Revision 2.
</p>
<p>There are 3 chaotic functions to graph as examples.</p>
<p>Graph of function (0) is a curve.
Graph of function (1) is a group of lines.
(Both are Xn+1 = f(Xn) type functions.)</p>
<p>Graph of function (2) on the other hand is a plane.
(It is Xn+1 = f(Xn, Xn-1) type function.)</p>
<p>These mean there is a simple relationship between the
previous and next X values in (0) and (1). (Next X value can always be predicted from the previous X value by using the graph of the function w/o knowing the function itself.)
But (2) does not have a discernible relationship. (No prediction possible!)
So (2) is clearly more chaotic than others.
(I think it could be used as a Pseudo-Random Number Generator (PRNG).)</p>
Dynamical Billiards Simulation Map (Python)
2010-11-07T18:21:06-08:00FB36http://code.activestate.com/recipes/users/4172570/http://code.activestate.com/recipes/577455-dynamical-billiards-simulation-map/
<p style="color: grey">
Python
recipe 577455
by <a href="/recipes/users/4172570/">FB36</a>
(<a href="/recipes/tags/chaos/">chaos</a>, <a href="/recipes/tags/fractal/">fractal</a>, <a href="/recipes/tags/image/">image</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/mathematics/">mathematics</a>, <a href="/recipes/tags/pil/">pil</a>).
Revision 4.
</p>
<p>It creates fractal-like map plots from the simulation.</p>
<p>(See my other post titled "Dynamical Billiards Simulation" first!)</p>
<p>I had to keep image size and maxSteps small otherwise the calculation takes too long!</p>
<p>(It shows what percentage of calculations completed every 10 seconds also.)</p>