Fractal Geometry

Edito by Martha Boeckenfeld

Martha Boeckenfeld

Human Technology is nothing. Nature's adaptability is smarter than we can ever imagine.

From the camouflage abilities of chameleons to the shape-shifting octopus, organisms have evolved incredible ways to adapt and evolve to their environments. Birds creating beautiful nests beating any architect.

5 Lessons we can learn from nature in our lives using technology in a smart and responsible way.

  1. Adaptability
    Nature's adaptability is inspiring. From the camouflage abilities of chameleons to the shape-shifting octopus, organisms have evolved incredible ways to adapt to their environments. In technology, this principle is becoming increasingly important with the rise of AI and machine learning, allowing systems to adapt to new data and situations.
  2. Efficiency
    The efficiency of natural systems is unparalleled. Consider how a tree's branching structure maximises sunlight absorption, or how a cheetah's body is perfectly optimised for speed. This efficiency often comes from millions of years of evolutionary refinement. In tech, we're still learning to create such efficient systems, particularly in areas like energy use and resource management.
  3. Social community
    Nature's ecosystems are fascinating. From ant colonies to wolf packs, many species demonstrate complex social structures and teamwork. In technology, open-source projects and collaborative platforms are great examples of how we're applying this principle.
  4. Continuous learning
    Evolution is nature's way of continuous learning. Each generation potentially brings beneficial adaptations. In tech, this aligns with the concept of iterative development and the importance of user feedback in refining products and services.
  5. Sustainability
    The most crucial lesson from nature is sustainability. Natural ecosystems operate in closed loops where nothing is wasted. As we face global environmental challenges, incorporating this principle into our technological development is more important than ever.

Biomimicry seeks to emulate nature's designs and processes.

Green technologies aim to create more sustainable, nature-inspired systems.

→ While our technology has made remarkable progress, we're still far from matching the elegance, efficiency, and sustainability of natural systems.

By continuing to learn from and be inspired by nature, we can create technologies that are not only more advanced but also more in harmony with our world. Follow Martha Boeckenfeld on Linkedin.

The scientist does not study nature because it is useful to do so. He studies it because he takes pleasure in it, and he takes pleasure in it because it is beautiful. If nature were not beautiful it would not be worth knowing, and life would not be worth living. — Henri Poincaré
I believe that scientific knowledge has fractal properties, that no matter how much we learn, whatever is left, however small it may seem, is just as infinitely complex as the whole was to start with — Isaac Asimov (I Asimov, 1995)

Geometry
Equations are just the boring part of mathematics. I attempt to see things in terms of geometry. — Stephen Hawking


A revolutionary system helps measure and understand the wondrous complexity of nature

For thousands of years, the smooth and regular shapes of classical geometry — lines and planes, triangles and cones, circles and spheres — have helped humans measure and understand the world around them. But when it comes to describing the complexity of nature, these smooth constructions often turn out to be the wrong kind of abstraction. Nature is rough and irregular, and until recently this irregularity was impossible to measure. That changed, thanks to the work of Benoît Mandelbrot, a maverick mathematician and research scientist. He noted that clouds are not perfect spheres, mountains are not symmetric cones, and lightning doesn’t travel in a straight line.

Mandelbrot, who spent 35 years at IBM, pioneered the discovery of the principles that would later form an entirely new field — fractal geometry. He coined the term “fractal” to refer to a new class of mathematical shapes whose uneven contours mimicked the irregularities found in nature.

Since its discovery, fractal geometry has informed breakthroughs in everything from biology and telecommunications to climate science and filmmaking. Of central importance to its discovery was the advent of the computer. Because Mandelbrot had access to IBM’s high-powered computers, he was among the first to use computer graphics to create and display complex fractal geometric images and reveal hidden patterns.

Benoît Mandelbrot, the father of fractals
Benoît Mandelbrot, the ‘father of fractals’

Mandlebrot believed that fractals were a more natural way to describe the world around us

Thinking visually

Mandlebrot finds patterns in noise: In 1961, Mandelbrot was working for IBM as a research scientist at the Thomas J. Watson Research Center in Yorktown Heights, New York. The company was involved in transmitting computer data over phone lines, but a kind of white noise kept disturbing the information flow, and Mandelbrot was tasked with providing a new perspective on the problem.

