# [PD] Lorenz attractor

James Dunn james at 4thharmonic.com
Sun Jun 15 19:39:42 CEST 2008

```Hi,

I've recently been studying Lorenz attractors and other chaos circuits
and have built one in PD. (I've looked at Ben Bogart's external
containing a Lorenz attractor but I wanted to build my own). The patch
is detailed below and I'd appreciate any comments regarding any aspect
of it, but in particular, I'd like to know:

1) What is a better method of displaying the output? (the lines always
get erased as the array draws new lines)

2) Why does it take 2 bangs to start it? (I previously had an initial x
value of 0, but it refused to start at all, although it seemed to be
working at one stage!)

many thanks

James

#N canvas 530 323 643 475 10;
#X text 398 60 dx/dt = S(y-x);
#X text 398 75 dy/dt = Rx-y-xz;
#X text 398 90 dz/dt = xy-Bz;
#X text 398 37 Lorenz's original equations:;
#X floatatom 108 191 5 0 0 0 - - -;
#X floatatom 178 191 5 0 0 0 - - -;
#X floatatom 249 191 5 0 0 0 - - -;
#X obj 164 37 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X msg 192 87 10;
#X msg 220 87 28;
#X msg 249 87 2.66667;
#X text 398 120 S=10 \, R=28 \, B=8/3=2.66667;
#X obj 108 142 expr \$f4*(\$f2-\$f1) \; (\$f5*\$f1)-\$f2-(\$f1*\$f3) \;
(\$f1*\$f2)-(\$f6*\$f3)
;
#X obj 108 275 f;
#X obj 136 275 +;
#X obj 108 232 t b f;
#X obj 86 109 r x;
#X obj 108 253 delay 5;
#X obj 114 109 r y;
#X obj 178 232 t b f;
#X obj 178 253 delay 5;
#X obj 178 275 f;
#X obj 206 275 +;
#X obj 136 297 s x;
#X obj 206 297 s y;
#X obj 249 232 t b f;
#X obj 249 253 delay 5;
#X obj 249 275 f;
#X obj 277 275 +;
#X obj 277 296 s z;
#X obj 143 109 r z;
#N canvas 0 0 450 300 (subpatch) 0;
#X array array1 100 float 2;
#X coords 0 100 100 -100 200 200 1;
#X restore 372 212 graph;
#X obj 174 387 tabwrite array1;
#X obj 108 210 / 200;
#X obj 178 210 / 200;
#X obj 249 210 / 200;
#X msg 51 211 stop;
#X text 191 35 start;
#X obj 76 156 bng 15 250 50 0 empty empty empty 0 -6 0 10 -262144 -1
-1;
#X text 31 155 resume;
#X obj 261 367 * 2;
#X obj 174 367 * 3;
#X obj 174 346 - 30;
#X obj 261 346 + 26;
#X msg 108 87 6;
#X msg 164 87 0;
#X msg 136 87 1;
#X connect 4 0 33 0;
#X connect 5 0 34 0;
#X connect 6 0 35 0;
#X connect 7 0 44 0;
#X connect 7 0 46 0;
#X connect 7 0 45 0;
#X connect 7 0 8 0;
#X connect 7 0 9 0;
#X connect 7 0 10 0;
#X connect 8 0 12 3;
#X connect 9 0 12 4;
#X connect 10 0 12 5;
#X connect 12 0 4 0;
#X connect 12 1 5 0;
#X connect 12 2 6 0;
#X connect 13 0 14 0;
#X connect 14 0 23 0;
#X connect 14 0 13 1;
#X connect 14 0 43 0;
#X connect 15 0 17 0;
#X connect 15 1 14 1;
#X connect 16 0 12 0;
#X connect 17 0 13 0;
#X connect 18 0 12 1;
#X connect 19 0 20 0;
#X connect 19 1 22 1;
#X connect 20 0 21 0;
#X connect 21 0 22 0;
#X connect 22 0 24 0;
#X connect 22 0 21 1;
#X connect 25 0 26 0;
#X connect 25 1 28 1;
#X connect 26 0 27 0;
#X connect 27 0 28 0;
#X connect 28 0 29 0;
#X connect 28 0 27 1;
#X connect 28 0 42 0;
#X connect 30 0 12 2;
#X connect 33 0 15 0;
#X connect 34 0 19 0;
#X connect 35 0 25 0;
#X connect 36 0 17 0;
#X connect 38 0 17 0;
#X connect 40 0 32 1;
#X connect 41 0 32 0;
#X connect 42 0 41 0;
#X connect 43 0 40 0;
#X connect 44 0 12 0;
#X connect 45 0 12 2;
#X connect 46 0 12 1;

```