Home » Archimedes archive » Micro User » MU 1991-04.adf » Listings » Kam-2

Kam-2

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Micro User » MU 1991-04.adf » Listings
Filename: Kam-2
Read OK:
File size: 02C2 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM > <basicsave$dir>.Kam-2
   20PRINT"Strange Attractors 1"
   30PRINT"The KAM attractor"
   40PRINT"By Mike Cook"
   50PRINT"Press the space bar to get onto the next orbit"
   60REPEAT
   70INPUT"Enter a value for A (1.1 to 1.7) ",A
   80MODE15
   90CH%=0
  100orbit=0
  110PRINT TAB(0,31);"The KAM attractor By Mike Cook A = ";A;
  120PRINT TAB(55,31);"Space bar for next orbit";
  130sinA=SIN(A)
  140cosA=COS(A)
  150C%=0
  160REPEAT
  170orbit=orbit+0.1
  180PRINT TAB(0,0);"Orbit value ";orbit;SPC(6)
  190C%=C%+1
  200GCOL 0,C%
  210U=orbit/3
  220V=orbit/3
  230REPEAT
  240IF ABS(U)<1E6 AND  ABS(V)<1E6 THEN PLOT 69,(U*640)+640,(V*512)+512 ELSE PRINT TAB(0,0);"Chaos achieved ";SPC(6):CH%=1:GOTO 280
  250X=U*cosA-(V-U*U)*sinA
  260Y=U*sinA+(V-U*U)*cosA
  270U=X:V=Y
  280UNTIL INKEY(-99)
  290REPEAT
  300UNTIL NOT(INKEY(-99))
  310UNTIL CH%=1
  320PRINT TAB(0,0);
  330*FX21,0
  340UNTIL FALSE

