Home » Archimedes archive » Acorn Computing » 1993 09 Mega Disk.adf » 93_09 » Miscellany/!4dMandia/docums/Teknic
Miscellany/!4dMandia/docums/Teknic
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 » Acorn Computing » 1993 09 Mega Disk.adf » 93_09 |
Filename: | Miscellany/!4dMandia/docums/Teknic |
Read OK: | ✔ |
File size: | 33FA bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
Technical Stuff ..... I HATE proof reading, so if the following looses sense at any time I must apologise. I wrote this some time ago and have not checked it since then... This explanation is not really technical, but does require a reasonable understanding of *Basic* maths. Nothing else is assumed, which means what follows is suitable to anyone who is a beginner in fractals. So if you're just curious or are interested in how such fractals work ... read on! 1.What is a fractal? Well put simply it is just a mathematical equation into which you feed a couple (or more) values, and feed the result back into the equation. You run this process a number of times, forever, or until a limit is reached. Depending on the final, or each result the equation gives, the output picture (or anything else for that matter) is obtained. For the Julia Set fractal, this process is repeated for every pixel on the screen. Another feature of fractals is that if you zoom into a fractal image, it never looses it's complexity. In life there are an amazing number of examples of fractal geometry. The best one is a coastline: Look at a map of England (or Norway ) and examine the coastline - all crinkly and bumpy. Now get a map which covers a smaller area, for example of Humberside, and examine the coastline ... it's still crinkly and uneven. You can carry on zooming in, even to the side of a rock pool and it will still be bumpy. This is the fractal geometry of nature. (Of course you can not zoom in and look further than atomic level due to the size and energy of photons!) Other places include plants, for instance a fern: on each branch is a smaller branch which is a copy of the parent, and on each branch on each branch there is a copy of the parent ... this does not go on forever, but quite some way. My carpet (it's one of those with curly patterns) even looks like it was designed using a fractal (julia set) generator. Life is even based on a fractal type mechanism. In nature fractals can be found every where. Have you looked at a butterfly, all similar for each species, but slightly different. To me they look like beautiful examples of how beautiful fractal type pictures look. 'Before' the universe scientists believe that there was nothing, but chaos.................. You might say '... but what real use do fractals have?'. The correct answer is: Many, such as image enhancing, image compressing, simulations of life (eg plants), encoding, and many more. With a scanned sheet of text, the quality is not always perfect and for correct OCR (Optical Character Recognition) the quality needs to be improved. This can be done by using a fractal algorithm to tidy up the image. A large picture can take anything up to, and more than, one mega byte (1048576 bytes) and a floppy can be filled up Very quickly. Also if you try to zoom in resolution is lost. But if the screen is turned into a fractal algorithm, only a few bytes will be taken up to store it, and if you zoom in (up to a point where it usually becomes inaccurate) resolution will not be lost. Biologists now believe that DNA in out bodies is not just a blue print for ourselves, but a fractal algorithm which is run to grow us. Some fractals can very well simulate plant growth and come up with a very natural looking specimen. (I presume you know what a pixel is - for those who do not know it is just a dot on the screen. This whole display is made up of many pixels, usually around 160000.) 2.Your first fractal. Bifurcate is the original chaos formula and is made up of a very simple formal which was first used to describe animal populations: New popul = Growth Rate * Old popul * ( 1 - Old popul ) where popul(ation) is a value between 0 and 1. With growth rates less than 200%. Over 200% and the equation splits (bifurcates) into 2, then 4, then becomes chaotic. This can also be used as a pseudo-random number generator, with the best random output growth rate of 4 (400%). Some simple 8-bit computers (eg. Spectrum etc.) actually use this method for generating random numbers. The formula is plotted with time across the bottom axis (X) and population on the side axis (Y). This is a very simple fractal, but some can be very complex. We shall not go into these as this is only an introduction into basic fractals. 3.Complex numbers. These are not as they sound, but the idea is strange. Complex numbers were invented to solve a problem: You can not work out the square root of a negative number. As the square root is the number multiplied by itself to get the first number, and any number (even negative) multiplied by itself always gives a positive result, then the square root of -1 is impossible (imaginary). To over come this difficulty it was decided that the imaginary number (represented by the letter 'i') squared was equal to negative 1. I.E. i*i=-1 and i^2=-1. That is the only difficult bit! Here are some examples of what complex numbers look like when written down: 4+7i (where 4 is real part and 7i the imaginary), 99-42i, 0+2i, 0+0i, 7-0i, a+bi (where a and b are both real integers). The other thing to know is that every complex number is made up of two other numbers, one the real, one the imaginary. These two names have no real meaning, it is just to distinguish between them - they could be called any thing e.g. Starsky and Hutch. Also a complex number is usually represented by the letter 'Z' although it could be any letter. To keep it simple I usually take Z to be made out of the two numbers 'a' and 'bi' where the 'i' represents an imaginary number. Adding and multiplying two complex numbers is easy: To add, you just add (or multiply) the parts separately, this is shown here: 3+4i + 6+2i = 9+6i 9-6i + 2+2i = 11-4i -2-3i + 4-i = 2-4i Multiplying is only slightly more difficult, you must remember that i^2=-1. Here is a worked example: (3-2i)*(7+4i) = 21+12i-14i-8i^2 = 21-2i-8i^2 and as i^2=-1 then (3-2i)*(7+4i)=21-2i-(8*-1)= 29-2i If you want to square a complex number, then you just multiply it by itself. This is shown here: (3+4i)^2 = 9+12i+12i+16i^2 = 9+24i+16i^2 and as i^2=-1 then (3+4i)^2 = 9+24i+(16*-1) = -7+24i A general formula would then be: (a+bi)^2 = a^2+abi+abi+(b^2*i^2) as i^2=-1 then =a^2+2abi-b^2 group the real and imaginary terms to form the general terms: a(n+1)=a(n)^2-b(n)^2 b(n+1)=2*a(n)*b(n)i One more thing to do with complex numbers and fractals is, size. When we talk about size, we mean, on the two planes real and imaginary, the distance between the position and 0,0. You could look as the real and imaginary parts as sides of a right-angle triangle where the distance is the hypotenuse. To find the hypotenuse you can use Pythagoras' theorem (a^2=b^2+c^2). So to find the size of a complex number, you square both the real and imaginary parts, add them together, and then square root this. A straight forward result in complex-number theory iterations guarantees that the iterations will drive Z to infinity, if and only at some stage Z reaches a size of 2 or greater. Very many points will reach 2 after only a few iterations, the ones that do not belong to the Mandlebrot Set. Do not worry if you did not follow all that, it will become clear to you in time. Even if you could not possibly understand it all you only need to know of the general term for squaring a complex number (and the bit about size) for most fractals. Some fractals such as the cubic Julia Set use cubing complex numbers, but we will not go into those in great detail. Above only covers SOME of the complex-number theory, and if you want to further your knowledge then read some old A-level or degree mathematics books on the subject. 4.The Julia Set This is the fractal that I choose because I have seen very few COLOUR julia sets, I have only seen ones which use inverse iteration methods (I will explain later) which only give monochrome images. The other reason is that this one shows how to plot a basic fractal using an individual pixel iteration method, and the Julia Set is an easy one to understand. Basically the Julia Set uses a Z^2+C formula which is iterated until a limit is reached, this is done for each pixel. There are an infinite number of different sets, each one is defined by the complex number 'C'. Both it's real and imaginary parts define the shape of the Julia Set and are usually (roughly) between -2 and 2. There are two types of Julia Set - Wholly Connected and Wholly Dis-connected. Wholly Connected is usually with small parts to the complex-number 'C'. To plot a particular Julia Set you have the screen representing the real(X) and imaginary(Y) planes from -2 to 2. Then set a complex-number variable 'Z' to the co-ordinates on the screen. Set a variable count to zero. Set the complex-number variable 'C' to the value you want for the particular set. Now carry out the following loop: .loop Z=Z^2 Z=Z+C count=count+1 IF count>256 OR SIZE(Z)>2 GOTO end GOTO loop Assign the value of count to the colour of the pixel. If the size of Z has not risen equal to, or above 2, then the pixel is black, and belongs to the actual Julia Set. Do this for every pixel and the image will build up. An example program written in ARM BBC BASIC V is shown here: (example 2) 1 PROCinit 10 realMIN=-2 20 imagMIN=-2 30 realMAX=2 40 imagMAX=2 50 realC=-.75 60 imagC=0 70 xySIZE=256 80 realINC=(realMAX-realMIN)/xySIZE 90 imagINC=(imagMAX-imagMIN)/xySIZE 100 imagZ=imagMIN 110 Y=0 120 REPEAT 130 realZ=realMIN 140 X=0 150 REPEAT 160 realZZ=realZ 170 imagZZ=imagZ 180 count=0 190 REPEAT 200 s=realZZ^2-imagZZ^2 210 imagZZ=2*realZZ*imagZZ 220 realZZ=s+realC 230 imagZZ=imagZZ+imagC 240 count+=1 250 UNTIL (realZZ^2+imagZZ^2)>=2 OR count>=256 260 PROCplot(X,Y,count) 270 X+=1 280 realZ+=realINC 290 UNTIL X>=xySIZE 300 Y+=1 310 imagZ+=imagINC 320 UNTIL Y>=xySIZE 330 END 340 : 350 DEFPROCinit 360 MODE13 370 link=14:pc=15 380 DIM MC &100 390 FOR pass%=0 TO 2 STEP 2 400 P%=MC 410 [OPT pass% 420 .vdu EQUD 148:EQUD -1 430 .plot LDR r3,vdu 440 ADD r3,r3,r1,LSL #8 450 ADD r3,r3,r1,LSL #6 460 STRB r2,[r3,r0] 470 MOV pc,link 480 ] 490 NEXT 500 SYS "OS_ReadVduVariables",vdu,vdu 510 ENDPROC 520 : 530 DEFPROCplot(X,Y,count) 540 A%=X:B%=Y 550 C%=count MOD 256 560 CALLplot 570 ENDPROC You must realise that understanding how to program fractals can be slightly more difficult than understanding them, so if you do not feel that you are up to doing some more on programs to do with fractals The method for plotting can be what ever you like, here I choose to directly write to screen memory as you do not need to bother dealing with there not being the same number of pixels as plot numbers. (ie a plot command can take roughly 0-1024 as a co- ordinate, but the screen in mode 13 has only roughly 256 pixels across and up). In 256 colour screen modes such as MODE 13 it is easy to draw by directly writing to the screen as each pixel takes one byte. You just select the colour by writing a number between 0 and 256. All very simple compared with other number of colours modes. Normally it is a bad idea to write directly to hardware without going through the operating system, and on an Archimedes the screen memory does not stay in the same place as on a BBC, but Acorn have provided a nice little operating system call to find out exactly where to write to. In fact the above listing (example2) is a long version just to make how it works more clear. Don't bother trying to understand the machine code plotting routine if you have not come across this sort of thing before as it will just make it more difficult for you to understand. Here are a few example BASIC one liner's, the first one is the same as the above Julia Set plotter, but changed and compacted onto one line: One line Julia Set plotter: For Archi, but will have to type in using BASIC Editor. 10MO.13:C1=-.75:C2=0:S=245:rn=-2:in=-2:rx=2:ix=2:rin=(rx-rn)/S: iin=(ix-in)/S:iZ=in:Y=0:REP.:rZ=rn:X=0:REP.:A=rZ:B=iZ:c=0:REP.: s=A^2-B^2+C1:B=2*A*B+C2:A=s:c+=1:UN.(A^2+B^2)>=2ORc>=256:GCOL0,c MOD 64 TINT c DIV4:POINT4*X,4*Y:X+=1:rZ+=rin:UN.X>=S:Y+=1: iZ+=iin:UN.Y>=S Less easily changed Archi version, and using only 64 colours. 10MODE13:C1=-.75:C2=0:S=245:inc=4/S:Y=0:iZ=-2:REP.:rZ=-2:X=0: REP.:A=rZ:B=iZ:c=0:REP.:s=A^2-B^2+C1:B=2*A*B:A=s:c+=1:UNTIL (A^2+B^2)>=2ORc>=256:GCOL0,c MOD 64:POINT4*X,4*Y:X+=1:rZ+=inc: UNTILX>=S:Y+=1:iZ+=inc:UNTILY>=S In both of the above, change S to the size of image required. That concludes what I am going to say for now, but if anyone wants me to continue, send me �5 with S.A.E., or send me a letter, and I will put it in the public domain for you. Bye .... for now ........
00000000 54 65 63 68 6e 69 63 61 6c 20 53 74 75 66 66 20 |Technical Stuff | 00000010 2e 2e 2e 2e 2e 0a 0a 49 20 48 41 54 45 20 70 72 |.......I HATE pr| 00000020 6f 6f 66 20 72 65 61 64 69 6e 67 2c 20 73 6f 20 |oof reading, so | 00000030 69 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 |if the following| 00000040 20 6c 6f 6f 73 65 73 20 73 65 6e 73 65 20 61 74 | looses sense at| 00000050 20 61 6e 79 20 74 69 6d 65 0a 49 20 6d 75 73 74 | any time.I must| 00000060 20 61 70 6f 6c 6f 67 69 73 65 2e 20 49 20 77 72 | apologise. I wr| 00000070 6f 74 65 20 74 68 69 73 20 73 6f 6d 65 20 74 69 |ote this some ti| 00000080 6d 65 20 61 67 6f 20 61 6e 64 20 68 61 76 65 20 |me ago and have | 00000090 6e 6f 74 20 63 68 65 63 6b 65 64 0a 69 74 20 73 |not checked.it s| 000000a0 69 6e 63 65 20 74 68 65 6e 2e 2e 2e 0a 0a 20 54 |ince then..... T| 000000b0 68 69 73 20 65 78 70 6c 61 6e 61 74 69 6f 6e 20 |his explanation | 000000c0 69 73 20 6e 6f 74 20 72 65 61 6c 6c 79 20 74 65 |is not really te| 000000d0 63 68 6e 69 63 61 6c 2c 20 62 75 74 20 64 6f 65 |chnical, but doe| 000000e0 73 20 72 65 71 75 69 72 65 20 61 20 0a 72 65 61 |s require a .rea| 000000f0 73 6f 6e 61 62 6c 65 20 75 6e 64 65 72 73 74 61 |sonable understa| 00000100 6e 64 69 6e 67 20 6f 66 20 2a 42 61 73 69 63 2a |nding of *Basic*| 00000110 20 6d 61 74 68 73 2e 20 4e 6f 74 68 69 6e 67 20 | maths. Nothing | 00000120 65 6c 73 65 20 69 73 0a 61 73 73 75 6d 65 64 2c |else is.assumed,| 00000130 20 77 68 69 63 68 20 6d 65 61 6e 73 20 77 68 61 | which means wha| 00000140 74 20 66 6f 6c 6c 6f 77 73 20 69 73 20 73 75 69 |t follows is sui| 00000150 74 61 62 6c 65 20 74 6f 20 61 6e 79 6f 6e 65 20 |table to anyone | 00000160 77 68 6f 20 69 73 20 61 0a 62 65 67 69 6e 6e 65 |who is a.beginne| 00000170 72 20 69 6e 20 66 72 61 63 74 61 6c 73 2e 20 53 |r in fractals. S| 00000180 6f 20 69 66 20 79 6f 75 27 72 65 20 6a 75 73 74 |o if you're just| 00000190 20 63 75 72 69 6f 75 73 20 6f 72 20 61 72 65 0a | curious or are.| 000001a0 69 6e 74 65 72 65 73 74 65 64 20 69 6e 20 68 6f |interested in ho| 000001b0 77 20 73 75 63 68 20 66 72 61 63 74 61 6c 73 20 |w such fractals | 000001c0 77 6f 72 6b 20 2e 2e 2e 20 72 65 61 64 20 6f 6e |work ... read on| 000001d0 21 0a 0a 20 31 2e 57 68 61 74 20 69 73 20 61 20 |!.. 1.What is a | 000001e0 66 72 61 63 74 61 6c 3f 0a 20 57 65 6c 6c 20 70 |fractal?. Well p| 000001f0 75 74 20 73 69 6d 70 6c 79 20 69 74 20 69 73 20 |ut simply it is | 00000200 6a 75 73 74 20 61 20 6d 61 74 68 65 6d 61 74 69 |just a mathemati| 00000210 63 61 6c 20 65 71 75 61 74 69 6f 6e 20 69 6e 74 |cal equation int| 00000220 6f 20 77 68 69 63 68 20 0a 79 6f 75 20 66 65 65 |o which .you fee| 00000230 64 20 61 20 63 6f 75 70 6c 65 20 28 6f 72 20 6d |d a couple (or m| 00000240 6f 72 65 29 20 76 61 6c 75 65 73 2c 20 61 6e 64 |ore) values, and| 00000250 20 66 65 65 64 20 74 68 65 20 72 65 73 75 6c 74 | feed the result| 00000260 20 62 61 63 6b 20 69 6e 74 6f 20 0a 74 68 65 20 | back into .the | 00000270 65 71 75 61 74 69 6f 6e 2e 20 59 6f 75 20 72 75 |equation. You ru| 00000280 6e 20 74 68 69 73 20 70 72 6f 63 65 73 73 20 61 |n this process a| 00000290 20 6e 75 6d 62 65 72 20 6f 66 20 74 69 6d 65 73 | number of times| 000002a0 2c 20 66 6f 72 65 76 65 72 2c 20 6f 72 20 0a 75 |, forever, or .u| 000002b0 6e 74 69 6c 20 61 20 6c 69 6d 69 74 20 69 73 20 |ntil a limit is | 000002c0 72 65 61 63 68 65 64 2e 20 44 65 70 65 6e 64 69 |reached. Dependi| 000002d0 6e 67 20 6f 6e 20 74 68 65 20 66 69 6e 61 6c 2c |ng on the final,| 000002e0 20 6f 72 20 65 61 63 68 20 72 65 73 75 6c 74 20 | or each result | 000002f0 0a 74 68 65 20 65 71 75 61 74 69 6f 6e 20 67 69 |.the equation gi| 00000300 76 65 73 2c 20 74 68 65 20 6f 75 74 70 75 74 20 |ves, the output | 00000310 70 69 63 74 75 72 65 20 28 6f 72 20 61 6e 79 74 |picture (or anyt| 00000320 68 69 6e 67 20 65 6c 73 65 20 66 6f 72 20 74 68 |hing else for th| 00000330 61 74 20 0a 6d 61 74 74 65 72 29 20 69 73 20 6f |at .matter) is o| 00000340 62 74 61 69 6e 65 64 2e 20 46 6f 72 20 74 68 65 |btained. For the| 00000350 20 4a 75 6c 69 61 20 53 65 74 20 66 72 61 63 74 | Julia Set fract| 00000360 61 6c 2c 20 74 68 69 73 20 70 72 6f 63 65 73 73 |al, this process| 00000370 20 69 73 20 0a 72 65 70 65 61 74 65 64 20 66 6f | is .repeated fo| 00000380 72 20 65 76 65 72 79 20 70 69 78 65 6c 20 6f 6e |r every pixel on| 00000390 20 74 68 65 20 73 63 72 65 65 6e 2e 20 41 6e 6f | the screen. Ano| 000003a0 74 68 65 72 20 66 65 61 74 75 72 65 20 6f 66 0a |ther feature of.| 000003b0 66 72 61 63 74 61 6c 73 20 69 73 20 74 68 61 74 |fractals is that| 000003c0 20 69 66 20 79 6f 75 20 7a 6f 6f 6d 20 69 6e 74 | if you zoom int| 000003d0 6f 20 61 20 66 72 61 63 74 61 6c 20 69 6d 61 67 |o a fractal imag| 000003e0 65 2c 20 69 74 20 6e 65 76 65 72 20 6c 6f 6f 73 |e, it never loos| 000003f0 65 73 0a 69 74 27 73 20 20 63 6f 6d 70 6c 65 78 |es.it's complex| 00000400 69 74 79 2e 0a 0a 20 49 6e 20 6c 69 66 65 20 74 |ity... In life t| 00000410 68 65 72 65 20 61 72 65 20 61 6e 20 61 6d 61 7a |here are an amaz| 00000420 69 6e 67 20 6e 75 6d 62 65 72 20 6f 66 20 65 78 |ing number of ex| 00000430 61 6d 70 6c 65 73 20 6f 66 20 66 72 61 63 74 61 |amples of fracta| 00000440 6c 20 0a 67 65 6f 6d 65 74 72 79 2e 20 54 68 65 |l .geometry. The| 00000450 20 62 65 73 74 20 6f 6e 65 20 69 73 20 61 20 63 | best one is a c| 00000460 6f 61 73 74 6c 69 6e 65 3a 20 4c 6f 6f 6b 20 61 |oastline: Look a| 00000470 74 20 61 20 6d 61 70 20 6f 66 20 45 6e 67 6c 61 |t a map of Engla| 00000480 6e 64 20 0a 28 6f 72 20 4e 6f 72 77 61 79 20 29 |nd .(or Norway )| 00000490 20 61 6e 64 20 65 78 61 6d 69 6e 65 20 74 68 65 | and examine the| 000004a0 20 63 6f 61 73 74 6c 69 6e 65 20 2d 20 61 6c 6c | coastline - all| 000004b0 20 20 63 72 69 6e 6b 6c 79 20 61 6e 64 20 62 75 | crinkly and bu| 000004c0 6d 70 79 2e 0a 4e 6f 77 20 67 65 74 20 61 20 6d |mpy..Now get a m| 000004d0 61 70 20 77 68 69 63 68 20 63 6f 76 65 72 73 20 |ap which covers | 000004e0 61 20 73 6d 61 6c 6c 65 72 20 61 72 65 61 2c 20 |a smaller area, | 000004f0 66 6f 72 20 20 65 78 61 6d 70 6c 65 20 6f 66 0a |for example of.| 00000500 48 75 6d 62 65 72 73 69 64 65 2c 20 61 6e 64 20 |Humberside, and | 00000510 65 78 61 6d 69 6e 65 20 74 68 65 20 63 6f 61 73 |examine the coas| 00000520 74 6c 69 6e 65 20 2e 2e 2e 20 69 74 27 73 20 73 |tline ... it's s| 00000530 74 69 6c 6c 20 20 63 72 69 6e 6b 6c 79 20 61 6e |till crinkly an| 00000540 64 0a 75 6e 65 76 65 6e 2e 20 59 6f 75 20 63 61 |d.uneven. You ca| 00000550 6e 20 63 61 72 72 79 20 6f 6e 20 7a 6f 6f 6d 69 |n carry on zoomi| 00000560 6e 67 20 69 6e 2c 20 65 76 65 6e 20 74 6f 20 74 |ng in, even to t| 00000570 68 65 20 73 69 64 65 20 20 6f 66 20 61 20 72 6f |he side of a ro| 00000580 63 6b 0a 70 6f 6f 6c 20 61 6e 64 20 69 74 20 77 |ck.pool and it w| 00000590 69 6c 6c 20 73 74 69 6c 6c 20 62 65 20 62 75 6d |ill still be bum| 000005a0 70 79 2e 20 54 68 69 73 20 69 73 20 74 68 65 20 |py. This is the | 000005b0 66 72 61 63 74 61 6c 20 67 65 6f 6d 65 74 72 79 |fractal geometry| 000005c0 20 6f 66 0a 6e 61 74 75 72 65 2e 20 28 4f 66 20 | of.nature. (Of | 000005d0 63 6f 75 72 73 65 20 79 6f 75 20 63 61 6e 20 6e |course you can n| 000005e0 6f 74 20 7a 6f 6f 6d 20 69 6e 20 61 6e 64 20 6c |ot zoom in and l| 000005f0 6f 6f 6b 20 66 75 72 74 68 65 72 20 74 68 61 6e |ook further than| 00000600 0a 61 74 6f 6d 69 63 20 6c 65 76 65 6c 20 64 75 |.atomic level du| 00000610 65 20 74 6f 20 74 68 65 20 73 69 7a 65 20 61 6e |e to the size an| 00000620 64 20 65 6e 65 72 67 79 20 6f 66 20 70 68 6f 74 |d energy of phot| 00000630 6f 6e 73 21 29 0a 20 4f 74 68 65 72 20 70 6c 61 |ons!). Other pla| 00000640 63 65 73 20 69 6e 63 6c 75 64 65 20 70 6c 61 6e |ces include plan| 00000650 74 73 2c 20 66 6f 72 20 69 6e 73 74 61 6e 63 65 |ts, for instance| 00000660 20 61 20 66 65 72 6e 3a 20 6f 6e 20 65 61 63 68 | a fern: on each| 00000670 20 62 72 61 6e 63 68 20 0a 69 73 20 61 20 73 6d | branch .is a sm| 00000680 61 6c 6c 65 72 20 62 72 61 6e 63 68 20 77 68 69 |aller branch whi| 00000690 63 68 20 69 73 20 61 20 63 6f 70 79 20 6f 66 20 |ch is a copy of | 000006a0 74 68 65 20 70 61 72 65 6e 74 2c 20 61 6e 64 20 |the parent, and | 000006b0 6f 6e 20 65 61 63 68 20 0a 62 72 61 6e 63 68 20 |on each .branch | 000006c0 6f 6e 20 65 61 63 68 20 62 72 61 6e 63 68 20 74 |on each branch t| 000006d0 68 65 72 65 20 69 73 20 61 20 63 6f 70 79 20 6f |here is a copy o| 000006e0 66 20 74 68 65 20 70 61 72 65 6e 74 20 2e 2e 2e |f the parent ...| 000006f0 20 74 68 69 73 20 64 6f 65 73 20 0a 6e 6f 74 20 | this does .not | 00000700 67 6f 20 6f 6e 20 66 6f 72 65 76 65 72 2c 20 62 |go on forever, b| 00000710 75 74 20 71 75 69 74 65 20 73 6f 6d 65 20 77 61 |ut quite some wa| 00000720 79 2e 0a 20 4d 79 20 63 61 72 70 65 74 20 28 69 |y.. My carpet (i| 00000730 74 27 73 20 6f 6e 65 20 6f 66 20 74 68 6f 73 65 |t's one of those| 00000740 20 77 69 74 68 20 63 75 72 6c 79 20 70 61 74 74 | with curly patt| 00000750 65 72 6e 73 29 20 65 76 65 6e 20 6c 6f 6f 6b 73 |erns) even looks| 00000760 20 0a 6c 69 6b 65 20 69 74 20 77 61 73 20 64 65 | .like it was de| 00000770 73 69 67 6e 65 64 20 75 73 69 6e 67 20 61 20 66 |signed using a f| 00000780 72 61 63 74 61 6c 20 28 6a 75 6c 69 61 20 73 65 |ractal (julia se| 00000790 74 29 20 67 65 6e 65 72 61 74 6f 72 2e 20 4c 69 |t) generator. Li| 000007a0 66 65 20 0a 69 73 20 65 76 65 6e 20 62 61 73 65 |fe .is even base| 000007b0 64 20 6f 6e 20 61 20 66 72 61 63 74 61 6c 20 74 |d on a fractal t| 000007c0 79 70 65 20 6d 65 63 68 61 6e 69 73 6d 2e 20 49 |ype mechanism. I| 000007d0 6e 20 6e 61 74 75 72 65 20 66 72 61 63 74 61 6c |n nature fractal| 000007e0 73 20 63 61 6e 20 0a 62 65 20 66 6f 75 6e 64 20 |s can .be found | 000007f0 65 76 65 72 79 20 77 68 65 72 65 2e 0a 20 48 61 |every where.. Ha| 00000800 76 65 20 79 6f 75 20 6c 6f 6f 6b 65 64 20 61 74 |ve you looked at| 00000810 20 61 20 62 75 74 74 65 72 66 6c 79 2c 20 61 6c | a butterfly, al| 00000820 6c 20 73 69 6d 69 6c 61 72 20 66 6f 72 20 65 61 |l similar for ea| 00000830 63 68 20 73 70 65 63 69 65 73 2c 20 0a 62 75 74 |ch species, .but| 00000840 20 73 6c 69 67 68 74 6c 79 20 64 69 66 66 65 72 | slightly differ| 00000850 65 6e 74 2e 20 54 6f 20 6d 65 20 74 68 65 79 20 |ent. To me they | 00000860 6c 6f 6f 6b 20 6c 69 6b 65 20 62 65 61 75 74 69 |look like beauti| 00000870 66 75 6c 20 65 78 61 6d 70 6c 65 73 20 0a 6f 66 |ful examples .of| 00000880 20 68 6f 77 20 62 65 61 75 74 69 66 75 6c 20 66 | how beautiful f| 00000890 72 61 63 74 61 6c 20 74 79 70 65 20 70 69 63 74 |ractal type pict| 000008a0 75 72 65 73 20 6c 6f 6f 6b 2e 0a 20 27 42 65 66 |ures look.. 'Bef| 000008b0 6f 72 65 27 20 74 68 65 20 75 6e 69 76 65 72 73 |ore' the univers| 000008c0 65 20 73 63 69 65 6e 74 69 73 74 73 20 62 65 6c |e scientists bel| 000008d0 69 65 76 65 20 74 68 61 74 20 74 68 65 72 65 20 |ieve that there | 000008e0 77 61 73 20 6e 6f 74 68 69 6e 67 2c 20 0a 62 75 |was nothing, .bu| 000008f0 74 20 63 68 61 6f 73 2e 2e 2e 2e 2e 2e 2e 2e 2e |t chaos.........| 00000900 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 20 59 6f 75 20 |........... You | 00000910 6d 69 67 68 74 20 73 61 79 20 27 2e 2e 2e 20 62 |might say '... b| 00000920 75 74 20 77 68 61 74 20 72 65 61 6c 20 75 73 65 |ut what real use| 00000930 20 64 6f 20 66 72 61 63 74 61 6c 73 20 68 61 76 | do fractals hav| 00000940 65 3f 27 2e 20 54 68 65 20 0a 63 6f 72 72 65 63 |e?'. The .correc| 00000950 74 20 61 6e 73 77 65 72 20 69 73 3a 20 4d 61 6e |t answer is: Man| 00000960 79 2c 20 73 75 63 68 20 61 73 20 69 6d 61 67 65 |y, such as image| 00000970 20 65 6e 68 61 6e 63 69 6e 67 2c 20 69 6d 61 67 | enhancing, imag| 00000980 65 20 0a 63 6f 6d 70 72 65 73 73 69 6e 67 2c 20 |e .compressing, | 00000990 73 69 6d 75 6c 61 74 69 6f 6e 73 20 6f 66 20 6c |simulations of l| 000009a0 69 66 65 20 28 65 67 20 70 6c 61 6e 74 73 29 2c |ife (eg plants),| 000009b0 20 65 6e 63 6f 64 69 6e 67 2c 20 61 6e 64 20 6d | encoding, and m| 000009c0 61 6e 79 0a 6d 6f 72 65 2e 0a 20 57 69 74 68 20 |any.more.. With | 000009d0 61 20 73 63 61 6e 6e 65 64 20 73 68 65 65 74 20 |a scanned sheet | 000009e0 6f 66 20 74 65 78 74 2c 20 74 68 65 20 71 75 61 |of text, the qua| 000009f0 6c 69 74 79 20 69 73 20 6e 6f 74 20 61 6c 77 61 |lity is not alwa| 00000a00 79 73 20 70 65 72 66 65 63 74 0a 61 6e 64 20 66 |ys perfect.and f| 00000a10 6f 72 20 63 6f 72 72 65 63 74 20 4f 43 52 20 28 |or correct OCR (| 00000a20 4f 70 74 69 63 61 6c 20 43 68 61 72 61 63 74 65 |Optical Characte| 00000a30 72 20 52 65 63 6f 67 6e 69 74 69 6f 6e 29 20 74 |r Recognition) t| 00000a40 68 65 20 71 75 61 6c 69 74 79 0a 6e 65 65 64 73 |he quality.needs| 00000a50 20 74 6f 20 62 65 20 69 6d 70 72 6f 76 65 64 2e | to be improved.| 00000a60 20 54 68 69 73 20 63 61 6e 20 62 65 20 64 6f 6e | This can be don| 00000a70 65 20 62 79 20 75 73 69 6e 67 20 61 20 66 72 61 |e by using a fra| 00000a80 63 74 61 6c 0a 61 6c 67 6f 72 69 74 68 6d 20 74 |ctal.algorithm t| 00000a90 6f 20 74 69 64 79 20 75 70 20 74 68 65 20 69 6d |o tidy up the im| 00000aa0 61 67 65 2e 0a 20 41 20 6c 61 72 67 65 20 70 69 |age.. A large pi| 00000ab0 63 74 75 72 65 20 63 61 6e 20 74 61 6b 65 20 61 |cture can take a| 00000ac0 6e 79 74 68 69 6e 67 20 75 70 20 74 6f 2c 20 61 |nything up to, a| 00000ad0 6e 64 20 6d 6f 72 65 20 74 68 61 6e 2c 20 6f 6e |nd more than, on| 00000ae0 65 20 6d 65 67 61 0a 62 79 74 65 20 28 31 30 34 |e mega.byte (104| 00000af0 38 35 37 36 20 62 79 74 65 73 29 20 61 6e 64 20 |8576 bytes) and | 00000b00 61 20 66 6c 6f 70 70 79 20 63 61 6e 20 62 65 20 |a floppy can be | 00000b10 66 69 6c 6c 65 64 20 75 70 20 56 65 72 79 20 71 |filled up Very q| 00000b20 75 69 63 6b 6c 79 2e 0a 41 6c 73 6f 20 69 66 20 |uickly..Also if | 00000b30 79 6f 75 20 74 72 79 20 74 6f 20 7a 6f 6f 6d 20 |you try to zoom | 00000b40 69 6e 20 72 65 73 6f 6c 75 74 69 6f 6e 20 69 73 |in resolution is| 00000b50 20 6c 6f 73 74 2e 20 42 75 74 20 69 66 20 74 68 | lost. But if th| 00000b60 65 20 73 63 72 65 65 6e 0a 69 73 20 74 75 72 6e |e screen.is turn| 00000b70 65 64 20 69 6e 74 6f 20 61 20 66 72 61 63 74 61 |ed into a fracta| 00000b80 6c 20 61 6c 67 6f 72 69 74 68 6d 2c 20 6f 6e 6c |l algorithm, onl| 00000b90 79 20 61 20 66 65 77 20 62 79 74 65 73 20 77 69 |y a few bytes wi| 00000ba0 6c 6c 20 62 65 0a 74 61 6b 65 6e 20 75 70 20 74 |ll be.taken up t| 00000bb0 6f 20 73 74 6f 72 65 20 69 74 2c 20 61 6e 64 20 |o store it, and | 00000bc0 69 66 20 79 6f 75 20 7a 6f 6f 6d 20 69 6e 20 28 |if you zoom in (| 00000bd0 75 70 20 74 6f 20 61 20 70 6f 69 6e 74 20 77 68 |up to a point wh| 00000be0 65 72 65 20 69 74 0a 75 73 75 61 6c 6c 79 20 62 |ere it.usually b| 00000bf0 65 63 6f 6d 65 73 20 69 6e 61 63 63 75 72 61 74 |ecomes inaccurat| 00000c00 65 29 20 72 65 73 6f 6c 75 74 69 6f 6e 20 77 69 |e) resolution wi| 00000c10 6c 6c 20 6e 6f 74 20 62 65 20 6c 6f 73 74 2e 20 |ll not be lost. | 00000c20 0a 20 42 69 6f 6c 6f 67 69 73 74 73 20 6e 6f 77 |. Biologists now| 00000c30 20 62 65 6c 69 65 76 65 20 74 68 61 74 20 44 4e | believe that DN| 00000c40 41 20 69 6e 20 6f 75 74 20 62 6f 64 69 65 73 20 |A in out bodies | 00000c50 69 73 20 6e 6f 74 20 6a 75 73 74 20 61 20 62 6c |is not just a bl| 00000c60 75 65 20 0a 70 72 69 6e 74 20 66 6f 72 20 6f 75 |ue .print for ou| 00000c70 72 73 65 6c 76 65 73 2c 20 62 75 74 20 61 20 66 |rselves, but a f| 00000c80 72 61 63 74 61 6c 20 61 6c 67 6f 72 69 74 68 6d |ractal algorithm| 00000c90 20 77 68 69 63 68 20 69 73 20 72 75 6e 20 74 6f | which is run to| 00000ca0 20 0a 67 72 6f 77 20 75 73 2e 20 53 6f 6d 65 20 | .grow us. Some | 00000cb0 66 72 61 63 74 61 6c 73 20 63 61 6e 20 76 65 72 |fractals can ver| 00000cc0 79 20 77 65 6c 6c 20 73 69 6d 75 6c 61 74 65 20 |y well simulate | 00000cd0 70 6c 61 6e 74 20 67 72 6f 77 74 68 20 61 6e 64 |plant growth and| 00000ce0 20 0a 63 6f 6d 65 20 75 70 20 77 69 74 68 20 61 | .come up with a| 00000cf0 20 76 65 72 79 20 6e 61 74 75 72 61 6c 20 6c 6f | very natural lo| 00000d00 6f 6b 69 6e 67 20 73 70 65 63 69 6d 65 6e 2e 0a |oking specimen..| 00000d10 0a 28 49 20 70 72 65 73 75 6d 65 20 79 6f 75 20 |.(I presume you | 00000d20 6b 6e 6f 77 20 77 68 61 74 20 61 20 70 69 78 65 |know what a pixe| 00000d30 6c 20 69 73 20 2d 20 66 6f 72 20 74 68 6f 73 65 |l is - for those| 00000d40 20 77 68 6f 20 64 6f 20 6e 6f 74 20 6b 6e 6f 77 | who do not know| 00000d50 20 0a 69 74 20 69 73 20 6a 75 73 74 20 61 20 64 | .it is just a d| 00000d60 6f 74 20 6f 6e 20 74 68 65 20 73 63 72 65 65 6e |ot on the screen| 00000d70 2e 20 54 68 69 73 20 77 68 6f 6c 65 20 64 69 73 |. This whole dis| 00000d80 70 6c 61 79 20 69 73 20 6d 61 64 65 20 75 70 20 |play is made up | 00000d90 6f 66 20 0a 6d 61 6e 79 20 70 69 78 65 6c 73 2c |of .many pixels,| 00000da0 20 75 73 75 61 6c 6c 79 20 61 72 6f 75 6e 64 20 | usually around | 00000db0 31 36 30 30 30 30 2e 29 0a 0a 0a 32 2e 59 6f 75 |160000.)...2.You| 00000dc0 72 20 66 69 72 73 74 20 66 72 61 63 74 61 6c 2e |r first fractal.| 00000dd0 0a 0a 20 42 69 66 75 72 63 61 74 65 20 69 73 20 |.. Bifurcate is | 00000de0 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 63 68 61 |the original cha| 00000df0 6f 73 20 66 6f 72 6d 75 6c 61 20 61 6e 64 20 69 |os formula and i| 00000e00 73 20 6d 61 64 65 20 75 70 20 6f 66 20 61 20 76 |s made up of a v| 00000e10 65 72 79 20 0a 73 69 6d 70 6c 65 20 66 6f 72 6d |ery .simple form| 00000e20 61 6c 20 77 68 69 63 68 20 77 61 73 20 66 69 72 |al which was fir| 00000e30 73 74 20 75 73 65 64 20 74 6f 20 64 65 73 63 72 |st used to descr| 00000e40 69 62 65 20 61 6e 69 6d 61 6c 20 0a 70 6f 70 75 |ibe animal .popu| 00000e50 6c 61 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 20 |lations:.. | 00000e60 20 20 4e 65 77 20 70 6f 70 75 6c 20 3d 20 47 72 | New popul = Gr| 00000e70 6f 77 74 68 20 52 61 74 65 20 2a 20 4f 6c 64 20 |owth Rate * Old | 00000e80 70 6f 70 75 6c 20 2a 20 28 20 31 20 2d 20 4f 6c |popul * ( 1 - Ol| 00000e90 64 20 70 6f 70 75 6c 20 29 0a 0a 77 68 65 72 65 |d popul )..where| 00000ea0 20 70 6f 70 75 6c 28 61 74 69 6f 6e 29 20 69 73 | popul(ation) is| 00000eb0 20 61 20 76 61 6c 75 65 20 62 65 74 77 65 65 6e | a value between| 00000ec0 20 30 20 61 6e 64 20 31 2e 20 57 69 74 68 20 67 | 0 and 1. With g| 00000ed0 72 6f 77 74 68 20 72 61 74 65 73 20 0a 6c 65 73 |rowth rates .les| 00000ee0 73 20 74 68 61 6e 20 32 30 30 25 2e 20 4f 76 65 |s than 200%. Ove| 00000ef0 72 20 32 30 30 25 20 61 6e 64 20 74 68 65 20 65 |r 200% and the e| 00000f00 71 75 61 74 69 6f 6e 20 73 70 6c 69 74 73 20 28 |quation splits (| 00000f10 62 69 66 75 72 63 61 74 65 73 29 20 0a 69 6e 74 |bifurcates) .int| 00000f20 6f 20 32 2c 20 74 68 65 6e 20 34 2c 20 74 68 65 |o 2, then 4, the| 00000f30 6e 20 62 65 63 6f 6d 65 73 20 63 68 61 6f 74 69 |n becomes chaoti| 00000f40 63 2e 20 54 68 69 73 20 63 61 6e 20 61 6c 73 6f |c. This can also| 00000f50 20 62 65 20 75 73 65 64 20 61 73 20 61 20 0a 70 | be used as a .p| 00000f60 73 65 75 64 6f 2d 72 61 6e 64 6f 6d 20 6e 75 6d |seudo-random num| 00000f70 62 65 72 20 67 65 6e 65 72 61 74 6f 72 2c 20 77 |ber generator, w| 00000f80 69 74 68 20 74 68 65 20 62 65 73 74 20 72 61 6e |ith the best ran| 00000f90 64 6f 6d 20 6f 75 74 70 75 74 20 67 72 6f 77 74 |dom output growt| 00000fa0 68 20 0a 72 61 74 65 20 6f 66 20 34 20 28 34 30 |h .rate of 4 (40| 00000fb0 30 25 29 2e 20 53 6f 6d 65 20 73 69 6d 70 6c 65 |0%). Some simple| 00000fc0 20 38 2d 62 69 74 20 63 6f 6d 70 75 74 65 72 73 | 8-bit computers| 00000fd0 20 28 65 67 2e 20 53 70 65 63 74 72 75 6d 20 65 | (eg. Spectrum e| 00000fe0 74 63 2e 29 20 0a 61 63 74 75 61 6c 6c 79 20 75 |tc.) .actually u| 00000ff0 73 65 20 74 68 69 73 20 6d 65 74 68 6f 64 20 66 |se this method f| 00001000 6f 72 20 67 65 6e 65 72 61 74 69 6e 67 20 72 61 |or generating ra| 00001010 6e 64 6f 6d 20 6e 75 6d 62 65 72 73 2e 0a 20 54 |ndom numbers.. T| 00001020 68 65 20 66 6f 72 6d 75 6c 61 20 69 73 20 70 6c |he formula is pl| 00001030 6f 74 74 65 64 20 77 69 74 68 20 74 69 6d 65 20 |otted with time | 00001040 61 63 72 6f 73 73 20 74 68 65 20 62 6f 74 74 6f |across the botto| 00001050 6d 20 61 78 69 73 20 28 58 29 20 61 6e 64 20 0a |m axis (X) and .| 00001060 70 6f 70 75 6c 61 74 69 6f 6e 20 6f 6e 20 74 68 |population on th| 00001070 65 20 73 69 64 65 20 61 78 69 73 20 28 59 29 2e |e side axis (Y).| 00001080 0a 20 54 68 69 73 20 69 73 20 61 20 76 65 72 79 |. This is a very| 00001090 20 73 69 6d 70 6c 65 20 66 72 61 63 74 61 6c 2c | simple fractal,| 000010a0 20 62 75 74 20 73 6f 6d 65 20 63 61 6e 20 62 65 | but some can be| 000010b0 20 76 65 72 79 20 63 6f 6d 70 6c 65 78 2e 20 57 | very complex. W| 000010c0 65 20 0a 73 68 61 6c 6c 20 6e 6f 74 20 67 6f 20 |e .shall not go | 000010d0 69 6e 74 6f 20 74 68 65 73 65 20 61 73 20 74 68 |into these as th| 000010e0 69 73 20 69 73 20 6f 6e 6c 79 20 61 6e 20 69 6e |is is only an in| 000010f0 74 72 6f 64 75 63 74 69 6f 6e 20 69 6e 74 6f 20 |troduction into | 00001100 0a 62 61 73 69 63 20 66 72 61 63 74 61 6c 73 2e |.basic fractals.| 00001110 0a 0a 0a 33 2e 43 6f 6d 70 6c 65 78 20 6e 75 6d |...3.Complex num| 00001120 62 65 72 73 2e 0a 0a 20 54 68 65 73 65 20 61 72 |bers... These ar| 00001130 65 20 6e 6f 74 20 61 73 20 74 68 65 79 20 73 6f |e not as they so| 00001140 75 6e 64 2c 20 62 75 74 20 74 68 65 20 69 64 65 |und, but the ide| 00001150 61 20 69 73 20 73 74 72 61 6e 67 65 2e 20 43 6f |a is strange. Co| 00001160 6d 70 6c 65 78 20 0a 6e 75 6d 62 65 72 73 20 77 |mplex .numbers w| 00001170 65 72 65 20 69 6e 76 65 6e 74 65 64 20 74 6f 20 |ere invented to | 00001180 73 6f 6c 76 65 20 61 20 70 72 6f 62 6c 65 6d 3a |solve a problem:| 00001190 20 59 6f 75 20 63 61 6e 20 6e 6f 74 20 77 6f 72 | You can not wor| 000011a0 6b 20 6f 75 74 20 0a 74 68 65 20 73 71 75 61 72 |k out .the squar| 000011b0 65 20 72 6f 6f 74 20 6f 66 20 61 20 6e 65 67 61 |e root of a nega| 000011c0 74 69 76 65 20 6e 75 6d 62 65 72 2e 20 41 73 20 |tive number. As | 000011d0 74 68 65 20 73 71 75 61 72 65 20 72 6f 6f 74 20 |the square root | 000011e0 69 73 20 74 68 65 20 0a 6e 75 6d 62 65 72 20 6d |is the .number m| 000011f0 75 6c 74 69 70 6c 69 65 64 20 62 79 20 69 74 73 |ultiplied by its| 00001200 65 6c 66 20 74 6f 20 67 65 74 20 74 68 65 20 66 |elf to get the f| 00001210 69 72 73 74 20 6e 75 6d 62 65 72 2c 20 61 6e 64 |irst number, and| 00001220 20 61 6e 79 0a 6e 75 6d 62 65 72 20 28 65 76 65 | any.number (eve| 00001230 6e 20 6e 65 67 61 74 69 76 65 29 20 6d 75 6c 74 |n negative) mult| 00001240 69 70 6c 69 65 64 20 62 79 20 69 74 73 65 6c 66 |iplied by itself| 00001250 20 61 6c 77 61 79 73 20 67 69 76 65 73 20 61 20 | always gives a | 00001260 0a 70 6f 73 69 74 69 76 65 20 72 65 73 75 6c 74 |.positive result| 00001270 2c 20 74 68 65 6e 20 74 68 65 20 73 71 75 61 72 |, then the squar| 00001280 65 20 72 6f 6f 74 20 6f 66 20 2d 31 20 69 73 20 |e root of -1 is | 00001290 69 6d 70 6f 73 73 69 62 6c 65 20 0a 28 69 6d 61 |impossible .(ima| 000012a0 67 69 6e 61 72 79 29 2e 20 54 6f 20 6f 76 65 72 |ginary). To over| 000012b0 20 63 6f 6d 65 20 74 68 69 73 20 64 69 66 66 69 | come this diffi| 000012c0 63 75 6c 74 79 20 69 74 20 77 61 73 20 64 65 63 |culty it was dec| 000012d0 69 64 65 64 20 74 68 61 74 0a 74 68 65 20 69 6d |ided that.the im| 000012e0 61 67 69 6e 61 72 79 20 6e 75 6d 62 65 72 20 28 |aginary number (| 000012f0 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 74 |represented by t| 00001300 68 65 20 6c 65 74 74 65 72 20 27 69 27 29 20 73 |he letter 'i') s| 00001310 71 75 61 72 65 64 20 77 61 73 20 0a 65 71 75 61 |quared was .equa| 00001320 6c 20 74 6f 20 6e 65 67 61 74 69 76 65 20 31 2e |l to negative 1.| 00001330 20 49 2e 45 2e 20 69 2a 69 3d 2d 31 20 61 6e 64 | I.E. i*i=-1 and| 00001340 20 69 5e 32 3d 2d 31 2e 20 54 68 61 74 20 69 73 | i^2=-1. That is| 00001350 20 74 68 65 20 6f 6e 6c 79 20 64 69 66 66 69 63 | the only diffic| 00001360 75 6c 74 20 0a 62 69 74 21 0a 20 48 65 72 65 20 |ult .bit!. Here | 00001370 61 72 65 20 73 6f 6d 65 20 65 78 61 6d 70 6c 65 |are some example| 00001380 73 20 6f 66 20 77 68 61 74 20 63 6f 6d 70 6c 65 |s of what comple| 00001390 78 20 6e 75 6d 62 65 72 73 20 6c 6f 6f 6b 20 6c |x numbers look l| 000013a0 69 6b 65 20 77 68 65 6e 20 0a 77 72 69 74 74 65 |ike when .writte| 000013b0 6e 20 64 6f 77 6e 3a 20 34 2b 37 69 20 28 77 68 |n down: 4+7i (wh| 000013c0 65 72 65 20 34 20 69 73 20 72 65 61 6c 20 70 61 |ere 4 is real pa| 000013d0 72 74 20 61 6e 64 20 37 69 20 74 68 65 20 69 6d |rt and 7i the im| 000013e0 61 67 69 6e 61 72 79 29 2c 20 0a 39 39 2d 34 32 |aginary), .99-42| 000013f0 69 2c 20 30 2b 32 69 2c 20 30 2b 30 69 2c 20 37 |i, 0+2i, 0+0i, 7| 00001400 2d 30 69 2c 20 61 2b 62 69 20 28 77 68 65 72 65 |-0i, a+bi (where| 00001410 20 61 20 61 6e 64 20 62 20 61 72 65 20 62 6f 74 | a and b are bot| 00001420 68 20 72 65 61 6c 20 0a 69 6e 74 65 67 65 72 73 |h real .integers| 00001430 29 2e 0a 20 54 68 65 20 6f 74 68 65 72 20 74 68 |).. The other th| 00001440 69 6e 67 20 74 6f 20 6b 6e 6f 77 20 69 73 20 74 |ing to know is t| 00001450 68 61 74 20 65 76 65 72 79 20 63 6f 6d 70 6c 65 |hat every comple| 00001460 78 20 6e 75 6d 62 65 72 20 69 73 20 6d 61 64 65 |x number is made| 00001470 20 75 70 20 0a 6f 66 20 74 77 6f 20 6f 74 68 65 | up .of two othe| 00001480 72 20 6e 75 6d 62 65 72 73 2c 20 6f 6e 65 20 74 |r numbers, one t| 00001490 68 65 20 72 65 61 6c 2c 20 6f 6e 65 20 74 68 65 |he real, one the| 000014a0 20 69 6d 61 67 69 6e 61 72 79 2e 20 54 68 65 73 | imaginary. Thes| 000014b0 65 20 74 77 6f 20 0a 6e 61 6d 65 73 20 68 61 76 |e two .names hav| 000014c0 65 20 6e 6f 20 72 65 61 6c 20 6d 65 61 6e 69 6e |e no real meanin| 000014d0 67 2c 20 69 74 20 69 73 20 6a 75 73 74 20 74 6f |g, it is just to| 000014e0 20 64 69 73 74 69 6e 67 75 69 73 68 20 62 65 74 | distinguish bet| 000014f0 77 65 65 6e 20 0a 74 68 65 6d 20 2d 20 74 68 65 |ween .them - the| 00001500 79 20 63 6f 75 6c 64 20 62 65 20 63 61 6c 6c 65 |y could be calle| 00001510 64 20 61 6e 79 20 74 68 69 6e 67 20 65 2e 67 2e |d any thing e.g.| 00001520 20 53 74 61 72 73 6b 79 20 61 6e 64 20 48 75 74 | Starsky and Hut| 00001530 63 68 2e 20 0a 41 6c 73 6f 20 61 20 63 6f 6d 70 |ch. .Also a comp| 00001540 6c 65 78 20 6e 75 6d 62 65 72 20 69 73 20 75 73 |lex number is us| 00001550 75 61 6c 6c 79 20 72 65 70 72 65 73 65 6e 74 65 |ually represente| 00001560 64 20 62 79 20 74 68 65 20 6c 65 74 74 65 72 20 |d by the letter | 00001570 27 5a 27 20 0a 61 6c 74 68 6f 75 67 68 20 69 74 |'Z' .although it| 00001580 20 63 6f 75 6c 64 20 62 65 20 61 6e 79 20 6c 65 | could be any le| 00001590 74 74 65 72 2e 20 54 6f 20 6b 65 65 70 20 69 74 |tter. To keep it| 000015a0 20 73 69 6d 70 6c 65 20 49 20 75 73 75 61 6c 6c | simple I usuall| 000015b0 79 20 74 61 6b 65 20 0a 5a 20 74 6f 20 62 65 20 |y take .Z to be | 000015c0 6d 61 64 65 20 6f 75 74 20 6f 66 20 74 68 65 20 |made out of the | 000015d0 74 77 6f 20 6e 75 6d 62 65 72 73 20 27 61 27 20 |two numbers 'a' | 000015e0 61 6e 64 20 27 62 69 27 20 77 68 65 72 65 20 74 |and 'bi' where t| 000015f0 68 65 20 27 69 27 20 0a 72 65 70 72 65 73 65 6e |he 'i' .represen| 00001600 74 73 20 61 6e 20 69 6d 61 67 69 6e 61 72 79 20 |ts an imaginary | 00001610 6e 75 6d 62 65 72 2e 0a 20 41 64 64 69 6e 67 20 |number.. Adding | 00001620 61 6e 64 20 6d 75 6c 74 69 70 6c 79 69 6e 67 20 |and multiplying | 00001630 74 77 6f 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 |two complex numb| 00001640 65 72 73 20 69 73 20 65 61 73 79 3a 0a 54 6f 20 |ers is easy:.To | 00001650 61 64 64 2c 20 79 6f 75 20 6a 75 73 74 20 61 64 |add, you just ad| 00001660 64 20 28 6f 72 20 6d 75 6c 74 69 70 6c 79 29 20 |d (or multiply) | 00001670 74 68 65 20 70 61 72 74 73 20 73 65 70 61 72 61 |the parts separa| 00001680 74 65 6c 79 2c 20 74 68 69 73 20 69 73 0a 73 68 |tely, this is.sh| 00001690 6f 77 6e 20 68 65 72 65 3a 0a 0a 20 33 2b 34 69 |own here:.. 3+4i| 000016a0 20 2b 20 36 2b 32 69 20 20 3d 20 39 2b 36 69 0a | + 6+2i = 9+6i.| 000016b0 20 39 2d 36 69 20 2b 20 32 2b 32 69 20 20 3d 20 | 9-6i + 2+2i = | 000016c0 31 31 2d 34 69 0a 2d 32 2d 33 69 20 2b 20 34 2d |11-4i.-2-3i + 4-| 000016d0 69 20 20 20 3d 20 32 2d 34 69 0a 0a 4d 75 6c 74 |i = 2-4i..Mult| 000016e0 69 70 6c 79 69 6e 67 20 69 73 20 6f 6e 6c 79 20 |iplying is only | 000016f0 73 6c 69 67 68 74 6c 79 20 6d 6f 72 65 20 64 69 |slightly more di| 00001700 66 66 69 63 75 6c 74 2c 20 79 6f 75 20 6d 75 73 |fficult, you mus| 00001710 74 20 72 65 6d 65 6d 62 65 72 20 0a 74 68 61 74 |t remember .that| 00001720 20 69 5e 32 3d 2d 31 2e 20 48 65 72 65 20 69 73 | i^2=-1. Here is| 00001730 20 61 20 77 6f 72 6b 65 64 20 65 78 61 6d 70 6c | a worked exampl| 00001740 65 3a 20 0a 0a 28 33 2d 32 69 29 2a 28 37 2b 34 |e: ..(3-2i)*(7+4| 00001750 69 29 20 3d 20 32 31 2b 31 32 69 2d 31 34 69 2d |i) = 21+12i-14i-| 00001760 38 69 5e 32 0a 3d 20 32 31 2d 32 69 2d 38 69 5e |8i^2.= 21-2i-8i^| 00001770 32 20 61 6e 64 20 61 73 20 69 5e 32 3d 2d 31 20 |2 and as i^2=-1 | 00001780 74 68 65 6e 20 28 33 2d 32 69 29 2a 28 37 2b 34 |then (3-2i)*(7+4| 00001790 69 29 3d 32 31 2d 32 69 2d 28 38 2a 2d 31 29 3d |i)=21-2i-(8*-1)=| 000017a0 20 20 32 39 2d 32 69 0a 0a 49 66 20 79 6f 75 20 | 29-2i..If you | 000017b0 77 61 6e 74 20 74 6f 20 73 71 75 61 72 65 20 61 |want to square a| 000017c0 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 2c | complex number,| 000017d0 20 74 68 65 6e 20 79 6f 75 20 6a 75 73 74 20 6d | then you just m| 000017e0 75 6c 74 69 70 6c 79 20 69 74 20 0a 62 79 20 69 |ultiply it .by i| 000017f0 74 73 65 6c 66 2e 20 54 68 69 73 20 69 73 20 73 |tself. This is s| 00001800 68 6f 77 6e 20 68 65 72 65 3a 0a 0a 20 28 33 2b |hown here:.. (3+| 00001810 34 69 29 5e 32 20 3d 20 39 2b 31 32 69 2b 31 32 |4i)^2 = 9+12i+12| 00001820 69 2b 31 36 69 5e 32 20 3d 20 39 2b 32 34 69 2b |i+16i^2 = 9+24i+| 00001830 31 36 69 5e 32 20 61 6e 64 20 61 73 20 69 5e 32 |16i^2 and as i^2| 00001840 3d 2d 31 20 74 68 65 6e 0a 20 28 33 2b 34 69 29 |=-1 then. (3+4i)| 00001850 5e 32 20 3d 20 39 2b 32 34 69 2b 28 31 36 2a 2d |^2 = 9+24i+(16*-| 00001860 31 29 20 3d 20 2d 37 2b 32 34 69 0a 0a 41 20 67 |1) = -7+24i..A g| 00001870 65 6e 65 72 61 6c 20 66 6f 72 6d 75 6c 61 20 77 |eneral formula w| 00001880 6f 75 6c 64 20 74 68 65 6e 20 62 65 3a 0a 0a 20 |ould then be:.. | 00001890 28 61 2b 62 69 29 5e 32 20 3d 20 61 5e 32 2b 61 |(a+bi)^2 = a^2+a| 000018a0 62 69 2b 61 62 69 2b 28 62 5e 32 2a 69 5e 32 29 |bi+abi+(b^2*i^2)| 000018b0 20 61 73 20 69 5e 32 3d 2d 31 20 74 68 65 6e 20 | as i^2=-1 then | 000018c0 3d 61 5e 32 2b 32 61 62 69 2d 62 5e 32 0a 0a 67 |=a^2+2abi-b^2..g| 000018d0 72 6f 75 70 20 74 68 65 20 72 65 61 6c 20 61 6e |roup the real an| 000018e0 64 20 69 6d 61 67 69 6e 61 72 79 20 74 65 72 6d |d imaginary term| 000018f0 73 20 74 6f 20 66 6f 72 6d 20 74 68 65 20 67 65 |s to form the ge| 00001900 6e 65 72 61 6c 20 74 65 72 6d 73 3a 0a 0a 20 61 |neral terms:.. a| 00001910 28 6e 2b 31 29 3d 61 28 6e 29 5e 32 2d 62 28 6e |(n+1)=a(n)^2-b(n| 00001920 29 5e 32 0a 20 62 28 6e 2b 31 29 3d 32 2a 61 28 |)^2. b(n+1)=2*a(| 00001930 6e 29 2a 62 28 6e 29 69 0a 0a 20 4f 6e 65 20 6d |n)*b(n)i.. One m| 00001940 6f 72 65 20 74 68 69 6e 67 20 74 6f 20 64 6f 20 |ore thing to do | 00001950 77 69 74 68 20 63 6f 6d 70 6c 65 78 20 6e 75 6d |with complex num| 00001960 62 65 72 73 20 61 6e 64 20 66 72 61 63 74 61 6c |bers and fractal| 00001970 73 20 69 73 2c 20 73 69 7a 65 2e 20 0a 57 68 65 |s is, size. .Whe| 00001980 6e 20 77 65 20 74 61 6c 6b 20 61 62 6f 75 74 20 |n we talk about | 00001990 73 69 7a 65 2c 20 77 65 20 6d 65 61 6e 2c 20 6f |size, we mean, o| 000019a0 6e 20 74 68 65 20 74 77 6f 20 70 6c 61 6e 65 73 |n the two planes| 000019b0 20 72 65 61 6c 20 61 6e 64 20 0a 69 6d 61 67 69 | real and .imagi| 000019c0 6e 61 72 79 2c 20 74 68 65 20 64 69 73 74 61 6e |nary, the distan| 000019d0 63 65 20 62 65 74 77 65 65 6e 20 74 68 65 20 70 |ce between the p| 000019e0 6f 73 69 74 69 6f 6e 20 61 6e 64 20 30 2c 30 2e |osition and 0,0.| 000019f0 20 59 6f 75 20 63 6f 75 6c 64 20 0a 6c 6f 6f 6b | You could .look| 00001a00 20 61 73 20 74 68 65 20 72 65 61 6c 20 61 6e 64 | as the real and| 00001a10 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 73 | imaginary parts| 00001a20 20 61 73 20 73 69 64 65 73 20 6f 66 20 61 20 72 | as sides of a r| 00001a30 69 67 68 74 2d 61 6e 67 6c 65 0a 74 72 69 61 6e |ight-angle.trian| 00001a40 67 6c 65 20 77 68 65 72 65 20 74 68 65 20 64 69 |gle where the di| 00001a50 73 74 61 6e 63 65 20 69 73 20 74 68 65 20 68 79 |stance is the hy| 00001a60 70 6f 74 65 6e 75 73 65 2e 20 54 6f 20 66 69 6e |potenuse. To fin| 00001a70 64 20 74 68 65 20 0a 68 79 70 6f 74 65 6e 75 73 |d the .hypotenus| 00001a80 65 20 79 6f 75 20 63 61 6e 20 75 73 65 20 50 79 |e you can use Py| 00001a90 74 68 61 67 6f 72 61 73 27 20 74 68 65 6f 72 65 |thagoras' theore| 00001aa0 6d 20 28 61 5e 32 3d 62 5e 32 2b 63 5e 32 29 2e |m (a^2=b^2+c^2).| 00001ab0 20 53 6f 20 74 6f 20 0a 66 69 6e 64 20 74 68 65 | So to .find the| 00001ac0 20 73 69 7a 65 20 6f 66 20 61 20 63 6f 6d 70 6c | size of a compl| 00001ad0 65 78 20 6e 75 6d 62 65 72 2c 20 79 6f 75 20 73 |ex number, you s| 00001ae0 71 75 61 72 65 20 62 6f 74 68 20 74 68 65 20 72 |quare both the r| 00001af0 65 61 6c 20 61 6e 64 20 0a 69 6d 61 67 69 6e 61 |eal and .imagina| 00001b00 72 79 20 70 61 72 74 73 2c 20 61 64 64 20 74 68 |ry parts, add th| 00001b10 65 6d 20 74 6f 67 65 74 68 65 72 2c 20 61 6e 64 |em together, and| 00001b20 20 74 68 65 6e 20 73 71 75 61 72 65 20 72 6f 6f | then square roo| 00001b30 74 20 74 68 69 73 2e 0a 20 41 20 73 74 72 61 69 |t this.. A strai| 00001b40 67 68 74 20 66 6f 72 77 61 72 64 20 72 65 73 75 |ght forward resu| 00001b50 6c 74 20 69 6e 20 63 6f 6d 70 6c 65 78 2d 6e 75 |lt in complex-nu| 00001b60 6d 62 65 72 20 74 68 65 6f 72 79 20 69 74 65 72 |mber theory iter| 00001b70 61 74 69 6f 6e 73 20 0a 67 75 61 72 61 6e 74 65 |ations .guarante| 00001b80 65 73 20 74 68 61 74 20 74 68 65 20 69 74 65 72 |es that the iter| 00001b90 61 74 69 6f 6e 73 20 77 69 6c 6c 20 64 72 69 76 |ations will driv| 00001ba0 65 20 5a 20 74 6f 20 69 6e 66 69 6e 69 74 79 2c |e Z to infinity,| 00001bb0 20 69 66 20 61 6e 64 20 0a 6f 6e 6c 79 20 61 74 | if and .only at| 00001bc0 20 73 6f 6d 65 20 73 74 61 67 65 20 5a 20 72 65 | some stage Z re| 00001bd0 61 63 68 65 73 20 61 20 73 69 7a 65 20 6f 66 20 |aches a size of | 00001be0 32 20 6f 72 20 67 72 65 61 74 65 72 2e 20 56 65 |2 or greater. Ve| 00001bf0 72 79 20 6d 61 6e 79 20 0a 70 6f 69 6e 74 73 20 |ry many .points | 00001c00 77 69 6c 6c 20 72 65 61 63 68 20 32 20 61 66 74 |will reach 2 aft| 00001c10 65 72 20 6f 6e 6c 79 20 61 20 66 65 77 20 69 74 |er only a few it| 00001c20 65 72 61 74 69 6f 6e 73 2c 20 74 68 65 20 6f 6e |erations, the on| 00001c30 65 73 20 74 68 61 74 20 64 6f 20 0a 6e 6f 74 20 |es that do .not | 00001c40 62 65 6c 6f 6e 67 20 74 6f 20 74 68 65 20 4d 61 |belong to the Ma| 00001c50 6e 64 6c 65 62 72 6f 74 20 53 65 74 2e 20 20 0a |ndlebrot Set. .| 00001c60 0a 20 44 6f 20 6e 6f 74 20 77 6f 72 72 79 20 69 |. Do not worry i| 00001c70 66 20 79 6f 75 20 64 69 64 20 6e 6f 74 20 66 6f |f you did not fo| 00001c80 6c 6c 6f 77 20 61 6c 6c 20 74 68 61 74 2c 20 69 |llow all that, i| 00001c90 74 20 77 69 6c 6c 20 62 65 63 6f 6d 65 20 0a 63 |t will become .c| 00001ca0 6c 65 61 72 20 74 6f 20 79 6f 75 20 69 6e 20 74 |lear to you in t| 00001cb0 69 6d 65 2e 20 45 76 65 6e 20 69 66 20 79 6f 75 |ime. Even if you| 00001cc0 20 63 6f 75 6c 64 20 6e 6f 74 20 70 6f 73 73 69 | could not possi| 00001cd0 62 6c 79 20 75 6e 64 65 72 73 74 61 6e 64 20 0a |bly understand .| 00001ce0 69 74 20 61 6c 6c 20 79 6f 75 20 6f 6e 6c 79 20 |it all you only | 00001cf0 6e 65 65 64 20 74 6f 20 6b 6e 6f 77 20 6f 66 20 |need to know of | 00001d00 74 68 65 20 67 65 6e 65 72 61 6c 20 74 65 72 6d |the general term| 00001d10 20 66 6f 72 20 73 71 75 61 72 69 6e 67 20 61 20 | for squaring a | 00001d20 0a 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 |.complex number | 00001d30 28 61 6e 64 20 74 68 65 20 62 69 74 20 61 62 6f |(and the bit abo| 00001d40 75 74 20 73 69 7a 65 29 20 66 6f 72 20 6d 6f 73 |ut size) for mos| 00001d50 74 20 66 72 61 63 74 61 6c 73 2e 20 53 6f 6d 65 |t fractals. Some| 00001d60 0a 66 72 61 63 74 61 6c 73 20 73 75 63 68 20 61 |.fractals such a| 00001d70 73 20 74 68 65 20 63 75 62 69 63 20 4a 75 6c 69 |s the cubic Juli| 00001d80 61 20 53 65 74 20 75 73 65 20 63 75 62 69 6e 67 |a Set use cubing| 00001d90 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 | complex numbers| 00001da0 2c 0a 62 75 74 20 77 65 20 77 69 6c 6c 20 6e 6f |,.but we will no| 00001db0 74 20 67 6f 20 69 6e 74 6f 20 74 68 6f 73 65 20 |t go into those | 00001dc0 69 6e 20 67 72 65 61 74 20 64 65 74 61 69 6c 2e |in great detail.| 00001dd0 20 41 62 6f 76 65 20 6f 6e 6c 79 20 63 6f 76 65 | Above only cove| 00001de0 72 73 20 0a 53 4f 4d 45 20 6f 66 20 74 68 65 20 |rs .SOME of the | 00001df0 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 74 |complex-number t| 00001e00 68 65 6f 72 79 2c 20 61 6e 64 20 69 66 20 79 6f |heory, and if yo| 00001e10 75 20 77 61 6e 74 20 74 6f 20 66 75 72 74 68 65 |u want to furthe| 00001e20 72 20 0a 79 6f 75 72 20 6b 6e 6f 77 6c 65 64 67 |r .your knowledg| 00001e30 65 20 74 68 65 6e 20 72 65 61 64 20 73 6f 6d 65 |e then read some| 00001e40 20 6f 6c 64 20 41 2d 6c 65 76 65 6c 20 6f 72 20 | old A-level or | 00001e50 64 65 67 72 65 65 20 6d 61 74 68 65 6d 61 74 69 |degree mathemati| 00001e60 63 73 0a 62 6f 6f 6b 73 20 6f 6e 20 74 68 65 20 |cs.books on the | 00001e70 73 75 62 6a 65 63 74 2e 0a 0a 34 2e 54 68 65 20 |subject...4.The | 00001e80 4a 75 6c 69 61 20 53 65 74 0a 0a 20 54 68 69 73 |Julia Set.. This| 00001e90 20 69 73 20 74 68 65 20 66 72 61 63 74 61 6c 20 | is the fractal | 00001ea0 74 68 61 74 20 49 20 63 68 6f 6f 73 65 20 62 65 |that I choose be| 00001eb0 63 61 75 73 65 20 49 20 68 61 76 65 20 73 65 65 |cause I have see| 00001ec0 6e 20 76 65 72 79 20 66 65 77 20 0a 43 4f 4c 4f |n very few .COLO| 00001ed0 55 52 20 6a 75 6c 69 61 20 73 65 74 73 2c 20 49 |UR julia sets, I| 00001ee0 20 68 61 76 65 20 6f 6e 6c 79 20 73 65 65 6e 20 | have only seen | 00001ef0 6f 6e 65 73 20 77 68 69 63 68 20 75 73 65 20 69 |ones which use i| 00001f00 6e 76 65 72 73 65 20 0a 69 74 65 72 61 74 69 6f |nverse .iteratio| 00001f10 6e 20 6d 65 74 68 6f 64 73 20 28 49 20 77 69 6c |n methods (I wil| 00001f20 6c 20 65 78 70 6c 61 69 6e 20 6c 61 74 65 72 29 |l explain later)| 00001f30 20 77 68 69 63 68 20 6f 6e 6c 79 20 67 69 76 65 | which only give| 00001f40 20 0a 6d 6f 6e 6f 63 68 72 6f 6d 65 20 69 6d 61 | .monochrome ima| 00001f50 67 65 73 2e 20 54 68 65 20 6f 74 68 65 72 20 72 |ges. The other r| 00001f60 65 61 73 6f 6e 20 69 73 20 74 68 61 74 20 74 68 |eason is that th| 00001f70 69 73 20 6f 6e 65 20 73 68 6f 77 73 20 68 6f 77 |is one shows how| 00001f80 20 74 6f 20 0a 70 6c 6f 74 20 61 20 62 61 73 69 | to .plot a basi| 00001f90 63 20 66 72 61 63 74 61 6c 20 75 73 69 6e 67 20 |c fractal using | 00001fa0 61 6e 20 69 6e 64 69 76 69 64 75 61 6c 20 70 69 |an individual pi| 00001fb0 78 65 6c 20 69 74 65 72 61 74 69 6f 6e 20 6d 65 |xel iteration me| 00001fc0 74 68 6f 64 2c 20 0a 61 6e 64 20 74 68 65 20 4a |thod, .and the J| 00001fd0 75 6c 69 61 20 53 65 74 20 69 73 20 61 6e 20 65 |ulia Set is an e| 00001fe0 61 73 79 20 6f 6e 65 20 74 6f 20 75 6e 64 65 72 |asy one to under| 00001ff0 73 74 61 6e 64 2e 0a 20 42 61 73 69 63 61 6c 6c |stand.. Basicall| 00002000 79 20 74 68 65 20 4a 75 6c 69 61 20 53 65 74 20 |y the Julia Set | 00002010 75 73 65 73 20 61 20 5a 5e 32 2b 43 20 66 6f 72 |uses a Z^2+C for| 00002020 6d 75 6c 61 20 77 68 69 63 68 20 69 73 20 69 74 |mula which is it| 00002030 65 72 61 74 65 64 20 0a 75 6e 74 69 6c 20 61 20 |erated .until a | 00002040 6c 69 6d 69 74 20 69 73 20 72 65 61 63 68 65 64 |limit is reached| 00002050 2c 20 74 68 69 73 20 69 73 20 64 6f 6e 65 20 66 |, this is done f| 00002060 6f 72 20 65 61 63 68 20 70 69 78 65 6c 2e 20 54 |or each pixel. T| 00002070 68 65 72 65 20 61 72 65 20 0a 61 6e 20 69 6e 66 |here are .an inf| 00002080 69 6e 69 74 65 20 6e 75 6d 62 65 72 20 6f 66 20 |inite number of | 00002090 64 69 66 66 65 72 65 6e 74 20 73 65 74 73 2c 20 |different sets, | 000020a0 65 61 63 68 20 6f 6e 65 20 69 73 20 64 65 66 69 |each one is defi| 000020b0 6e 65 64 20 62 79 20 74 68 65 20 0a 63 6f 6d 70 |ned by the .comp| 000020c0 6c 65 78 20 6e 75 6d 62 65 72 20 27 43 27 2e 20 |lex number 'C'. | 000020d0 42 6f 74 68 20 69 74 27 73 20 72 65 61 6c 20 61 |Both it's real a| 000020e0 6e 64 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 |nd imaginary par| 000020f0 74 73 20 64 65 66 69 6e 65 20 74 68 65 20 0a 73 |ts define the .s| 00002100 68 61 70 65 20 6f 66 20 74 68 65 20 4a 75 6c 69 |hape of the Juli| 00002110 61 20 53 65 74 20 61 6e 64 20 61 72 65 20 75 73 |a Set and are us| 00002120 75 61 6c 6c 79 20 28 72 6f 75 67 68 6c 79 29 20 |ually (roughly) | 00002130 62 65 74 77 65 65 6e 20 2d 32 20 61 6e 64 20 0a |between -2 and .| 00002140 32 2e 20 54 68 65 72 65 20 61 72 65 20 74 77 6f |2. There are two| 00002150 20 74 79 70 65 73 20 6f 66 20 4a 75 6c 69 61 20 | types of Julia | 00002160 53 65 74 20 2d 20 57 68 6f 6c 6c 79 20 43 6f 6e |Set - Wholly Con| 00002170 6e 65 63 74 65 64 20 61 6e 64 20 57 68 6f 6c 6c |nected and Wholl| 00002180 79 20 0a 44 69 73 2d 63 6f 6e 6e 65 63 74 65 64 |y .Dis-connected| 00002190 2e 20 57 68 6f 6c 6c 79 20 43 6f 6e 6e 65 63 74 |. Wholly Connect| 000021a0 65 64 20 69 73 20 75 73 75 61 6c 6c 79 20 77 69 |ed is usually wi| 000021b0 74 68 20 73 6d 61 6c 6c 20 70 61 72 74 73 20 74 |th small parts t| 000021c0 6f 20 0a 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e |o .the complex-n| 000021d0 75 6d 62 65 72 20 27 43 27 2e 0a 20 54 6f 20 70 |umber 'C'.. To p| 000021e0 6c 6f 74 20 61 20 70 61 72 74 69 63 75 6c 61 72 |lot a particular| 000021f0 20 4a 75 6c 69 61 20 53 65 74 20 79 6f 75 20 68 | Julia Set you h| 00002200 61 76 65 20 74 68 65 20 73 63 72 65 65 6e 20 72 |ave the screen r| 00002210 65 70 72 65 73 65 6e 74 69 6e 67 20 0a 74 68 65 |epresenting .the| 00002220 20 72 65 61 6c 28 58 29 20 61 6e 64 20 69 6d 61 | real(X) and ima| 00002230 67 69 6e 61 72 79 28 59 29 20 70 6c 61 6e 65 73 |ginary(Y) planes| 00002240 20 66 72 6f 6d 20 2d 32 20 74 6f 20 32 2e 20 54 | from -2 to 2. T| 00002250 68 65 6e 20 73 65 74 20 61 20 0a 63 6f 6d 70 6c |hen set a .compl| 00002260 65 78 2d 6e 75 6d 62 65 72 20 76 61 72 69 61 62 |ex-number variab| 00002270 6c 65 20 27 5a 27 20 74 6f 20 74 68 65 20 63 6f |le 'Z' to the co| 00002280 2d 6f 72 64 69 6e 61 74 65 73 20 6f 6e 20 74 68 |-ordinates on th| 00002290 65 20 73 63 72 65 65 6e 2e 20 0a 53 65 74 20 61 |e screen. .Set a| 000022a0 20 76 61 72 69 61 62 6c 65 20 63 6f 75 6e 74 20 | variable count | 000022b0 74 6f 20 7a 65 72 6f 2e 20 53 65 74 20 74 68 65 |to zero. Set the| 000022c0 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 | complex-number | 000022d0 76 61 72 69 61 62 6c 65 20 27 43 27 20 0a 74 6f |variable 'C' .to| 000022e0 20 74 68 65 20 76 61 6c 75 65 20 79 6f 75 20 77 | the value you w| 000022f0 61 6e 74 20 66 6f 72 20 74 68 65 20 70 61 72 74 |ant for the part| 00002300 69 63 75 6c 61 72 20 73 65 74 2e 20 4e 6f 77 20 |icular set. Now | 00002310 63 61 72 72 79 20 6f 75 74 20 74 68 65 0a 66 6f |carry out the.fo| 00002320 6c 6c 6f 77 69 6e 67 20 6c 6f 6f 70 3a 0a 0a 20 |llowing loop:.. | 00002330 20 20 20 20 20 20 20 2e 6c 6f 6f 70 20 20 20 5a | .loop Z| 00002340 3d 5a 5e 32 0a 20 20 20 20 20 20 20 20 20 20 20 |=Z^2. | 00002350 20 20 20 20 20 5a 3d 5a 2b 43 0a 20 20 20 20 20 | Z=Z+C. | 00002360 20 20 20 20 20 20 20 20 20 20 20 63 6f 75 6e 74 | count| 00002370 3d 63 6f 75 6e 74 2b 31 0a 20 20 20 20 20 20 20 |=count+1. | 00002380 20 20 20 20 20 20 20 20 20 49 46 20 63 6f 75 6e | IF coun| 00002390 74 3e 32 35 36 20 4f 52 20 53 49 5a 45 28 5a 29 |t>256 OR SIZE(Z)| 000023a0 3e 32 20 47 4f 54 4f 20 65 6e 64 0a 20 20 20 20 |>2 GOTO end. | 000023b0 20 20 20 20 20 20 20 20 20 20 20 20 47 4f 54 4f | GOTO| 000023c0 20 6c 6f 6f 70 0a 0a 20 41 73 73 69 67 6e 20 74 | loop.. Assign t| 000023d0 68 65 20 76 61 6c 75 65 20 6f 66 20 63 6f 75 6e |he value of coun| 000023e0 74 20 74 6f 20 74 68 65 20 63 6f 6c 6f 75 72 20 |t to the colour | 000023f0 6f 66 20 74 68 65 20 70 69 78 65 6c 2e 20 49 66 |of the pixel. If| 00002400 20 74 68 65 20 0a 73 69 7a 65 20 6f 66 20 5a 20 | the .size of Z | 00002410 68 61 73 20 6e 6f 74 20 72 69 73 65 6e 20 65 71 |has not risen eq| 00002420 75 61 6c 20 74 6f 2c 20 6f 72 20 61 62 6f 76 65 |ual to, or above| 00002430 20 32 2c 20 74 68 65 6e 20 74 68 65 20 70 69 78 | 2, then the pix| 00002440 65 6c 20 69 73 20 0a 62 6c 61 63 6b 2c 20 61 6e |el is .black, an| 00002450 64 20 62 65 6c 6f 6e 67 73 20 74 6f 20 74 68 65 |d belongs to the| 00002460 20 61 63 74 75 61 6c 20 4a 75 6c 69 61 20 53 65 | actual Julia Se| 00002470 74 2e 20 44 6f 20 74 68 69 73 20 66 6f 72 20 65 |t. Do this for e| 00002480 76 65 72 79 20 0a 70 69 78 65 6c 20 61 6e 64 20 |very .pixel and | 00002490 74 68 65 20 69 6d 61 67 65 20 77 69 6c 6c 20 62 |the image will b| 000024a0 75 69 6c 64 20 75 70 2e 0a 20 41 6e 20 65 78 61 |uild up.. An exa| 000024b0 6d 70 6c 65 20 70 72 6f 67 72 61 6d 20 77 72 69 |mple program wri| 000024c0 74 74 65 6e 20 69 6e 20 41 52 4d 20 42 42 43 20 |tten in ARM BBC | 000024d0 42 41 53 49 43 20 56 20 69 73 20 73 68 6f 77 6e |BASIC V is shown| 000024e0 20 68 65 72 65 3a 20 0a 28 65 78 61 6d 70 6c 65 | here: .(example| 000024f0 20 32 29 0a 20 20 20 20 20 20 20 20 20 31 20 50 | 2). 1 P| 00002500 52 4f 43 69 6e 69 74 0a 20 20 20 20 20 20 20 20 |ROCinit. | 00002510 31 30 20 72 65 61 6c 4d 49 4e 3d 2d 32 0a 20 20 |10 realMIN=-2. | 00002520 20 20 20 20 20 20 32 30 20 69 6d 61 67 4d 49 4e | 20 imagMIN| 00002530 3d 2d 32 0a 20 20 20 20 20 20 20 20 33 30 20 72 |=-2. 30 r| 00002540 65 61 6c 4d 41 58 3d 32 0a 20 20 20 20 20 20 20 |ealMAX=2. | 00002550 20 34 30 20 69 6d 61 67 4d 41 58 3d 32 0a 20 20 | 40 imagMAX=2. | 00002560 20 20 20 20 20 20 35 30 20 72 65 61 6c 43 3d 2d | 50 realC=-| 00002570 2e 37 35 0a 20 20 20 20 20 20 20 20 36 30 20 69 |.75. 60 i| 00002580 6d 61 67 43 3d 30 0a 20 20 20 20 20 20 20 20 37 |magC=0. 7| 00002590 30 20 78 79 53 49 5a 45 3d 32 35 36 0a 20 20 20 |0 xySIZE=256. | 000025a0 20 20 20 20 20 38 30 20 72 65 61 6c 49 4e 43 3d | 80 realINC=| 000025b0 28 72 65 61 6c 4d 41 58 2d 72 65 61 6c 4d 49 4e |(realMAX-realMIN| 000025c0 29 2f 78 79 53 49 5a 45 0a 20 20 20 20 20 20 20 |)/xySIZE. | 000025d0 20 39 30 20 69 6d 61 67 49 4e 43 3d 28 69 6d 61 | 90 imagINC=(ima| 000025e0 67 4d 41 58 2d 69 6d 61 67 4d 49 4e 29 2f 78 79 |gMAX-imagMIN)/xy| 000025f0 53 49 5a 45 0a 20 20 20 20 20 20 20 31 30 30 20 |SIZE. 100 | 00002600 69 6d 61 67 5a 3d 69 6d 61 67 4d 49 4e 0a 20 20 |imagZ=imagMIN. | 00002610 20 20 20 20 20 31 31 30 20 59 3d 30 0a 20 20 20 | 110 Y=0. | 00002620 20 20 20 20 31 32 30 20 52 45 50 45 41 54 0a 20 | 120 REPEAT. | 00002630 20 20 20 20 20 20 31 33 30 20 72 65 61 6c 5a 3d | 130 realZ=| 00002640 72 65 61 6c 4d 49 4e 0a 20 20 20 20 20 20 20 31 |realMIN. 1| 00002650 34 30 20 58 3d 30 0a 20 20 20 20 20 20 20 31 35 |40 X=0. 15| 00002660 30 20 52 45 50 45 41 54 0a 20 20 20 20 20 20 20 |0 REPEAT. | 00002670 31 36 30 20 72 65 61 6c 5a 5a 3d 72 65 61 6c 5a |160 realZZ=realZ| 00002680 0a 20 20 20 20 20 20 20 31 37 30 20 69 6d 61 67 |. 170 imag| 00002690 5a 5a 3d 69 6d 61 67 5a 0a 20 20 20 20 20 20 20 |ZZ=imagZ. | 000026a0 31 38 30 20 63 6f 75 6e 74 3d 30 0a 20 20 20 20 |180 count=0. | 000026b0 20 20 20 31 39 30 20 52 45 50 45 41 54 0a 20 20 | 190 REPEAT. | 000026c0 20 20 20 20 20 32 30 30 20 73 3d 72 65 61 6c 5a | 200 s=realZ| 000026d0 5a 5e 32 2d 69 6d 61 67 5a 5a 5e 32 0a 20 20 20 |Z^2-imagZZ^2. | 000026e0 20 20 20 20 32 31 30 20 69 6d 61 67 5a 5a 3d 32 | 210 imagZZ=2| 000026f0 2a 72 65 61 6c 5a 5a 2a 69 6d 61 67 5a 5a 0a 20 |*realZZ*imagZZ. | 00002700 20 20 20 20 20 20 32 32 30 20 72 65 61 6c 5a 5a | 220 realZZ| 00002710 3d 73 2b 72 65 61 6c 43 0a 20 20 20 20 20 20 20 |=s+realC. | 00002720 32 33 30 20 69 6d 61 67 5a 5a 3d 69 6d 61 67 5a |230 imagZZ=imagZ| 00002730 5a 2b 69 6d 61 67 43 0a 20 20 20 20 20 20 20 32 |Z+imagC. 2| 00002740 34 30 20 63 6f 75 6e 74 2b 3d 31 0a 20 20 20 20 |40 count+=1. | 00002750 20 20 20 32 35 30 20 55 4e 54 49 4c 20 28 72 65 | 250 UNTIL (re| 00002760 61 6c 5a 5a 5e 32 2b 69 6d 61 67 5a 5a 5e 32 29 |alZZ^2+imagZZ^2)| 00002770 3e 3d 32 20 4f 52 20 63 6f 75 6e 74 3e 3d 32 35 |>=2 OR count>=25| 00002780 36 0a 20 20 20 20 20 20 20 32 36 30 20 50 52 4f |6. 260 PRO| 00002790 43 70 6c 6f 74 28 58 2c 59 2c 63 6f 75 6e 74 29 |Cplot(X,Y,count)| 000027a0 0a 20 20 20 20 20 20 20 32 37 30 20 58 2b 3d 31 |. 270 X+=1| 000027b0 0a 20 20 20 20 20 20 20 32 38 30 20 72 65 61 6c |. 280 real| 000027c0 5a 2b 3d 72 65 61 6c 49 4e 43 0a 20 20 20 20 20 |Z+=realINC. | 000027d0 20 20 32 39 30 20 55 4e 54 49 4c 20 58 3e 3d 78 | 290 UNTIL X>=x| 000027e0 79 53 49 5a 45 0a 20 20 20 20 20 20 20 33 30 30 |ySIZE. 300| 000027f0 20 59 2b 3d 31 0a 20 20 20 20 20 20 20 33 31 30 | Y+=1. 310| 00002800 20 69 6d 61 67 5a 2b 3d 69 6d 61 67 49 4e 43 0a | imagZ+=imagINC.| 00002810 20 20 20 20 20 20 20 33 32 30 20 55 4e 54 49 4c | 320 UNTIL| 00002820 20 59 3e 3d 78 79 53 49 5a 45 0a 20 20 20 20 20 | Y>=xySIZE. | 00002830 20 20 33 33 30 20 45 4e 44 0a 20 20 20 20 20 20 | 330 END. | 00002840 20 33 34 30 20 3a 0a 20 20 20 20 20 20 20 33 35 | 340 :. 35| 00002850 30 20 44 45 46 50 52 4f 43 69 6e 69 74 0a 20 20 |0 DEFPROCinit. | 00002860 20 20 20 20 20 33 36 30 20 4d 4f 44 45 31 33 0a | 360 MODE13.| 00002870 20 20 20 20 20 20 20 33 37 30 20 6c 69 6e 6b 3d | 370 link=| 00002880 31 34 3a 70 63 3d 31 35 0a 20 20 20 20 20 20 20 |14:pc=15. | 00002890 33 38 30 20 44 49 4d 20 4d 43 20 26 31 30 30 0a |380 DIM MC &100.| 000028a0 20 20 20 20 20 20 20 33 39 30 20 46 4f 52 20 70 | 390 FOR p| 000028b0 61 73 73 25 3d 30 20 54 4f 20 32 20 53 54 45 50 |ass%=0 TO 2 STEP| 000028c0 20 32 0a 20 20 20 20 20 20 20 34 30 30 20 50 25 | 2. 400 P%| 000028d0 3d 4d 43 0a 20 20 20 20 20 20 20 34 31 30 20 5b |=MC. 410 [| 000028e0 4f 50 54 20 70 61 73 73 25 0a 20 20 20 20 20 20 |OPT pass%. | 000028f0 20 34 32 30 20 2e 76 64 75 20 45 51 55 44 20 31 | 420 .vdu EQUD 1| 00002900 34 38 3a 45 51 55 44 20 2d 31 0a 20 20 20 20 20 |48:EQUD -1. | 00002910 20 20 34 33 30 20 2e 70 6c 6f 74 20 4c 44 52 20 | 430 .plot LDR | 00002920 72 33 2c 76 64 75 0a 20 20 20 20 20 20 20 34 34 |r3,vdu. 44| 00002930 30 20 41 44 44 20 72 33 2c 72 33 2c 72 31 2c 4c |0 ADD r3,r3,r1,L| 00002940 53 4c 20 23 38 0a 20 20 20 20 20 20 20 34 35 30 |SL #8. 450| 00002950 20 41 44 44 20 72 33 2c 72 33 2c 72 31 2c 4c 53 | ADD r3,r3,r1,LS| 00002960 4c 20 23 36 0a 20 20 20 20 20 20 20 34 36 30 20 |L #6. 460 | 00002970 53 54 52 42 20 72 32 2c 5b 72 33 2c 72 30 5d 0a |STRB r2,[r3,r0].| 00002980 20 20 20 20 20 20 20 34 37 30 20 4d 4f 56 20 70 | 470 MOV p| 00002990 63 2c 6c 69 6e 6b 0a 20 20 20 20 20 20 20 34 38 |c,link. 48| 000029a0 30 20 5d 0a 20 20 20 20 20 20 20 34 39 30 20 4e |0 ]. 490 N| 000029b0 45 58 54 0a 20 20 20 20 20 20 20 35 30 30 20 53 |EXT. 500 S| 000029c0 59 53 20 22 4f 53 5f 52 65 61 64 56 64 75 56 61 |YS "OS_ReadVduVa| 000029d0 72 69 61 62 6c 65 73 22 2c 76 64 75 2c 76 64 75 |riables",vdu,vdu| 000029e0 0a 20 20 20 20 20 20 20 35 31 30 20 45 4e 44 50 |. 510 ENDP| 000029f0 52 4f 43 0a 20 20 20 20 20 20 20 35 32 30 20 3a |ROC. 520 :| 00002a00 0a 20 20 20 20 20 20 20 35 33 30 20 44 45 46 50 |. 530 DEFP| 00002a10 52 4f 43 70 6c 6f 74 28 58 2c 59 2c 63 6f 75 6e |ROCplot(X,Y,coun| 00002a20 74 29 0a 20 20 20 20 20 20 20 35 34 30 20 41 25 |t). 540 A%| 00002a30 3d 58 3a 42 25 3d 59 0a 20 20 20 20 20 20 20 35 |=X:B%=Y. 5| 00002a40 35 30 20 43 25 3d 63 6f 75 6e 74 20 4d 4f 44 20 |50 C%=count MOD | 00002a50 32 35 36 0a 20 20 20 20 20 20 20 35 36 30 20 43 |256. 560 C| 00002a60 41 4c 4c 70 6c 6f 74 0a 20 20 20 20 20 20 20 35 |ALLplot. 5| 00002a70 37 30 20 45 4e 44 50 52 4f 43 0a 0a 0a 20 59 6f |70 ENDPROC... Yo| 00002a80 75 20 6d 75 73 74 20 72 65 61 6c 69 73 65 20 74 |u must realise t| 00002a90 68 61 74 20 75 6e 64 65 72 73 74 61 6e 64 69 6e |hat understandin| 00002aa0 67 20 68 6f 77 20 74 6f 20 70 72 6f 67 72 61 6d |g how to program| 00002ab0 20 66 72 61 63 74 61 6c 73 20 63 61 6e 20 0a 62 | fractals can .b| 00002ac0 65 20 73 6c 69 67 68 74 6c 79 20 6d 6f 72 65 20 |e slightly more | 00002ad0 64 69 66 66 69 63 75 6c 74 20 74 68 61 6e 20 75 |difficult than u| 00002ae0 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 74 68 65 |nderstanding the| 00002af0 6d 2c 20 73 6f 20 69 66 20 79 6f 75 20 64 6f 20 |m, so if you do | 00002b00 0a 6e 6f 74 20 66 65 65 6c 20 74 68 61 74 20 79 |.not feel that y| 00002b10 6f 75 20 61 72 65 20 75 70 20 74 6f 20 64 6f 69 |ou are up to doi| 00002b20 6e 67 20 73 6f 6d 65 20 6d 6f 72 65 20 6f 6e 20 |ng some more on | 00002b30 70 72 6f 67 72 61 6d 73 20 74 6f 20 64 6f 20 0a |programs to do .| 00002b40 77 69 74 68 20 66 72 61 63 74 61 6c 73 0a 20 54 |with fractals. T| 00002b50 68 65 20 6d 65 74 68 6f 64 20 66 6f 72 20 70 6c |he method for pl| 00002b60 6f 74 74 69 6e 67 20 63 61 6e 20 62 65 20 77 68 |otting can be wh| 00002b70 61 74 20 65 76 65 72 20 79 6f 75 20 6c 69 6b 65 |at ever you like| 00002b80 2c 20 68 65 72 65 20 49 20 63 68 6f 6f 73 65 20 |, here I choose | 00002b90 0a 74 6f 20 64 69 72 65 63 74 6c 79 20 77 72 69 |.to directly wri| 00002ba0 74 65 20 74 6f 20 73 63 72 65 65 6e 20 6d 65 6d |te to screen mem| 00002bb0 6f 72 79 20 61 73 20 79 6f 75 20 64 6f 20 6e 6f |ory as you do no| 00002bc0 74 20 6e 65 65 64 20 74 6f 20 62 6f 74 68 65 72 |t need to bother| 00002bd0 0a 64 65 61 6c 69 6e 67 20 77 69 74 68 20 74 68 |.dealing with th| 00002be0 65 72 65 20 6e 6f 74 20 62 65 69 6e 67 20 74 68 |ere not being th| 00002bf0 65 20 73 61 6d 65 20 6e 75 6d 62 65 72 20 6f 66 |e same number of| 00002c00 20 70 69 78 65 6c 73 20 61 73 20 70 6c 6f 74 20 | pixels as plot | 00002c10 0a 6e 75 6d 62 65 72 73 2e 20 28 69 65 20 61 20 |.numbers. (ie a | 00002c20 70 6c 6f 74 20 63 6f 6d 6d 61 6e 64 20 63 61 6e |plot command can| 00002c30 20 74 61 6b 65 20 72 6f 75 67 68 6c 79 20 30 2d | take roughly 0-| 00002c40 31 30 32 34 20 61 73 20 61 20 63 6f 2d 0a 6f 72 |1024 as a co-.or| 00002c50 64 69 6e 61 74 65 2c 20 62 75 74 20 74 68 65 20 |dinate, but the | 00002c60 73 63 72 65 65 6e 20 69 6e 20 6d 6f 64 65 20 31 |screen in mode 1| 00002c70 33 20 68 61 73 20 6f 6e 6c 79 20 72 6f 75 67 68 |3 has only rough| 00002c80 6c 79 20 32 35 36 20 70 69 78 65 6c 73 20 0a 61 |ly 256 pixels .a| 00002c90 63 72 6f 73 73 20 61 6e 64 20 75 70 29 2e 0a 20 |cross and up).. | 00002ca0 49 6e 20 32 35 36 20 63 6f 6c 6f 75 72 20 73 63 |In 256 colour sc| 00002cb0 72 65 65 6e 20 6d 6f 64 65 73 20 73 75 63 68 20 |reen modes such | 00002cc0 61 73 20 4d 4f 44 45 20 31 33 20 69 74 20 69 73 |as MODE 13 it is| 00002cd0 20 65 61 73 79 20 74 6f 20 64 72 61 77 20 62 79 | easy to draw by| 00002ce0 20 0a 64 69 72 65 63 74 6c 79 20 77 72 69 74 69 | .directly writi| 00002cf0 6e 67 20 74 6f 20 74 68 65 20 73 63 72 65 65 6e |ng to the screen| 00002d00 20 61 73 20 65 61 63 68 20 70 69 78 65 6c 20 74 | as each pixel t| 00002d10 61 6b 65 73 20 6f 6e 65 20 62 79 74 65 2e 20 59 |akes one byte. Y| 00002d20 6f 75 20 0a 6a 75 73 74 20 73 65 6c 65 63 74 20 |ou .just select | 00002d30 74 68 65 20 63 6f 6c 6f 75 72 20 62 79 20 77 72 |the colour by wr| 00002d40 69 74 69 6e 67 20 61 20 6e 75 6d 62 65 72 20 62 |iting a number b| 00002d50 65 74 77 65 65 6e 20 30 20 61 6e 64 20 32 35 36 |etween 0 and 256| 00002d60 2e 20 41 6c 6c 20 0a 76 65 72 79 20 73 69 6d 70 |. All .very simp| 00002d70 6c 65 20 63 6f 6d 70 61 72 65 64 20 77 69 74 68 |le compared with| 00002d80 20 6f 74 68 65 72 20 6e 75 6d 62 65 72 20 6f 66 | other number of| 00002d90 20 63 6f 6c 6f 75 72 73 20 6d 6f 64 65 73 2e 20 | colours modes. | 00002da0 0a 4e 6f 72 6d 61 6c 6c 79 20 69 74 20 69 73 20 |.Normally it is | 00002db0 61 20 62 61 64 20 69 64 65 61 20 74 6f 20 77 72 |a bad idea to wr| 00002dc0 69 74 65 20 64 69 72 65 63 74 6c 79 20 74 6f 20 |ite directly to | 00002dd0 68 61 72 64 77 61 72 65 20 77 69 74 68 6f 75 74 |hardware without| 00002de0 20 0a 67 6f 69 6e 67 20 74 68 72 6f 75 67 68 20 | .going through | 00002df0 74 68 65 20 6f 70 65 72 61 74 69 6e 67 20 73 79 |the operating sy| 00002e00 73 74 65 6d 2c 20 61 6e 64 20 6f 6e 20 61 6e 20 |stem, and on an | 00002e10 41 72 63 68 69 6d 65 64 65 73 20 74 68 65 20 0a |Archimedes the .| 00002e20 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 20 64 6f |screen memory do| 00002e30 65 73 20 6e 6f 74 20 73 74 61 79 20 69 6e 20 74 |es not stay in t| 00002e40 68 65 20 73 61 6d 65 20 70 6c 61 63 65 20 61 73 |he same place as| 00002e50 20 6f 6e 20 61 20 42 42 43 2c 20 62 75 74 20 0a | on a BBC, but .| 00002e60 41 63 6f 72 6e 20 68 61 76 65 20 70 72 6f 76 69 |Acorn have provi| 00002e70 64 65 64 20 61 20 6e 69 63 65 20 6c 69 74 74 6c |ded a nice littl| 00002e80 65 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74 |e operating syst| 00002e90 65 6d 20 63 61 6c 6c 20 74 6f 20 66 69 6e 64 20 |em call to find | 00002ea0 0a 6f 75 74 20 65 78 61 63 74 6c 79 20 77 68 65 |.out exactly whe| 00002eb0 72 65 20 74 6f 20 77 72 69 74 65 20 74 6f 2e 0a |re to write to..| 00002ec0 20 49 6e 20 66 61 63 74 20 74 68 65 20 61 62 6f | In fact the abo| 00002ed0 76 65 20 6c 69 73 74 69 6e 67 20 28 65 78 61 6d |ve listing (exam| 00002ee0 70 6c 65 32 29 20 69 73 20 61 20 6c 6f 6e 67 20 |ple2) is a long | 00002ef0 76 65 72 73 69 6f 6e 20 6a 75 73 74 20 74 6f 20 |version just to | 00002f00 0a 6d 61 6b 65 20 68 6f 77 20 69 74 20 77 6f 72 |.make how it wor| 00002f10 6b 73 20 6d 6f 72 65 20 63 6c 65 61 72 2e 20 44 |ks more clear. D| 00002f20 6f 6e 27 74 20 62 6f 74 68 65 72 20 74 72 79 69 |on't bother tryi| 00002f30 6e 67 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 |ng to understand| 00002f40 20 0a 74 68 65 20 6d 61 63 68 69 6e 65 20 63 6f | .the machine co| 00002f50 64 65 20 70 6c 6f 74 74 69 6e 67 20 72 6f 75 74 |de plotting rout| 00002f60 69 6e 65 20 69 66 20 79 6f 75 20 68 61 76 65 20 |ine if you have | 00002f70 6e 6f 74 20 63 6f 6d 65 20 61 63 72 6f 73 73 20 |not come across | 00002f80 0a 74 68 69 73 20 73 6f 72 74 20 6f 66 20 74 68 |.this sort of th| 00002f90 69 6e 67 20 62 65 66 6f 72 65 20 61 73 20 69 74 |ing before as it| 00002fa0 20 77 69 6c 6c 20 6a 75 73 74 20 6d 61 6b 65 20 | will just make | 00002fb0 69 74 20 6d 6f 72 65 20 64 69 66 66 69 63 75 6c |it more difficul| 00002fc0 74 20 0a 66 6f 72 20 79 6f 75 20 74 6f 20 75 6e |t .for you to un| 00002fd0 64 65 72 73 74 61 6e 64 2e 20 48 65 72 65 20 61 |derstand. Here a| 00002fe0 72 65 20 61 20 66 65 77 20 65 78 61 6d 70 6c 65 |re a few example| 00002ff0 20 42 41 53 49 43 20 6f 6e 65 20 6c 69 6e 65 72 | BASIC one liner| 00003000 27 73 2c 20 0a 74 68 65 20 66 69 72 73 74 20 6f |'s, .the first o| 00003010 6e 65 20 69 73 20 74 68 65 20 73 61 6d 65 20 61 |ne is the same a| 00003020 73 20 74 68 65 20 61 62 6f 76 65 20 4a 75 6c 69 |s the above Juli| 00003030 61 20 53 65 74 20 70 6c 6f 74 74 65 72 2c 20 62 |a Set plotter, b| 00003040 75 74 20 0a 63 68 61 6e 67 65 64 20 61 6e 64 20 |ut .changed and | 00003050 63 6f 6d 70 61 63 74 65 64 20 6f 6e 74 6f 20 6f |compacted onto o| 00003060 6e 65 20 6c 69 6e 65 3a 0a 0a 4f 6e 65 20 6c 69 |ne line:..One li| 00003070 6e 65 20 4a 75 6c 69 61 20 53 65 74 20 70 6c 6f |ne Julia Set plo| 00003080 74 74 65 72 3a 0a 0a 46 6f 72 20 41 72 63 68 69 |tter:..For Archi| 00003090 2c 20 62 75 74 20 77 69 6c 6c 20 68 61 76 65 20 |, but will have | 000030a0 74 6f 20 74 79 70 65 20 69 6e 20 75 73 69 6e 67 |to type in using| 000030b0 20 42 41 53 49 43 20 45 64 69 74 6f 72 2e 0a 0a | BASIC Editor...| 000030c0 31 30 4d 4f 2e 31 33 3a 43 31 3d 2d 2e 37 35 3a |10MO.13:C1=-.75:| 000030d0 43 32 3d 30 3a 53 3d 32 34 35 3a 72 6e 3d 2d 32 |C2=0:S=245:rn=-2| 000030e0 3a 69 6e 3d 2d 32 3a 72 78 3d 32 3a 69 78 3d 32 |:in=-2:rx=2:ix=2| 000030f0 3a 72 69 6e 3d 28 72 78 2d 72 6e 29 2f 53 3a 0a |:rin=(rx-rn)/S:.| 00003100 69 69 6e 3d 28 69 78 2d 69 6e 29 2f 53 3a 69 5a |iin=(ix-in)/S:iZ| 00003110 3d 69 6e 3a 59 3d 30 3a 52 45 50 2e 3a 72 5a 3d |=in:Y=0:REP.:rZ=| 00003120 72 6e 3a 58 3d 30 3a 52 45 50 2e 3a 41 3d 72 5a |rn:X=0:REP.:A=rZ| 00003130 3a 42 3d 69 5a 3a 63 3d 30 3a 52 45 50 2e 3a 0a |:B=iZ:c=0:REP.:.| 00003140 73 3d 41 5e 32 2d 42 5e 32 2b 43 31 3a 42 3d 32 |s=A^2-B^2+C1:B=2| 00003150 2a 41 2a 42 2b 43 32 3a 41 3d 73 3a 63 2b 3d 31 |*A*B+C2:A=s:c+=1| 00003160 3a 55 4e 2e 28 41 5e 32 2b 42 5e 32 29 3e 3d 32 |:UN.(A^2+B^2)>=2| 00003170 4f 52 63 3e 3d 32 35 36 3a 47 43 4f 4c 30 2c 63 |ORc>=256:GCOL0,c| 00003180 20 0a 20 4d 4f 44 20 36 34 20 54 49 4e 54 20 63 | . MOD 64 TINT c| 00003190 20 44 49 56 34 3a 50 4f 49 4e 54 34 2a 58 2c 34 | DIV4:POINT4*X,4| 000031a0 2a 59 3a 58 2b 3d 31 3a 72 5a 2b 3d 72 69 6e 3a |*Y:X+=1:rZ+=rin:| 000031b0 55 4e 2e 58 3e 3d 53 3a 59 2b 3d 31 3a 0a 69 5a |UN.X>=S:Y+=1:.iZ| 000031c0 2b 3d 69 69 6e 3a 55 4e 2e 59 3e 3d 53 0a 0a 4c |+=iin:UN.Y>=S..L| 000031d0 65 73 73 20 65 61 73 69 6c 79 20 63 68 61 6e 67 |ess easily chang| 000031e0 65 64 20 41 72 63 68 69 20 76 65 72 73 69 6f 6e |ed Archi version| 000031f0 2c 20 61 6e 64 20 75 73 69 6e 67 20 6f 6e 6c 79 |, and using only| 00003200 20 36 34 20 63 6f 6c 6f 75 72 73 2e 0a 0a 31 30 | 64 colours...10| 00003210 4d 4f 44 45 31 33 3a 43 31 3d 2d 2e 37 35 3a 43 |MODE13:C1=-.75:C| 00003220 32 3d 30 3a 53 3d 32 34 35 3a 69 6e 63 3d 34 2f |2=0:S=245:inc=4/| 00003230 53 3a 59 3d 30 3a 69 5a 3d 2d 32 3a 52 45 50 2e |S:Y=0:iZ=-2:REP.| 00003240 3a 72 5a 3d 2d 32 3a 58 3d 30 3a 0a 52 45 50 2e |:rZ=-2:X=0:.REP.| 00003250 3a 41 3d 72 5a 3a 42 3d 69 5a 3a 63 3d 30 3a 52 |:A=rZ:B=iZ:c=0:R| 00003260 45 50 2e 3a 73 3d 41 5e 32 2d 42 5e 32 2b 43 31 |EP.:s=A^2-B^2+C1| 00003270 3a 42 3d 32 2a 41 2a 42 3a 41 3d 73 3a 63 2b 3d |:B=2*A*B:A=s:c+=| 00003280 31 3a 55 4e 54 49 4c 0a 28 41 5e 32 2b 42 5e 32 |1:UNTIL.(A^2+B^2| 00003290 29 3e 3d 32 4f 52 63 3e 3d 32 35 36 3a 47 43 4f |)>=2ORc>=256:GCO| 000032a0 4c 30 2c 63 20 4d 4f 44 20 36 34 3a 50 4f 49 4e |L0,c MOD 64:POIN| 000032b0 54 34 2a 58 2c 34 2a 59 3a 58 2b 3d 31 3a 72 5a |T4*X,4*Y:X+=1:rZ| 000032c0 2b 3d 69 6e 63 3a 0a 55 4e 54 49 4c 58 3e 3d 53 |+=inc:.UNTILX>=S| 000032d0 3a 59 2b 3d 31 3a 69 5a 2b 3d 69 6e 63 3a 55 4e |:Y+=1:iZ+=inc:UN| 000032e0 54 49 4c 59 3e 3d 53 0a 0a 49 6e 20 62 6f 74 68 |TILY>=S..In both| 000032f0 20 6f 66 20 74 68 65 20 61 62 6f 76 65 2c 20 63 | of the above, c| 00003300 68 61 6e 67 65 20 53 20 74 6f 20 74 68 65 20 73 |hange S to the s| 00003310 69 7a 65 20 6f 66 20 69 6d 61 67 65 20 72 65 71 |ize of image req| 00003320 75 69 72 65 64 2e 0a 0a 0a 0a 54 68 61 74 20 63 |uired.....That c| 00003330 6f 6e 63 6c 75 64 65 73 20 77 68 61 74 20 49 20 |oncludes what I | 00003340 61 6d 20 67 6f 69 6e 67 20 74 6f 20 73 61 79 20 |am going to say | 00003350 66 6f 72 20 6e 6f 77 2c 20 62 75 74 20 69 66 20 |for now, but if | 00003360 61 6e 79 6f 6e 65 20 0a 77 61 6e 74 73 20 6d 65 |anyone .wants me| 00003370 20 74 6f 20 63 6f 6e 74 69 6e 75 65 2c 20 73 65 | to continue, se| 00003380 6e 64 20 6d 65 20 a3 35 20 77 69 74 68 20 53 2e |nd me .5 with S.| 00003390 41 2e 45 2e 2c 20 6f 72 20 73 65 6e 64 20 6d 65 |A.E., or send me| 000033a0 20 61 20 0a 6c 65 74 74 65 72 2c 20 61 6e 64 20 | a .letter, and | 000033b0 49 20 77 69 6c 6c 20 70 75 74 20 69 74 20 69 6e |I will put it in| 000033c0 20 74 68 65 20 70 75 62 6c 69 63 20 64 6f 6d 61 | the public doma| 000033d0 69 6e 20 66 6f 72 20 79 6f 75 2e 0a 0a 0a 42 79 |in for you....By| 000033e0 65 20 2e 2e 2e 2e 20 66 6f 72 20 6e 6f 77 20 2e |e .... for now .| 000033f0 2e 2e 2e 2e 2e 2e 2e 0a 0a 0a |..........| 000033fa