Posted on Leave a comment

The Three Laws of Recursion

Recursion | Russian dolls

Like the robots of Asimov, all recursive algorithms must obey three important laws:

  • A recursive algorithm must have a base case.
  • A recursive algorithm must change its state and move toward the base case.
  • A recursive algorithm must call itself, recursively.

Recursion is the process of defining a problem (or the solution to a problem) in terms of (a simpler version of) itself. For example, we can define the operation “find your way home” as: If you are at home, stop moving. Take one step toward home.

Let’s begin our discussion of recursion by examining the first appearance of fractals in modern mathematics. In 1883, German mathematician George Cantor developed simple rules to generate an infinite set:

Cantor’s rule for an infinite set

There is a feedback loop at work here. Take a single line and break it into two. Then return to those two lines and apply the same rule, breaking each line into two, and now we’re left with four. Then return to those four lines and apply the rule. Now you’ve got eight. This process is known as recursion: the repeated application of a rule to successive results. Cantor was interested in what happens when you apply these rules an infinite number of times.

George Cantor

Dichotomy paradox – Zeno’s

“That which is in locomotion must arrive at the half-way stage before it arrives at the goal.”

— as recounted by Aristotle, Physics VI:9, 239b10

Suppose Atalanta wishes to walk to the end of a path. Before she can get there, she must get halfway there. Before she can get halfway there, she must get a quarter of the way there. Before traveling a quarter, she must travel one-eighth; before an eighth, one-sixteenth; and so on.

Zeno’s paradox was recursive by cutting the distance in half each time to the infinitesimal. This is also how the Tortoise beat the Hair by questioning time over distance.

Recursive Function Calls

The tortoise and the Hair – the paradox of time
int factorial(int n) 
{ if (n == 1) { return 1; }
else { return n * factorial(n-1); } }

A function that does call others is called a nonleaf function. … The factorial function can be rewritten recursively as factorial(n) = n × factorial(n – 1). The factorial of 1 is simply 1. The image shows an object trace of the factorial function written as a recursive function. Each call goes in the run time stack until the base case is reached, and the the stack is popped as the result is passed to each function on the stack.

Five Factorial (5!) in recursion

What Is a Fractal?

The term fractal (from the Latin fractus, meaning “broken”) was coined by the mathematician Benoit Mandelbrot in 1975. In his seminal work “The Fractal Geometry of Nature,” he defines a fractal as “a rough or fragmented geometric shape that can be split into parts, each of which is (at least approximately) a reduced-size copy of the whole.”

Recursion in Nature

Looking closely at a given section of the tree, we find that the shape of this branch resembles the tree itself. This is known as self-similarity; as Mandelbrot stated, each part is a “reduced-size copy of the whole.”

The Three Laws of Robotics

Isaac Asimov was an American writer and professor of biochemistry at Boston University. During his lifetime, Asimov was considered one of the “Big Three” science fiction writers, along with Robert A. Heinlein and Arthur C. Clarke. A prolific writer, he wrote or edited more than 500 books.

  • A robot may not injure a human being or, through inaction, allow a human being to come to harm
  • A robot must obey the orders given it by human beings except where such orders would conflict with the First Law
  • A robot must protect its own existence as long as such protection does not conflict with the First or Second Laws
Partial sources: https://natureofcode.com/book/chapter-8-fractals/, Wikipedia, Google 
Posted on 1 Comment

On the Nature of the Universe

Cube of Theoretical Physics

The Universe

By Scott Anfield

For many years, people have sought to discover a unified field theory which explains all the phenomena in the Universe, from the smallest particles to the galaxies and even the structure of the universe itself.  The theory which I propose encompasses all of these.

This theory is concerned with the fact that all things come in threes, of which there are numerous examples (see Appendix). The whole of anything is comprised of 3 parts. All 3 of these parts have something in common, which gives the appearance of a whole. The 3 parts are divided into a ratio of 1:2, of which two are the same as each other in some respect and one is different. Herein lays the stability of this theory, as it must always be two of the same and one different because when reversed, the single part would have nothing to be the same as. However, all 3 parts are interlinking with each other. Each part has something in common with every other part and they both have a difference with the other part. For example, parts one, two and three can be shown as A, B and C respectively.

  • A and B have a common link with each other, but both different from C
  • A and C have a common link with each other, but both different from B
  • B and C have a common link with each other, but both different from A.