Since he was a boy, Mandelbrot had thought in visual terms, so he instinctively viewed the white noise in terms of the shapes it generated. A graph of the turbulence quickly revealed a peculiar characteristic. Regardless of the scale of the graph, whether it represented data over the course of a day, an hour or a second, the pattern of disturbance was surprisingly similar. There was a larger structure at work.

Mandelbrot knew he was onto something with potentially far-reaching implications. The seemingly chaotic white noise hid a degree of order, and this insight could be applied to many aspects of not only the natural world but also human constructs such as the seemingly random fluctuations of financial markets.

Where there is life there is a pattern, and where there is a pattern there is mathematics.
- John D. Barrow

An example of fractal artwork
An example of fractal artwork

A new word for a new type of geometry

Measuring a jagged landscape: To describe such structures, Mandelbrot coined the term fractal, a derivative from the Latin word fractus, meaning broken or uneven. Fractals are a form of geometric repetition, in which successively smaller copies of a pattern are nested inside each other, so that the same intricate shapes appear repeatedly.

Mandelbrot’s work on fractals has roots in a question he encountered as a young researcher: How long is the coast of Britain? The answer, he was surprised to discover, depends on how closely one looks. On a map, the contours of Britain may appear relatively smooth, but zooming in will reveal jagged edges. When these edges are properly accounted for, the coast becomes far longer. Zooming in further reveals even more coastline, all the way down to atomic scale. As a result, the length of the coastline is, in a sense, infinite. Mandelbrot believed that fractals were in many ways a more natural way to describe the world around us than the artificially smooth objects of traditional geometry.

Imagination of nature is far, far greater than the imagination of man.
— Richard Feynman

At IBM, Mandelbrot found a group of like-minded colleagues and was afforded a great deal of freedom to pursue his investigations. The combination of computing power, an inquisitive research team and intellectual independence provided the necessary tools to develop a new branch of geometry.

Fractals everywhere

Clouds, trees, human heartbeats: It wasn’t until the 1982 book, The Fractal Geometry of Nature, in which Mandelbrot highlighted the many occurrences of fractal objects in nature, that his insights would receive widespread attention. For example, each split in a tree – from trunk to limb to branch to twig – is remarkably similar, yet with subtle differences that provide increasing detail and insight into the inner workings of the entire tree. His fractals explorations touched off a revolution in numerous areas of science, industry and art. For instance, the outlines of clouds and coastlines, once considered unmeasurable, could now be approached in a rigorously quantitative fashion. The geometry of fractals has also helped explain how galaxies cluster, how mammalian brains fold as they grow, and how landscapes fragment in an earthquake zone.

Fractal geometry is also used to model the human lung, blood vessels, neurological systems, and many other physiological processes. The human heart was always thought to beat in a regular, linear fashion, but studies have shown that its true rhythm fluctuates in a distinctively fractal pattern. Blood is also distributed throughout the body in a fractal manner, and researchers have created models of blood flows for early detection of cancerous cells. Graphic designers and filmmakers took advantage of Mandelbrot’s creation to model lifelike “fractal worlds,” prominent in films such as Star Trek II: The Wrath of Khan and Return of the Jedi.

Fractals also play a role in climate science. Researchers have shown that the distribution of large branches to smaller branches in a single tree exactly replicates the distribution of large trees to smaller trees in an entire forest. This information is used to measure how much carbon dioxide a single forest is capable of processing, with the goal of applying the findings to every forest on Earth, quantifying how much carbon dioxide the entire world can safely absorb.

We have merely scratched the surface of what fractal geometry can teach us about the world

nowhere
A 1987 IBM advertisement promoting fractal geometry, Benoît Mandelbrot and the IBM Fellows program"


Benoît Mandelbrot biography

Infinite length in fractal terms
Left: A rocky inlet illustrates a coastline of ‘infinite’ length in fractal terms
Right: The ‘father of fractals’ provided a new system for measuring and understanding nature

Although to penetrate into the intimate mysteries of nature and thence to learn the true causes of phenomena is not allowed to us, nevertheless it can happen that a certain fictive hypothesis may suffice for explaining many phenomena. — Leonhard Euler

He was called the “father of fractals” and “the man who reshaped geometry.” Mathematician and research scientist Benoît Mandelbrot changed the way we view and measure the world and sparked a revolution in numerous areas of science, industry and art.

