Educational program - making fractals on the Spectrum.

Oberon #05
(C) ALK/Stars of Keladan H.G.             
                                          
MMA> Hey, Shurik,  do article about
  fractals.                            
ALK> Why, that's all  no one is interested anyway
  is processed by them...                      
MMA> Well then, the public, having seen the queue
  the bottom fractal in the demo will say:
  Oh, they pulled the signs off the Amiga again
  and build  on them Ferns and these...
  Mandelbrots...                      
                                          
     ...That's where it struck me  and it hurt me, you can
say for alive. What to do, position
obliges us to finally reveal the whole truth about
fractals.                                
Let's start, as always, with definitions. Fractus (lat.) - broken, fractional. Fractal, in application to mathematics, there is some object described by simple cyclic logical (or recursive) formulas, and co- who, most importantly, copies himself when the scale of calculations changes. But this is a definition. But what about in practice? The point is that that fractals do not exist only “on paper”, they are everywhere. For example measures, the circulatory system - artery on the pro- along the entire length it branches and decreases in diameter, each new branch is similar to the previous one also branches and decreases. If would not limit size cells, this branching would continue indefinitely tee. But this is a “simple” fractal. There are complications her for example, a leaf of a tree. If you pay attention detailslook closely at the veins on the leaf, then you can notice that each of them highlights the main "inflorescence" of the most painful shikh. And exactly the same can be said by accepting "secondary inflorescences" for the main ones. You can come up with an artificial tail yourself tal - for example, draw a square around draw four more squares of its vertices with a side 2-3 times smaller than that of a qua- drata-parent. Repeat this operation once 50 for each generation of squares.:[ ] Are you tired? ;) And now look at this creation - beautiful, not is it true? Beauty is in what is the power of fractals, it fascinates with its simplicity and INFINITY! And even more so armed with a computer instead of paper, you can create such landscapes!
Mandelbrot fractal. Here is its formula: Z(i+1)=Z(i)*Z(i)+C, where: Z - complex variable: C - complex constant: (i),(i+1) - steps of calculations and iterations.
Those who did not happen to study terrible the subject "Higher Mathematics" has probably already "loaded up" and think that this is so difficult for them to understand, which is not worth it and read all this further nonsense. Don't rush! I'll try to explain... ...not I undertake to be absolutely accurate, I will extremely brief. A complex number Z can be represented as: Z=a+j*b, where a, b - simple ordinary numbers, j - an imaginary unit, I won’t bother you head with this sucks, but surprisingly, j. multiplied by by the same j. equal to MINUS ALONE. Likewise. root of -l (insanity. yes?) will be equalj. If ordinary numbers are taken graphically to use the number line, then these are perverted - on numeric PLANES. These numbers have two coordinates, real (a), and imaginary (b), which and are deferred respectively along the X and Y axes on a plane tee. The point of intersection of these counts is This is a COMPLEX NUMBER.
Do you feel where I I'm heading? This whole thing it is possible (and should!) be displayed on a plane, namely on the plane of the screen. The question is how! To build a Mandelbrot fractal, you need We need to enumerate all points on our plane bones on subject of correspondence to the following condition. In the cycle from l to l0000 (no less!) you need easy to calculate the sequence: A:=a*a-b*b+x B:=2*a*b+y a:=A b:=B R:=SQR(a*a+b*b) i:=i+1 The first two lines are nothing more than vi- the formula you gave earlier Z:=z*z+c, but written in "normal" language. Explanation:a and b - real and imaginary part of the number Z, x and y - these are real and imaginary, respectively components of a complex number C. In our case - these are the coordinates of the point that it is necessary to calculate. During the calculations for one point x and y do not change.The following two lines are most likely only needed for clarity - after calculations A andB produced assignment of new results to the original ones for the next cycle. The penultimate line is the most important. This is not nothing more than CONDITION under which it is necessary stop the cycle. It is logical to assume that here the total "size" of the number is calculated Z, its value. This is where it starts interesting. It turns out that for different points on plane size R in a loop calculations will “behave” differently. For some points there will be some kind of exact value, for other values R will rapidly “fly away” to +/- infinity frailty. Evaluating with what speed the point “flies away” to infinity, you can gra- physically display it in corresponding colors volume on a plane. For computer calculation that here introduced last that string cycle i:=i+1. By the number of steps taken - with this program you can judge the speed "flying away" points - the fewer cycles, the faster (brighter, but not a fact) point on a plane bones flies to infinity.Before per- the first cycle, of course, valuesa,b,iob- are zeroed. But here occurs problem - computer "does not know" what infinite ity, or rather knows, but then it’s too late - message type Number too big will not slow down appear. Here it is necessary to accept the following the following assumption: for "infinity" Well, that's a very large number. Yes, more about limits. To calculate all points on a plane bones you still need to select, PDE calculate poke. And you need to calculate within the limits: from -2.S to +l.S for x-, from -2 to +2 for
y-component of the number C, i.e. near the origin of coordinates - exactly there "fractal collisions" occur, mainly waist area plane does not occur nothing interesting. WHERE will you settle to type and with what STEP to sort through the points on plane (i.e. with what magnification) is The question is purely creative. "All this is wonderful," - you say, "but than here SPECTRUM, only he'll be an idiot count 10000 cycles for each point planes measuring 256*192. Not only that this damn thing will be count two days BASIC, it is still unknown how to display press the dots with color!" Don't despair, I with full responsibility I honestly declare: Mandelbrot on SPECTRUM - reality. No need to wait two days - min- ta from strength! And color - we have an ATTRIBU- YOU colors! Naturally, no BASIC. Code, and only code. On disk you you will find original text "mandelbr.C" with comment- riami in ASCII encoding and similar "mandelbr.XAS" (no comments) for XAS- assembler I don't pretend to be swearing. the procedures there are the mostкрутые", но зато они МОИ !
Are you looking for a girl, what do you think? Then go to the "EXIT" box. I'm not sure what to do with it. те эти сопли. вас ждёт ВТОРАЯ серия!" © Mr.SECOND Small Girl (Julia). Size: Z(i+1)=Z(i)*Z(i)+C
Как вы, наверное, уже заметили, эта форму- ла точь-в-точь повторяет формулу фрактала Мандельброта. И это неудивительно - ведь Мандельброт и Жюлиа - близнецы-братья. мы говорим "Мандельброт". подразумеваем - party... ;) ...There was such a man, from the company IBM, he came up with and began to study using a computer Yutera (can you guess which one twice?): Well and I don’t know anything about Julia, Probably it was a friend of Mandelbrot :), and he I first looked at on "brainchild" a little with another point of view: If we take as the initial condition of the iteration Z(0)=0, and change C-constant from point to point, then we get a Mandelbrot fractal, about what I tried to tell you unsuccessfully :) above:
On the contrary, if we accept C for a constant that does not change from points to point, and change Z(0), equal to the point coordinate ki, then we get a set Julia... Of course, because that that constants C exists infinitely- fine quantity, view fractal Julia _essentially_ depends on the constant C. The lion's share of these values "generates" ugly figures - something like spots, faint distinguishable against the main background. According to my own experience I can say that the values C should be somewhere in the range- lah +/- 5,and both composition- lying this number C (not for- were?) in most cases have opposite signs. By the way, those procedures, about which spoke you- more, you can remake for расчёта Жюлиа. А что касается пределов на комплексной плоскости - то они ос- таются теми- же,что и для Мандельброта Значение константы Julia: C=0.36-j0.37
Множества
Julia more suitable definition of a fractal - no matter how we "increase- personalized" scale images, we will contemplate the same picture, except perhaps the color scheme will shift, but this is not tell about Mandelbrot - with increasing the picture and form still change. If look from a practical point of view nia, then with the help of Julia-Mandelbrot you can do the following: Zooming - calculate image "in depth", changing at each step of "brute force" points. It's better on the Spectrumcalculate first in advance, and then... show how animation, believe me, this will look it's cool that you could see in demos EYE ACHE II/CBS (Mandelbrot was there) and INSANE /ЗSC HARDCORE (the same Mandelbrot). Morphing - for Mandelbrot fractal on each frame you can change the evaluation criterion ki "infinity" and then when viewing "film" you can see how the fractal smoothly turns from a perfect circle, bending returning to its original form. ...for the Julia fractal on each frame you can but
smoothly change the parameter C,as one, and other components. Naturally with a small change C fractal shape will change insignificantly. Here this, I tell you I will say, not just cool, but very cool! When viewing you can see how literally against an empty background a fractal “blooms”, meandering weaving and twisting into unimaginable patterns. On Spectrum this has not been done (yet :)). Ob- ownersof the "blue calculator"could do this see in PC demos. Voxel Mapping - if abstract
from the colors of the points that make up the fractal, andat- take the "weight" of a point not by color, but by height, then you can “show” fractal landscapes From the side, moving above relieffractal, occasionally turning and changing height "flight". Well, what can I say? how about? This is also not bad, especially since Spectrum Voxel Mapping'and there were all sorts of - Multicolor (EYE ACHE II), Chunky (Refresh,Blame),Attribute (Insane). But here Fractal Voxel Mapping'and on the Spectrum also there wasn't, although it's surprising why no one guessed instead of relief map to create a fractal one? ...Well, so to speak, “for general development” you can imagine Mandelbrot fractal- Julia, as a formula: Z(i+1)=Z(i)^N+C, where ^N - this is construction in degree N,where N more 2-x.
In general, there will be mathematics here even more will be calculated slower, in short, the brakes on Spec will be terrible... ... but the picture will look beautiful!!! Fractal "Fern" Affine set.
This fractal is calculated differently principle than the Mandelbrot family. If for Mandelbrot image is obtained sequentially, point by point, then for affine fractals construction of "sequential body-coordinate". ...... ...... ' . Scheme .... . . '
' . папоротника .. ' . .. 0 ' .'. . .. . .' .' . '. ' . . . . ' ' . ' . 1 | 2 .' . .' ' ' ' . . '. .' . ' . ' 4-┐ '.......... . ' . . ...'''. '. 0 . . .┴'' '. 3 . .' . .' 0 '.........' ..' .' ....''' ''''''''.........'''''' Цифрой 0 обозначен большой лист - это на- ружные контуры папоротника: 1,2 и 3 - меньшие поthe size of the leaves, which which are obtained from 0 by rotation, translation and scaling: 4 - petiole, which is actually also similar to 0, but strongly compressed in transverse direction board. The construction comes down to the following: There is a certain mathematical transformation nie which will be discussed below, with its using the coordinates of the screen point, where you want to put the pixel. This the transformation depends on the coordinates of the previous current points and from the so-called probable numeric coefficient. If you cyclically call this is a transformation (about 1000- 4000 times) and after each put it on the screen point, then in the end you will get a picture approximately reminiscent of the one shown in the beginning of the section. Since there are four “figures”, to construct it is necessary to use one of the four formulas: x(i+1) = a1*x(i) + b1*y(i) + e1 (1) y(i+1) = c1*x(i) + d1*y(i) + f1 x(i+1) = a2*x(i) + b2*y(i) + e2 (2) y(i+1) = c2*x(i) + d2*y(i) + f2 x(i+1) = a3*x(i) + b3*y(i) + e3 (3) y(i+1) = c3*x(i) + d3*y(i) + f3 x(i+1) = a4*x(i) + b4*y(i) + e4 (4) y(i+1) = c4*x(i) + d4*y(i) + f4 xy(i+1) and xy(i) - traditionally, the following and previous coordinate values: a,b,c,d,e,f - conversion coefficients, four groups for each. That is, each transformation is set to 6 coefficients (a,b,c,d,e,f), a full configuration future fern floor is fully specified by 24 parameters. Now the question arises, which of the four transforms to use? Use you need all 4. At each step, naturally, used only one. How to choose - randomly, but not evenly. Degree probability of using transformation is proportional to area corresponding figures. The sum of the areas is conditionally equal to 1 or 100%, respectively sum probabilities should also be equal to 1. Что же касается реализации этого на Спек- труме, то для папоротника имеем: ┌-┬-----┬-----┬-----┬-----┬-----┬-----┬--┐ │N│ а b c d e f р │ ├-┼-----┼-----┼-----┼-----┼-----┼-----┼--┤ │1│ 0.00│ 0.00│ 0.00│ 0.16│ 0.00│ 0.00│ 1│ │2│ 0.85│ 0.04│-0.04│ 0.85│ 0.00│ 1.60│84│ │3│ 0.20│-0.26│ 0.23│ 0.22│ 0.00│ 1.60│07│ │4│-0.15│ 0.28│ 0.26│ 0.24│ 0.00│ 0.44│07│ └-┴-----┴-----┴-----┴-----┴-----┴-----┴--┘ Р - вероятность использования, в %% Реализоватьprobabilistic execution of that or another formula simply: 1. Calculate a random number within 0- 255 (one byte, if implemented on ASMA): 2. If the number is less than 3, then the formula is (1): 3. If the number is less than 21, then the formula is (3): 4. If the number is less than 39, then the formula is (4): 5. Otherwise, the formula remains (2): 0 3 21 39 255 ├---┼--------┼--------┼-----------------┤ 3/256 18/256 18/256 (256-39)/256 1% 7% 7% 84% Where do come from? For each figures 1-4 we set three coordinates each, this may be the coordinates of the beginning and end of the sheet plus more sheet point, most distant from the line connecting this beginning and end. Thus, we have four systems we equations: ┌ x1 = x1*a1 + y1*b1 + e1 │ y1 = x1*c1 + y1*d1 + f1 │ x2 = x2*a1 + y2*b1 +e1 │ y2 = x2*c1 + y2*d1 + f1 │ x3 = x3*a1 + y3*b1 + e1 └ y3 = x3*c1 + y3*d1 + f1, where х123,y123 - specified coordinates (known): a,b,c,d,e,f - unknown quantities. Having solved each system of 6 equations with 6 unknown each, you can find the one you are looking for group parameters a, b, c, d, e, f for each leaf. How to decide? I don’t know and don’t ask :) Well... what knew - told. Go for it fractals on Spectrum - a little-studied thing naya. ------══════════════════════════════------ * * * * * Р.S. The article was prepared based on materials: 1. Magazine "Technology-Youth" N9,199X: 2. Own research and observations: 3. ProgramsFractal eXtreme Explorer/PC: 4. DemoRiseDemo/GLOBAL Corp.,NOUMENON/i: 5. FAQ fido-conferences DEMO.DESIGN. R.P.S. I almost forgot, there is this one in the box what a program, it's called FRACTALS. Burzhuyskaya she, however. Well, in general, you understand me...

Share your thoughts about the article