I have named this tri-interconnectivity

The parts of the whole 3 do not have to be physical objects. They can be thoughts, feelings, emotions, words and forces to name a few. They can also be a mixture of these things.

Amongst the multitude of things that come in threes, consider the many equations of physics which are seen as triangles e.g. speed, distance, time. These equations are numerous and explain a vast array of phenomena on their own.

Phenomena that appear in numbers that cannot be divided by 3 can also be explained by this theory. For example, 5 is 2:1:2. As you can see, the ratio of 2:1 doesn’t change, only that two parts can be further divided into two further sub-parts whilst the other part remains with only one part. Things that appear on the surface to be duos are really only 2 parts of the whole 3, the part which we don’t see immediately is the third, different, part. For example, up and down appear as opposites- duos- which they are, but they both have a golden mean of middle. The same is true for left and right and every other opposite.

People have long questioned ‘When did the Universe begin?’ and ‘When will it end?’ This theory answers both these questions with one simple explanation: the matter in the Universe is in constant rotation. Think of matter moving along a line. When the two ends of the line are joined, they make a circle that the matter rotates in, a torus shape (which I will explain later). I propose that the place at which the two ends ‘meet’ is a black hole and a white hole. Newton’s third law states that there is an equal and opposite reaction for everything and we know that black holes exist so theoretically, white holes must exist too. I propose that matter is drawn into the black hole and ejected out of the white hole as anti-matter. As the anti-matter travels around the torus, it enters the black hole and is ejected as matter, and the cycle repeats. I propose that singularities cannot exist in black holes, because if there is a region in space that is infinitely dense, then it would ‘suck’ absolutely everything in the Universe into it. Instead, I believe that extremely dense places do exist, but just not to the point where all the Laws of Nature collapse. This is because they are controlled by the Laws, not a controller of them. There are 3 states of time; past, present and future. In this time loop theory, the matter travelling in the loop is in the present. The matter is travelling towards the future and away from the past. The place at which the black and white holes ‘meet’, time is bent in such a way as to join the past and the future. The matter from the future effectively becomes anti-matter from the past and vice versa. This also explains what scientists have been detecting as the ‘big bang’. There may not have been a ‘big bang’ as such from where everything came, but multiple big bangs as the anti-matter is transformed into matter and propelled around the torus. The answer to the questions therefore is; there has never been a start or an end to the universe, as it keeps moving and transforming. Therefore, there is a finite amount of energy and matter in the Universe, but the Universe itself is infinite. The energy and matter are the two which are the same but the Universe is different, as it is infinite because of its looping mechanism.

The next area of interest is spirals which occur in galaxies, planets and atoms. Think of a balancing toy with weights in the ratio 1:2 on Earth. If you bring the heavier mass to the top and let it go, it moves down towards the bottom and then it continues its momentum towards the top and the cycle starts again. On Earth, this motion will eventually cease because of air resistance but in space, according to Newton’s first law and Newtonian mechanics this motion could continue infinitely. All that is needed to cause this motion is an object, however small, to have a ratio of 1:2, where one mass is greater than the other. A possible reason for the fact that all matter is spinning at some level is that as matter is expulsed by the white hole, the heavier part of the atom moves forward faster than the lighter part e.g. in hydrogen the proton moves faster than the electron causing it to spin.

As there are more positive charges in atoms than negative ones, in the ratio 2:1, there is a link between the smallest particles and the largest structures of the universe. All matter in the universe is made from atoms, of which there are 3 components: electrons, protons and neutrons. Look at the table of elementary particles and the colour charge of quarks and you will see many 3 elements to it. A neutron consists of one up quark and two down quarks (2:1). There are three types of weak interaction vertices. Two of them involve charged bosons (charged current interactions) and one is a neutral boson (neutral current interaction). The W and Z bosons also fit the three theory, with their differing charges.

