From 9f32ec0827dbd2681eca7f0b49eaff986d56b9a5 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Fri, 17 Jan 2020 10:05:34 +0100 Subject: [PATCH] Lorenz attractor on the 340 display. --- build/misc.tcl | 5 +++ doc/programs.md | 1 + src/lars/lorenz.67 | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 src/lars/lorenz.67 diff --git a/build/misc.tcl b/build/misc.tcl index ba83dd94..d6008003 100644 --- a/build/misc.tcl +++ b/build/misc.tcl @@ -613,6 +613,11 @@ expect ":KILL" respond "*" ":midas lars; ts minsky_minsky tron\r" expect ":KILL" +# Edward Lorenz' strange attactor. +respond "*" ":midas dsk0: lars; ts lorenz_lorenz\r" +expect ":KILL" +respond "*" ":link dsk0: .; @ lorenz, lars; ts lorenz\r" + # PI respond "*" ":midas sys3;ts pi_rwg; ran\r" expect ":KILL" diff --git a/doc/programs.md b/doc/programs.md index 698c89af..da02d5ae 100644 --- a/doc/programs.md +++ b/doc/programs.md @@ -186,6 +186,7 @@ - LOCK, shut down system. - LOGO, BBN Logo. - LOOKUP, looks up user info in INQUIR database. +- LORENZ, Edward Lorenz' strange attractor. - LOSS (device). - LOTCLN - LOGOUT TIMES cleanup program. - LSPEED, set TTY line parameters. diff --git a/src/lars/lorenz.67 b/src/lars/lorenz.67 new file mode 100644 index 00000000..3b053fce --- /dev/null +++ b/src/lars/lorenz.67 @@ -0,0 +1,82 @@ +title Lorenz - strange attractor + +x=1 +y=2 +z=3 +dx=4 +dy=5 +dz=6 +dot=7 +t=10 +tt=t+1 + +dis==130 + +rho==28.0 +sigma==10.0 +beta==2.66666666666666666 + +loc 20 +step: 0.0001 + +loc 41 + jrst nts + +loc 100 + +define display data ;Send data to display when ready. + conso dis,200 + jrst .-1 + datao dis,data +termin + +define fix a,b ;Convert float in a to fixed point in a+1, + muli a,400 ;shifted by b. + tsc a,a + ash a+1,-243+19.!b(a) +termin + +go: seto x, + .iotlsr x, +nts: cono dis,100 + display <[020016]> ;Parameters, go to point mode. + + move x,[1.0] + move y,[1.0] + move z,[1.0] + move dot,[220000,,022000] + +loop: move dy,[rho] ;dy/dt = (rho-z)*x - y + fsb dy,z + fmp dy,x + fsb dy,y + + move dx,y ;dx/dt = (y-x) * sigma + fsb dx,x + fmp dx,[sigma] + + move dz,x ;dz/dt = x*y - beta*z + fmp dz,y + move t,z + fmp t,[beta] + fsb dz,t + + fmp dx,step ;Update x,y,z from differentials. + fmp dy,step + fmp dz,step + fad x,dx + fad y,dy + fad z,dz + + move t,x ;Convert x,y to fixed point. + fix t,-15. + addi tt,512. + dpb tt,[001200,,dot] + move t,y + fix t,-15. + addi tt,512. + dpb tt,[221200,,dot] + display dot ;And plot on display. + jrst loop + +end go