Mandelbrot coined the term “fractal” to refer to a new class of mathematical shapes with uneven contours that could mimic the irregular shapes often found in nature. Fractals are a form of geometric repetition, in which successively smaller copies of a pattern are nested inside each other so that the same intricate shapes appear repeatedly. Mandelbrot believed such irregular shapes were in many ways more natural than the artificially smooth objects of traditional geometry, and that they could have broad applicability.

Fractal geometry made it possible for the first time to measure cloud formations, the contours of coastlines, the clustering of galaxies, even the folds of mammalian brains, in a rigorously quantitative fashion.

Relentlessly curious

A maverick outsider with a knack for noticing hidden patterns: Mandelbrot was a restless inquisitor who often strayed from his chosen field of mathematics to investigate how fractals applied to physics, biology, medicine, economics, fluid dynamics and computer graphics. Over the course of his career he developed a reputation as a maverick outsider with a relentless curiosity and a knack for noticing hidden patterns. “He knew everybody, with interests going off in every possible direction,” said David Mumford, a professor emeritus of applied mathematics at Brown University. “Every time he gave a talk, it was about something different.”

Mathematics is the language of nature. — Fibonacci

During his 35-year career at IBM, Mandelbrot was afforded the freedom to foster his unconventional insights as well as given access to the most advanced information technology. The combination provided the necessary tools to develop an entirely new branch of geometry, which traces back to a question he encountered as a young researcher: How long is the coast of Britain? The answer, he was surprised to discover, depends on how closely one looks.

On a map, the contours of Britain may appear relatively smooth, but zooming in will reveal jagged edges that add up to a longer coast. Zooming in further reveals even more coastline, all the way down to atomic scale. The length of the coastline, in a sense, is infinite.

He knew everybody, with interests going off in every possible direction
— David Mumford
Professor emeritus of applied mathematics at Brown University

A new geometry of the cosmos

An irregular path reveals a life’s work: Mandelbrot’s upbringing was as irregular as the fractal worlds he explored. Born to a Lithuanian Jewish family in Warsaw in 1924, he fled from the Nazis with his family in 1936 — first to Paris and then to the south of France, where he tended horses and fixed tools. As a Polish émigré in France, and then as a French émigré in the US after World War II, his schooling was irregular and discontinuous. He earned a master’s degree in aeronautics at the California Institute of Technology, returned to Paris for his doctorate in mathematics in 1952, then went on to the Institute for Advanced Study in Princeton, New Jersey, where he did research.

equations

In 1958, Mandelbrot took a position at the Thomas J. Watson Research Center in Yorktown Heights, New York, where he was asked to examine the problem of extraneous “noise” in IBM’s electronic transmission lines. He discovered that the noise tended to appear in bunches, with patterns that remained constant whether plotted by the second or by the hour.

There was a larger structure at work. This type of activity — measuring structures and making sense of seeming chaos — would become Mandelbrot’s life’s work. The net result was nothing less than a new geometry of the cosmos.

Benoît Mandelbrot
Benoît Mandelbrot, 1975

Benoît Mandelbrot
There is a fascinating connection between infinity and fractals, which are geometric shapes that have self-similarity at different scales. For example, the Mandelbrot set is a fractal that is defined by a simple formula, but it has an infinitely complex boundary that contains copies of itself at smaller and smaller scales. The area of the Mandelbrot set is finite, but its perimeter is infinite.

A revolution in the study of disorder

Fractals in science, industry and art: It wasn’t until Mandelbrot’s 1982 book, The Fractal Geometry of Nature, in which he highlighted the many occurrences of fractal objects in nature, that his insights would receive widespread attention. Each split in a tree — from trunk to limb to branch to twig — is remarkably similar, yet subtle differences provide increasing detail, complexity and insight into the inner workings of the entire tree.

quantum mechanics

Mandelbrot’s work touched off a revolution in the study of turbulence and disorder across science, industry and art. For millennia, the human heart was believed to beat in a regular, linear fashion, but studies have shown that the true rhythm of a healthy heart fluctuates in a distinctively fractal pattern. Blood is also distributed throughout the body in a fractal manner, and researchers have created mathematical models of blood flows for early detection of cancerous cells.