All matter is made from atoms and all atoms possess an electron. All spinning electrons possess a magnetic field. From research, we know that an object dropped at the poles falls to earth faster than an object falling at the equator and also time passes faster the further away you are from the Earth’s surface. This is because gravity and magnetism are weaker above the equator (bipolarity of the Earth). It follows that in space, the larger the mass of an object, the more atoms it has, therefore the stronger the magnetic field. This electromagnetic field created by all atoms can either attract or repel other atoms from different bodies. Light, made from photons, can be attracted or repelled by this electromagnetic field. I propose that the Sun’s electromagnetic field causes the light from the stars to bend, not its gravitational pull. The weakening of light from highly attractive stars can be explained by the fact that photons are drawn to the stars magnetic field, whilst the waves continue, giving the distortionate effect of bending. The Einstein ring, I believe, is light bending around at equal proportions according to the attractive force exerted by the black hole.

You may believe that there are four fundamental forces; gravity, electromagnetism and the strong and weak nuclear forces. As you may have already guessed, if you combine the latter two into one nuclear force which can be further divided into strong and weak, then you have 3 fundamental forces, just as electricity and magnetism are combined. From this we can see, as before, that it is really 5 different forces in the ratio of 1:2. The single force, 3, is explained in the following paragraphs.
As mentioned before, I believe that the Universe is a torus shape. We know that magnetic levitation can occur in seemingly non-magnetic objects due to the very weak level of molecular magnetism, caused by the atoms. In a magnetic field, as demonstrated at the Nijmegen High Field Magnet Laboratory, water forms a spherical shape as it would do in space. I propose that the planets are spheroid in shape because of this effect and the torus generates a magnetic field inside the space of the Universe which causes the planets to be shaped like this, similar to a tokamak. Each body is a slightly oblate spheroid, because it is in rotation whereas stars, like the Sun, are more spherical. I propose that objects do are not ‘held’ to the Earth by gravity, but by magnetism.
I propose that magnetism is gravity, and the larger the mass of an object, the greater the magnetic force it exerts. Both the nuclear forces have attractive and repulsive forces. Imagine the weak nuclear force as being a weak magnetic field (+1) and the strong nuclear force as a strong magnetic field (+2). A singular nuclear force therefore would have (+3), before it is split up into its respective ratios. I finally propose that all the fundamental forces are indeed different levels of magnetism.

I do not consider myself a scientist or mathematician so the equation I can best think of to describe the three theory is:

a = (b + (b + b))

However, on further inspection, this equation suggests that b = 0.33 recurring, which does not make a a whole. Therefore one b, the one that is different, has to be 0.34. This slight difference shows how it is different from the other two, but only marginally. If you have noticed that 2 are the same, then you can work out what the other different one is, and calculate the whole.

I believe that if this theory is true, it is not the end of science, but a new beginning and I am sure that it will open up numerous possibilities for every field of investigation.