� > <basicsave$dir>.Kam-2
�"Strange Attractors 1"
�"The KAM attractor"
(�"By Mike Cook"
25�"Press the space bar to get onto the next orbit"
<�
F*�"Enter a value for A (1.1 to 1.7) ",A
P�15
Z	CH%=0
dorbit=0
n5� �0,31);"The KAM attractor By Mike Cook A = ";A;
x)� �55,31);"Space bar for next orbit";
�
sinA=�(A)
�
cosA=�(A)
�C%=0
��
�orbit=orbit+0.1
�%� �0,0);"Orbit value ";orbit;�(6)
�C%=C%+1
�
� 0,C%
�
U=orbit/3
�
V=orbit/3
��
�g� �(U)<1E6 �  �(V)<1E6 � � 69,(U*640)+640,(V*512)+512 � � �0,0);"Chaos achieved ";�(6):CH%=1:� �TXA
�X=U*cosA-(V-U*U)*sinA
Y=U*sinA+(V-U*U)*cosA
U=X:V=Y
� �(-99)
"�
,� �(�(-99))
6� CH%=1
@� �0,0);
J*FX21,0
T� �
�
00000000  0d 00 0a 1d f4 20 3e 20  3c 62 61 73 69 63 73 61  |..... > <basicsa|
00000010  76 65 24 64 69 72 3e 2e  4b 61 6d 2d 32 0d 00 14  |ve$dir>.Kam-2...|
00000020  1b f1 22 53 74 72 61 6e  67 65 20 41 74 74 72 61  |.."Strange Attra|
00000030  63 74 6f 72 73 20 31 22  0d 00 1e 18 f1 22 54 68  |ctors 1"....."Th|
00000040  65 20 4b 41 4d 20 61 74  74 72 61 63 74 6f 72 22  |e KAM attractor"|
00000050  0d 00 28 13 f1 22 42 79  20 4d 69 6b 65 20 43 6f  |..(.."By Mike Co|
00000060  6f 6b 22 0d 00 32 35 f1  22 50 72 65 73 73 20 74  |ok"..25."Press t|
00000070  68 65 20 73 70 61 63 65  20 62 61 72 20 74 6f 20  |he space bar to |
00000080  67 65 74 20 6f 6e 74 6f  20 74 68 65 20 6e 65 78  |get onto the nex|
00000090  74 20 6f 72 62 69 74 22  0d 00 3c 05 f5 0d 00 46  |t orbit"..<....F|
000000a0  2a e8 22 45 6e 74 65 72  20 61 20 76 61 6c 75 65  |*."Enter a value|
000000b0  20 66 6f 72 20 41 20 28  31 2e 31 20 74 6f 20 31  | for A (1.1 to 1|
000000c0  2e 37 29 20 22 2c 41 0d  00 50 07 eb 31 35 0d 00  |.7) ",A..P..15..|
000000d0  5a 09 43 48 25 3d 30 0d  00 64 0b 6f 72 62 69 74  |Z.CH%=0..d.orbit|
000000e0  3d 30 0d 00 6e 35 f1 20  8a 30 2c 33 31 29 3b 22  |=0..n5. .0,31);"|
000000f0  54 68 65 20 4b 41 4d 20  61 74 74 72 61 63 74 6f  |The KAM attracto|
00000100  72 20 42 79 20 4d 69 6b  65 20 43 6f 6f 6b 20 41  |r By Mike Cook A|
00000110  20 3d 20 22 3b 41 3b 0d  00 78 29 f1 20 8a 35 35  | = ";A;..x). .55|
00000120  2c 33 31 29 3b 22 53 70  61 63 65 20 62 61 72 20  |,31);"Space bar |
00000130  66 6f 72 20 6e 65 78 74  20 6f 72 62 69 74 22 3b  |for next orbit";|
00000140  0d 00 82 0d 73 69 6e 41  3d b5 28 41 29 0d 00 8c  |....sinA=.(A)...|
00000150  0d 63 6f 73 41 3d 9b 28  41 29 0d 00 96 08 43 25  |.cosA=.(A)....C%|
00000160  3d 30 0d 00 a0 05 f5 0d  00 aa 13 6f 72 62 69 74  |=0.........orbit|
00000170  3d 6f 72 62 69 74 2b 30  2e 31 0d 00 b4 25 f1 20  |=orbit+0.1...%. |
00000180  8a 30 2c 30 29 3b 22 4f  72 62 69 74 20 76 61 6c  |.0,0);"Orbit val|
00000190  75 65 20 22 3b 6f 72 62  69 74 3b 89 28 36 29 0d  |ue ";orbit;.(6).|
000001a0  00 be 0b 43 25 3d 43 25  2b 31 0d 00 c8 0a e6 20  |...C%=C%+1..... |
000001b0  30 2c 43 25 0d 00 d2 0d  55 3d 6f 72 62 69 74 2f  |0,C%....U=orbit/|
000001c0  33 0d 00 dc 0d 56 3d 6f  72 62 69 74 2f 33 0d 00  |3....V=orbit/3..|
000001d0  e6 05 f5 0d 00 f0 67 e7  20 94 28 55 29 3c 31 45  |......g. .(U)<1E|
000001e0  36 20 80 20 20 94 28 56  29 3c 31 45 36 20 8c 20  |6 .  .(V)<1E6 . |
000001f0  f0 20 36 39 2c 28 55 2a  36 34 30 29 2b 36 34 30  |. 69,(U*640)+640|
00000200  2c 28 56 2a 35 31 32 29  2b 35 31 32 20 8b 20 f1  |,(V*512)+512 . .|
00000210  20 8a 30 2c 30 29 3b 22  43 68 61 6f 73 20 61 63  | .0,0);"Chaos ac|
00000220  68 69 65 76 65 64 20 22  3b 89 28 36 29 3a 43 48  |hieved ";.(6):CH|
00000230  25 3d 31 3a e5 20 8d 54  58 41 0d 00 fa 19 58 3d  |%=1:. .TXA....X=|
00000240  55 2a 63 6f 73 41 2d 28  56 2d 55 2a 55 29 2a 73  |U*cosA-(V-U*U)*s|
00000250  69 6e 41 0d 01 04 19 59  3d 55 2a 73 69 6e 41 2b  |inA....Y=U*sinA+|
00000260  28 56 2d 55 2a 55 29 2a  63 6f 73 41 0d 01 0e 0b  |(V-U*U)*cosA....|
00000270  55 3d 58 3a 56 3d 59 0d  01 18 0c fd 20 a6 28 2d  |U=X:V=Y..... .(-|
00000280  39 39 29 0d 01 22 05 f5  0d 01 2c 0f fd 20 ac 28  |99).."....,.. .(|
00000290  a6 28 2d 39 39 29 29 0d  01 36 0b fd 20 43 48 25  |.(-99))..6.. CH%|
000002a0  3d 31 0d 01 40 0c f1 20  8a 30 2c 30 29 3b 0d 01  |=1..@.. .0,0);..|
000002b0  4a 0b 2a 46 58 32 31 2c  30 0d 01 54 07 fd 20 a3  |J.*FX21,0..T.. .|
000002c0  0d ff                                             |..|
000002c2