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

Noise by Daniel Kahneman | 3 Distinctions

Noise | Michael Shermer (left) and Daniel Kahneman (right)

The Michael Shermer Show with Daniel Kahneman – Noise: A Flaw in Human Judgment

DESCRIPTION

Imagine that two doctors in the same city give
different diagnoses to identical patients. Now
imagine that the same doctor making a different
decision depending on whether it is morning or
afternoon, or Monday rather than Wednesday.
This is an example of noise: variability in
judgments that should be identical.

Shermer speaks with Nobel Prize winning
psychologist and economist Daniel Kahneman
about the detrimental effects of noise and what
we can do to reduce both noise and bias, and
make better decisions in: medicine, law, economic
forecasting, forensic science, bail, child
protection, strategy, performance reviews, and
personnel selection.

Video clip – 3 minutes

Noise by Daniel Kahneman | 3 Distinctions

SUPPORT THE PODCAST
If you enjoy the podcast, please show your
support by making a donation. Your patronage will
ensure that sound scientific viewpoints are heard
around the world.
https://www.skeptic.com/donate/
SPONSOR
Wondrium
https://wondrium.com/shermer
SPONSOR
Brilliant
https://brilliant.org/MichaelShermer/

Listen to The Michael Shermer Show via Apple
Podcasts, Spotify, Amazon Music, Google
Podcasts, Stitcher, iHeartRadio, and Tuneln.
https://www.skeptic.com/michael-sherm..

Full Video – Noise by Daniel Kahneman

Full video at https://youtu.be/5CFjERpwFys

Posted on Leave a comment

The Earth’s seasons

solar analemma

The Earth’s seasons are caused by three factors:

  • The Earth orbits the Sun once a year in a nearly circular orbit.
  • The Earth’s axis of rotation (the straight line through the center of the Earth between the north and south poles) is not perpendicular to the plane of the Earth’s orbit. The Earth’s axis is tilted by about 23.4° from the the direction perpendiular to the orbital plane.
  • The orientation of the Earth’s axis in space remains nearly constant even as the Earth revolves around the Sun. It always points in the general direction of the star Polaris.
Sun track

sun track

The result is that when the Earth is on one side of its orbit, the south pole is tilted toward the Sun (by as much as 23.4°) and the southern hemisphere experiences summer. Six months later, when the Earth is on the opposite side of its orbit, the north pole is tilted toward the Sun (by as much as 23.4°) and the northern hemisphere experiences summer. (Views of the Sun’s illumination on the Earth on any date are available here.) What we see from our viewpoint in the Earth’s northern hemisphere is that the Sun’s apparent daily track across the sky is much higher (that is, more northerly) in summer, and lower (more southerly) in winter. From horizon to horizon, the Sun’s track is longer in summer and shorter in winter; so that in summer, sunrises are much earlier and sunsets are much later than in winter. See, for example, the graphic above, or this photograph of the Sun’s paths through the sky at different times of the year.

The great circle The great circle

So we are used to the fact that the length of daylight is significantly longer in summer than winter, and most of us know that the “longest day” (that is, the day when the Sun is above the horizon the longest) is the summer solstice, around June 21, when the Sun has reached its most northerly and longest track in our sky; and the “shortest day” is the winter solstice, around December 21, when the Sun has reached its most southerly and shortest track in our sky.

It would make sense, then, for the summer solstice to also be the date at which sunrise is earliest and sunset is latest; and for the winter solstice to be the date when sunrise is latest and sunset is earliest. However, that is not what happens! Nature sometimes defies our expectations.

The local meridian is a great circle passing through the celestial poles and through the zenith of an observer’s location on the planet. Image Credit: Daniel V. Schroeder

And that is because we have not talked about one other factor in sunrise and sunset times that is not at all obvious. It is that the Sun moves across the sky, in its apparent daily track, at slightly different rates at different parts of the year. Most of the Sun’s east-to-west apparent motion in the sky is caused, of course, by the rotation of the Earth, which is quite uniform (to milliseconds per day). But a small part of the Sun’s apparent daily motion depends on the position of the Earth in its orbit around the Sun. This component of the Sun’s apparent motion varies by a small amount over the course of a year due to the elliptical shape of the Earth’s orbit and to the tilt of the Earth’s axis.

Earth’s axial tilt

Earth’s axial tilt

Continue reading The Earth’s seasons