Appendix

  • 3 is a prime, triangular, Fibonacci and a Lucas number
  • Trigonometry is a branch of mathematics based on measuring triangles
  • Triangles have 3 sides
  • There are 60 seconds in an hour, and 24 hours in a day
  • There are three states of matter- solid, liquid and gas (land, sea and air)
  • There are three types of fossil fuel- coal, oil and gas
  • The ratio of hydrogen atoms to oxygen in water is 2:1 and carbon is present in all living matter and has the atomic number 6.
  • There are three geometries- Euclidean, spherical and hyperbolic
  • In equivalence relation there are 3 types- reflexivity, symmetry and transitivity.
  • 6 is the first perfect number with its factors of 1, 2 and 3. These numbers make 6 whether you add them together or multiply them.
  • Every object is 3 dimensional, consisting of length, breadth and width and any object in the universe can be plotted with just 3 co-ordinates. A circle can also be plotted from any 3 points.
  • There are three different types of cone cell in the eye, each sensitive to different wavelengths of light
  • There are three school terms in a year- at Cambridge (Lent, Easter and Michealmas)
  • There are 3 barleycorns in an inch, 3 feet in a yard and 3 miles in a league.
  • There are 12 inches in a foot and 12 old pennies in a shilling
  • There are many acronyms or abbreviations: NBA, NFL, AFC, NFC, CBS, NBC, ABC, FOX, UPS, MTV, VH1, BBC and ITV to name a few
  • In art, threes are used to define structures: primary, secondary and tertiary colours. There are 3 primary colours. A colour circle is based on red, yellow and blue. The setting of a picture is often comprised of a foreground, middle and a background. In traditional colour theory, these are the 3 pigment colours that cannot be mixed or formed by any combination of other colours- all the other colours are derived from these three hues. Sir Isaac Newton developed the first colour wheel in 1666.
  • Three Greek column classifications are Doric, Ionic and Corinthian
  • Pottery falls into 3 main classes- porous-bodied, stoneware and porcelain
  • Three ways of organising a business- sole proprietorship, partnership or corporation.
  • A classic public relations technique is called ‘The Rule of Threes’
  • In a business cycle there are three months to a quarter
  • In a business, 3 worksheets must be done at the end of a cycle- income statement, change in owner’s equity and a balance sheet.
  • In the accounting formula, Assets = Liabilities + Equity, there are 3 variables
  • The USA area codes consist of 3 digits. In The UK, all area codes consist of 5 but the first two numbers of every one is 01, which leaves 3 numbers to define an area
  • Many cities use 3 methods of water purification- coagulation and settling, filtration and disinfection
  • In school there are the three R’s- reading, writing and arithmetic
  • There are 3 meals in a day- breakfast, lunch and dinner
  • There are 3 versions to every story- my version, your version and the truth
  • Good and bad things happen in threes- celebrities die in three
  • Lock, stock and barrel are the 3 components of a gun
  • There are 3 answers to a question- yes, no and maybe
  • In the Ayurvedic system there are three doshas- vata, pitta and kapha
  • Flags and ribbons with 3 colours are assumed by nations or insurgents as symbols of political liberty.
  • There were 3 kings of Cologne and 3 Magi- Gaspar, Melchior and Balthazar
  • In Morse code, SOS is shown as 3 dots, 3 dashes and then another 3 dots.
  • There are 3 types of revolution- cultural, scientific and political.
  • Churchill, Roosevelt and Stalin were known during World War 2 as the big 3.
  • Humour uses the rule of three for jokes, an Englishman, an Irishman and a Scotsman and a priest, a minister and a rabbi. There are guidelines such as the rule of three, where the first two items in a list are routine but the third item is the punch line.
  • Language is based in threes- sender, message and receiver. Subject, verb and object. A language involves 3 systems- semantic, phonological and syntactic. There are 3 narrative styles- first, second and third. There are 3 ways to end a sentence- full stop, question mark and exclamation point. An essay has three parts- introduction, body and a conclusion. There are three basic accentual methods- stress, tone and length
  • There are 3 styles of writing in Japanese- Hiragana, Katakana and Kanji.
  • When children say and write their first words, they are normally three letters- cat, dog, bat, hat, can etc
  • The first mathematical structure is a triangle of which there are 3 types- acute, obtuse and right. There are also 180 degrees in a triangle.
  • There are three types of average- mean, mode and median
  • Garden flowers can be divided into 3 groups according to how long they live- annual, biennial and perennial
  • Sir Isaac Newton proposed 3 laws of motion
  • There are 9 planets in the solar system
  • Jupiter has 63 moons, Uranus has 27 moons and Pluto has 3 moons
  • The Earth is the third planet from the Sun
  • The brain and medulla spinalis are enclosed within 3 membranes- dura mater, arachnoid and pia mater. There are also many muscles in threes
  • Hexagonal structures are found in many living things.
  • Beethoven wrote 9 symphonies
  • The Father, The Son and The Holy Ghost are 3 forms of God.
  • There were 9 muses, a 3-headed dog called Cerberus and a 9-headed hydra in Greek mythology. The Triple Goddess is pagan.
  • There are 12 signs of the zodiac
  • There are 12 people in a jury.

These examples are from my own thoughts and from the website www.threes.com, which has many other examples of threes.

Copyright Scott Anfield 2007, All Rights Reserved

Contact: Scott Anfield

Email flareon155@hotmail.com

Phone (UK): 0-782-864-6216

Posted on Leave a comment

Buckminster Fuller

Buckminster Fuller
Nature is always most economical; therefore nature is not “squaring”; she is “triangling.”