Fractal-based antennae that pick up the widest range of known frequencies are now used in many wireless devices. Graphic design and image editing programs use fractals to create stunningly lifelike landscapes for films. Climate scientists perform fractal statistical analyses of forests that measure and quantify how much carbon dioxide the world can safely process.


Fractals (5:48)
 

The rewards of a distinguished career

Mandelbrot joins the ranks of Einstein and Fermi: In recognition of his groundbreaking work, Mandelbrot received more than 15 honorary doctorates and numerous awards, including the Barnard Medal for Meritorious Service to Science, past recipients of which include Albert Einstein and Enrico Fermi. Throughout his career, Mandelbrot cherished his role as an outsider who questioned conventional wisdom and remained on the periphery of traditional dogmas.

Even after living in America for decades, he claimed not to know the alphabet, and that having to use a telephone book reduced him to near helplessness. “From the very beginning, his angle has been to show people that they were making faulty assumptions simply because they didn’t have the tools to look beyond them,” noted Mumford.

Mandelbrot died in 2010 at age 85. He often credited his pioneering work on fractal geometry to his own life’s seemingly chaotic pattern. “Every discovery I made while at IBM fell well outside the scope of any university department,” Mandelbrot said. “I did not add new fields because of boredom or coercion, but because of new opportunities.”

Benoît Mandelbrot
Throughout his career, Mandelbrot cherished his role as an outsider who questioned conventional wisdom and remained on the periphery of traditional dogmas

My life seemed to be a series of events and accidents. Yet when I look back I see a pattern. — Benoît Mandelbrot

12-minute Mandelbrot: fractals on a 50 year old IBM 1401 mainframe

When I found out that the Computer History Museum has a working IBM 1401 computer, I wondered if it could generate the Mandelbrot fractal. I wrote a fractal program in assembly language and the computer chugged away for 12 minutes to create the Mandelbrot image on its line printer. In the process I learned a bunch of interesting things about the IBM 1401, which I discuss in this article.

The IBM 1401 mainframe computer (left) at the Computer History Museum printing the Mandelbrot fractal on the 1403 printer (right). Note: this is a line printer, not a dot matrix printer.

The IBM 1401 computer was announced in 1959, and went on to become the best-selling computer of the mid-1960s, with more than 10,000 systems in use. The 1401 leased for $2500 a month (about $20,000 in current dollars), a low price that let many more companies use computers. Even a medium-sized business could use the 1401 for payroll, accounting, inventory, order processing, invoicing, analysis, and many other tasks. The 1401 was called the Model-T of the computer industry due to its low price and great popularity. Even for its time, IBM 1401 only had moderate performance, especially compared to a high-end business computer like the IBM 7080 (rental fee: $48,000 a month). But the IBM 1401 became hugely popular because of its affordability, reliability, ease of use, high-quality printer and stylish appearance.

The 1401 was an early all-transistorized computer. These weren't silicon transistors, though, they were germanium transistors, the technology before silicon. The transistors and other components were mounted on circuit boards about the size of a playing card. These boards were called Standard Modular System (SMS) boards and each one provided a function such as a flip flop or simple logic functions. The IBM 1401 could contain thousands of SMS cards, depending on the features installed - the basic system had about 933 cards, while the system I used has 2881 SMS cards. (For more information on SMS cards, see my earlier article.)

SMS cards inside the IBM 1401
SMS cards inside the IBM 1401. These cards are part of the tape drive control, amplifying signals read from tape.

The SMS cards plug into racks (which IBM confusingly calls "gates"), that fold out from the computer as shown below. The 1401 is designed for easy maintenance - to access a gate, you just grab the handle and it swings out from the computer, exposing the wires and boards for maintenance. At the bottom of the gate, wiring harnesses connect the gate to other parts of the computer. There are 24 of these gates in total.

SMS cards inside the IBM 1401
The IBM 1401 computer is built from thousands of SMS circuit cards. This open rack (called a gate) shows about 150 SMS cards.

Unusual features of the IBM 1401

It's interesting to look at old computers because they do things very differently. Some of the unusual features of the IBM 1401 are that it used decimal arithmetic and 6-bit characters, it had arbitrary-length words, and additional instructions were available for a rental fee. The IBM 1401 is based on decimal arithmetic, not binary. Of course it uses 0's and 1's internally, but numbers are stored as digits using binary coded decimal (BCD). The number 123 is stored as three characters: '1', '2', and '3'. If you add 7 and 8, you get the digit 1 and the digit 5. Addresses are in decimal, so storage is in multiples of 1000, not 1024: the system with 16K of memory stores exactly 16,000 characters. All arithmetic is done in base-10. So if you divide two numbers, the IBM 1401 does base-10 long division, in hardware.

The IBM 1401 does not use bytes. Instead, it uses 6-bit BCD storage. Every character is stored as a 4-bit BCD digit with two extra bits called "zone bits", named A and B. The two extra zone bits allow upper-case letters (and a few special symbols) to be stored, as well as digits. Using a byte as the unit of operation didn't become popular until later with the IBM System/360; in the early 1960s, computers often used strange word sizes such as 13, 17, 19, 22, 26, 33, 37, 41, 45, and 50 bit words.

The photo below shows the core memory module from the IBM 1401, with 4,000 characters of memory. Each bit is stored in a tiny donut-shaped ferrite core with wires running through it. The core module is more complex than you'd expect, with 16 layers (frames) in total. Eight frames hold the 6 bits of data, plus the word mark bits (explained below) and parity bits. Six frames hold data from the card reader brushes and the print hammers, for data and error checking. The remaining two frames are just used for wiring.

core w400
The 4000 character core memory module from the IBM 1401 computer requires a huge amount of wiring.

Probably the most unusual feature of the 1401 is that it uses variable-length words, with word marks indicating each word. You might expect that variable-length words would let you use words of perhaps 8, 16, and 32 bits. But the IBM 1401 permitted words of arbitrarily many characters, up to the total size of memory! For instance, an instruction could move a 47-character string, or add 11-digit numbers. (Personally, I think it's easier to think of it as variable-length fields, rather than variable-length words.)

The word mark itself is a bit that is set on a memory location to indicate the boundary of a word (i.e. field). An instruction on the IBM 1401 processes data through memory sequentially until it hits a word mark. It's important to remember that word marks are not part of the characters, but more like metadata, so they remain as new data records are read in and processed. The main motivation behind variable-length words was to save expensive core memory, since each field length can be fit to the exact size required.

Another interesting thing about the IBM 1401 is that many instructions were extra-price options. The "advanced programming" feature provided new instructions for moving records, storing registers, and using index registers; this required the installation of 105 new SMS cards and (coincidentally) cost $105 a month. Even the comparison instruction cost extra. Because the 1401 uses BCD, you can't just subtract two characters to compare them as you would on most processors. Instead, the 1401 uses a bunch of additional circuitry for comparison, about 37 SMS cards for which you pay $75 a month. Renting the printer buffer feature for $375 a month added a separate core storage module, 267 more SMS cards, and two new instructions. The bit test instruction cost only $20 a month and additional card punch control instructions were $25 a month. If you bought one of these features, an IBM engineer would install the new cards and move some wires on the backplane to enable the feature. The wire-wrapped backplanes made it relatively easy to update the wiring in the field.

The 1401 could be expanded up to 16,000 characters of core memory storage: 4,000 characters in the 1401 itself, and 12,000 characters in a 1406 expansion box, about the size of a dishwasher. The 12K expansion sold for $55,100 (about $4.60 per character), or rented for $1,575 a month. (You can see why using memory efficiently was important.) Along with the expanded memory came additional instructions to manipulate the larger addresses.

cores s500
The tiny magnetic cores providing storage inside the IBM 1401's 4,000 character memory. Wires pass through each core to read and write memory. You can see multiple layers of cores in this photo.

One feature that you'd expect a computer to have is a subroutine call instruction and a stack. This is something the 1401 didn't have. To call a subroutine on the IBM 1401, you jump to the start of the subroutine. The subroutine then stores the return address into a jump instruction at the end, actually modifying the code, so at the end of the subroutine it jumps back to the caller. If you want recursion, you're on your own.

Some advanced features of the 1401

Compared to modern computers, the IBM 1401 is extremely slow and limited. But it's not as primitive as you might expect and it has several surprisingly advanced features.

One complex feature of the IBM 1401 is Editing, which is kind of like printf implemented in hardware. The Edit instruction takes a number such as 00123456789 and a format string. The computer removes leading zeros and inserts commas as needed, producing an output such as 1,234,567.89. With the optional Expanded Editing feature (just $20/month more), you can obtain floating asterisks (******1,234.56) or a floating dollar sign ($1,234.56), which is convenient for printing checks. Keep in mind that this formatting is not done with a subroutine; it is implemented entirely in hardware, with the formatting applied by discrete transistors.

Another advanced feature of the IBM 1401 is extensive checking for errors. With tens of thousands of components on thousands of boards, many things can go wrong. The 1401 catches malfunctions so they don't cause a catastrophe (such as printing million dollar payroll checks). First, the memory, internal data paths, instruction decode, and BCD conversion are all protected by parity and validity checks. The ALU uses qui-binary addition to detect arithmetic errors. The card reader reads each card twice and compares the results. The 1401 verifies the printer's operation on each line. (The read, punch, and print checks use the additional core memory planes discussed earlier.) As a result, the 1401 turned out to be remarkably reliable.

Because the IBM 1401 has variable word length, it can perform arbitrary-precision arithmetic. For instance, it can multiply or divide thousand-digit numbers with a single instruction. Try doing that on your Intel processor! (I tried multiplying 1000-digit numbers on the 1401; it takes just under a minute.) Hardware multiply/divide is another extra-cost feature; to meet the 1401's price target, they made it an option with the relatively steep price of $325 per month. You do get a lot of circuitry for that price, though - about 246 additional SMS cards installed in two gates. And remember, this is decimal multiplication and division, which is much more difficult to do in hardware than binary.

The 1401 I used is the Sterling model which it supports arithmetic on pounds/shillings/pence, which is a surprising thing to see implemented in hardware. (Up until 1971, British currency was expressed in pounds, shillings, and pence, with 12 pence in a shilling and 20 shillings in a pound. This makes even addition complicated, as tourists often discovered.) By supporting currency arithmetic in hardware, the 1401 made code faster and simpler.

IBM 1401
A maze of wire-wrapped wires on the back of a gate connects the circuits of the IBM 1401 computer. The wiring was installed by automated machinery, but the wiring could be modified by field engineers as needed.

Implementing the Mandelbrot in 1401 assembly language

Writing the Mandelbrot set code on the 1401 is a bit tricky since I did it in assembly language (called Autocoder). The hardest part was thinking about word marks. Another complication was the 1401 doesn't have native floating point arithmetic, so I used fixed point: I scaled each number by 10000, so I could represent 4 decimal places with an integer. The 1401 is designed for business applications, not scientific applications, so it's not well-suited for fractal generation. But it still got the job done.

The 1401 didn't need to be programmed in assembly language - it supports languages such as Fortran and COBOL - but I wanted the full 1401 experience. It does amaze me though that you can run a COBOL compiler on a machine with just 4,000 characters of memory. The Fortran compiler required a machine with 8,000 memory location; in order to fit, it ran in 63 separate phases.

The assembly language code for the Mandelbrot fractal is shown below. The first part of the code defines constants and variables with DCW. This is followed by three nested loops to loop over each row, each column, and the iterations for each pixel. Some of the instructions in the code are M (multiply), A (add), S (subtract), and C (compare). Comments start with asterisks.

  Benoît Mandelbrot Youtube's playlist 

 JOB  MANDELBROT
 *GENERATES A MANDELBROT SET ON THE 1401
 *KEN SHIRRIFF  HTTP://RIGHTO.COM
           CTL  6641
           ORG  087
 X1        DCW  001  *INDEX 1, COL COUNTER TO STORE PIXEL ON LINE
           ORG  333
 *
 *VALUES ARE FIXED POINT, I.E. SCALED BY 10000
 *Y RANGE (-1, 1). 60 LINES YIELDS INC OF 2/60*10000
 *
 YINC      DCW  333
 XINC      DCW  220          *STEP X BY .0220
 *
 *Y START IS -1, MOVED TO -333*30 FOR SYMMETRY
 *
 Y0        DCW  -09990       *PIXEL Y COORDINATE
 *
 *X START IS -2.5
 *
 X0INIT    DCW  -22000       *LEFT HAND X COORDINATE
 X0        DCW  00000        *PIXEL X COORDINATE
 ONE       DCW  001
 ZR        DCW  00000        *REAL PART OF Z
 ZI        DCW  00000        *IMAGINARY PART OF Z
 ZR2       DCW  00000000000  *ZR^2
 ZI2       DCW  00000000000  *ZI^2
 ZRZI      DCW  00000000000  *2 *ZR *ZI
 ZMAG      DCW  00000000000  *MAGNITUDE OF Z: ZR^2 + ZI^2
 TOOBIG    DCW  00400000000  *4 (SCALED BY 10000 TWICE)
 I         DCW  00           *ITERATION LOOP COUNTER
 ROW       DCW  01
 ROWS      DCW  60
 COLS      DCW  132
 MAX       DCW  24           *MAXIMUM NUMBER OF ITERATIONS
 *
 *ROW LOOP
 *X1 = 1  (COLUMN INDEX)
 *X0 = -2.2 (X COORDINATE)
 *
 START     LCA  ONE, X1     *ROW LOOP: INIT COL COUNT
           LCA  X0INIT, X0  *X0 = X0INIT
           CS   332         *CLEAR PRINT LINE
           CS               *CHAIN INSTRUCTION
 *
 *COLUMN LOOP
 *
 COLLP     LCA  @00@, I     *I = 0
           MCW  X0, ZR      *ZR = X0
           MCW  Y0, ZI      *ZI = Y0
 *
 *INNER LOOP:
 *ZR2 = ZR^2
 *ZI2 = ZI^2
 *IF ZR2+ZI2 > 4: BREAK
 *ZI = 2*ZR*ZI + Y0
 *ZR = ZR2 - ZI2 + X0
 *
 INLP      MCW  ZR, ZR2-6   *ZR2 =  ZR
           M    ZR, ZR2     *ZR2 *= ZR
           MCW  ZI, ZI2-6   *ZI2 =  ZI
           M    ZI, ZI2     *ZI2 *= ZI
           MCW  ZR2, ZMAG   *ZMAG = ZR^2
           A    ZI2, ZMAG   *ZMAG += ZI^2
           C    TOOBIG, ZMAG  *IF ZMAZ > 4: BREAK
           BH   BREAK
           MCW  ZI, ZRZI-6  *ZRZI = ZI
           M    ZR, ZRZI    *ZRZI = ZI*ZR
           A    ZRZI, ZRZI  *ZRZI = 2*ZI*ZR
           MCW  ZRZI-4, ZI  *ZI = ZRZI (/10000)
           MZ   ZRZI, ZI    *TRANSFER SIGN
           A    Y0, ZI      *ZI += Y0
           S    ZI2, ZR2    *ZR2 -= ZI2
           MCW  ZR2-4, ZR   *ZR = ZR2 (/10000)
           MZ   ZR2, ZR     *TRANSFER SIGN
           A    X0, ZR      *ZR += X0
 *
 *IF I++ != MAX: GOTO INLP
 *
           A    ONE, I      *I++
           C    MAX, I      *IF I != MAX THEN LOOP
           BU   INLP
           MCW  @X@, 200&X1  *STORE AN X INTO THE PRINT LINE
 BREAK     C    X1, COLS    *COL LOOP CONDITION
           A    ONE, X1
           A    XINC, X0    *X0 += 0.0227
           BU   COLLP
           W                *WRITE LINE
 *
 *Y0 += YINC
 *IF ROW++ != ROWS: GOTO ROWLP
 *
           C    ROW, ROWS   *ROW LOOP CONDITION
           A    ONE, ROW
           A    YINC, Y0    *Y0 += 0.0333
           BU   START
 FINIS     H    FINIS       HALT LOOP
           END  START
        

I compiled and ran the code with the ROPE compiler and simulator before using the real computer. The cards were punched automatically by an IBM 029 keypunch controlled by a PC through a bunch of USB-controlled relays. The photo below shows the keypunch in operation. Each blank card drops down from the feeder in the upper right. The card is punched as it moves to the left. Punched cards are then flipped up and stacked in the upper left area (empty in this picture).

IBM 029
An IBM 029 keypunch preparing a card deck that generates the Mandelbrot fractal.

The resulting card deck is shown below, along with the output of execution. The program fits onto just 16 cards, but the card format is a bit unusual. The machine code for the Mandelbrot program is punched into the left half of the each card, with code such as M384417A395417. An interesting thing about the 1401 is the machine code is almost human-readable. M384417 means Move field from address 384 to address 417. A395417 means Add the number at address 395 to the number at address 417. The text on these cards is the actual machine code that gets executed, not the assembly code. Since the machine is character-based, not binary, there's no difference between the characters "428" and the address 428.

Mandelbrot with cards s500
The card deck to generate the Mandelbrot fractal on the IBM 1401 computer, along with the output. The white stripe through the fractal near the right is where a hammer in the printer malfunctioned.

If you look at the right half of the cards, there's something totally different going on, with text like L033540,515522,5259534. There's no operating system, so, incredibly, each card has code to copy its contents into the right place in memory (L instruction), add the word marks (, instruction), and load the next card. In other words, the right hand side of each card is a program that runs card-by-card to load into memory the program on the left hand side of the card deck, which is executed after the last card is loaded.

To run the program, first you hit the "Power On" button on the IBM 1401 console. Relays clunk for a moment to power up the system and then the computer is ready to go (unlike modern computers that take so long to boot). You put the cards into the card reader and hit the "Load" button. The cards fly through the reader at the remarkable speed of 800 cards per minute so the Mandelbrot program loads in just over a second. The console starts flickering as the program runs, and every few seconds the line printer hammers out another line of the fractal. After 12 minutes of execution, the fractal is done. (Interestingly enough, the very first picture of a Mandelbrot set was printed on a line printer in 1978.)

Console W500
The console of the IBM 1401 mainframe. The top half shows the data flow through the computer, from storage to the B and A registers and the logic unit. Each 6-bit value is displayed as 1248ABC, where A and B are zone bits and C is the check (parity) bit. On the right, "OP" shows the operation being executed. Below are knobs to manually access memory. On the left, the "Start Reset" button clears an error, such as the card read failures I would hit. At the bottom are the important buttons to turn the computer on and off. Note the Emergency Off handle that immediately cuts the power.

Conclusions

Writing a Mandelbrot program for the IBM 1401 was an interesting project. You think a bit differently about programming when using decimal numbers and keeping track of word marks. But I have to say that comparing the performance with a current machine - not to mention the storage capacity - makes me appreciate Moore's Law.

The Computer History Museum in Mountain View runs demonstrations of the IBM 1401 on Wednesdays and Saturdays. It's amazing that the restoration team was able to get this piece of history working, so if you're in the area you should definitely check it out. The schedule is here. Tell the guys running the demo that you heard about it from me and maybe they'll run my prime number program or Pi program. You probably wouldn't want to wait for the Mandelbrot to run.

Thanks to the Computer History Museum and the members of the 1401 restoration team, Robert Garner, Ed Thelen, Van Snyder, and especially Stan Paddock. The 1401 team's website has a ton of interesting information about the 1401 and its restoration.


Markowitz or Mandelbrot? (Finance)

The Modern Portfolio Theory, pioneered by Harry Markowitz, is based on the assumption that multiple independent opinions in interaction lead to a market controllable ‘noise’, well represented by a Gaussian distribution of assets’ returns. Such an assumption holds relatively well, say 80% of the time.

Financial markets, however, like social systems, are sensitive to “fear and greed”, i.e. very non-linear self-reinforcing phenomena. When market participants imitate each other, financial markets tend to self-organize close to a critical point, where the crowd flips from wise to crazy, and vice versa. Such a critical point is a hidden variable. The conclusion of our behavioural research is that the hidden variable can be detected in a satisfactory manner, but with a stochastic element. In simple words, tail events are mathematically predictable, but without the possibility of differentiating left and right, favorable and unfavorable outcomes. Mathematics helps to detect instabilities, and their consequences on fragile complex systems, at the centre of Professor Benoît Mandelbrot’s research in finance in the 1960s.

Samples

See the Pen Animated fractal tree by Tim Brock (@timbrock) on CodePen.


See the Pen Views of a Mandelbrot Set by Matthias Hurrle (@atzedent) on CodePen.


See the Pen Julia animation by none (@_mm) on CodePen.

See the Pen mandelbrot set by Fabien Laurent Patrice Egot (@equant_org) on CodePen.

Nature Patterns gallery

Nature Patterns Nature Patterns Nature Patterns Nature Patterns
Nature Patterns Nature Patterns Nature Patterns Nature Patterns