JavaRush /Java Blog /Random EN /Groundhog Day is dedicated to ... Recursion in real life

Groundhog Day is dedicated to ... Recursion in real life

Published in the Random EN group
February. Well hello February. We are glad to see you. And today - and even more so. Because February 2 is the most cyclical and recursive day in the world thanks to the movie Groundhog Day.
Groundhog Day is dedicated to ... Recursion in real life - 1
In this cycle of winter, you can still watch the same “Groundhog Day” (2.02) and “Radio Day” (13.02), cheer for your favorite athletes at the Winter Olympics (9.02-25.02), eat pancakes (12.02-16.02), give “Valentine” (14.02) and another shaving lotion (23.02), congratulations on the holiday of the polar bear (27.02) ... And there the new cycle of spring will come.
Groundhog Day is dedicated to ... Recursion in real life - 2
And now about today. The protagonist of the film "Groundhog Day" got into a kind of recursive situation, which is similar to an endless loop. In fact, every day there are a number of events in which the hero can intervene in one way or another. The hero reasonably assumed that in order to get out of Groundhog Day, he must do something about these situations. The difficulty is that there are many situations, there are many ways to intervene in them, and there are even more combinations of both. Nothing to do, he began to thoroughly study his only recurring day, believing that anything could be the way out of it - from stealing a woodchuck to suicide. Gradually, he came to the idea of ​​self-improvement. In order to find the exit point, the hero must use the knowledge gained in the previous lives of this day, and gradually he succeeded. But recursion isn't just found in programming or science fiction movies. This is a very common occurrence even in everyday life. A classic example of infinite recursion is two mirrors placed opposite each other: they form two corridors of fading reflections of mirrors.
Groundhog Day is dedicated to ... Recursion in real life - 3
Groundhog Day is dedicated to ... Recursion in real life - 4
Recursion is not necessarily infinite. Here, for example, matryoshka. Quite recursive, but you will definitely get to the smallest of them.
Groundhog Day is dedicated to ... Recursion in real life - 5
The easiest way to see recursion without leaving your computer is to point your webcam at the computer monitor screen. The camera will record an image of the computer screen, and display it on this screen, something like a closed loop will turn out. And we will observe something similar to a tunnel.
Groundhog Day is dedicated to ... Recursion in real life - 6

Examples of recursion in nature

Geographic features are the most spectacular example of recursion. For example, similar to the aforementioned nesting dolls, islands in the middle of lakes, which in turn are located on the islands. Among such objects, the most famous is the Taal freshwater lake, located on Lawson Island in the province of Batangas, Philippines. On the lake is the volcanic island of Taal, in its crater there is another lake. And it, in turn, has its own small island, Vulcan Point.
Groundhog Day is dedicated to ... Recursion in real life - 7
A clear example is also rivers formed from other rivers, mountains and lightning.
Groundhog Day is dedicated to ... Recursion in real life - 8
Groundhog Day is dedicated to ... Recursion in real life - 9
No less interesting are examples of "vegetable" recursions. Here, for example, ordinary onions and white cabbage:
Groundhog Day is dedicated to ... Recursion in real life - 10
The recursions of cauliflower and romanesco look quite different. Their heads are made up of inflorescences, which in turn are made up of inflorescences. Interestingly, the head of Romanesco cabbage consists of light green inflorescences that are shaped like a fractal spiral. In addition, each individual bud forms its own spiral.
Groundhog Day is dedicated to ... Recursion in real life - 11
Groundhog Day is dedicated to ... Recursion in real life - 12
The tree is made up of branches. The branch, in turn, consists of smaller branches. Each branch repeats the tree.
Groundhog Day is dedicated to ... Recursion in real life - 13
The same structure can be observed in a complex fern leaf:
Groundhog Day is dedicated to ... Recursion in real life - 14
The seeds of some flowers (for example, sunflower) are arranged in intersecting spiral fans, determined by the ratio of Fibonacci numbers:
Groundhog Day is dedicated to ... Recursion in real life - 15
A remarkable example of recursion are dendrites - complex-crystalline formations of a tree-like branching structure. We are all familiar with ice dendrites - these are snowflakes and frosty drawings on glass:
Groundhog Day is dedicated to ... Recursion in real life - 16
Groundhog Day is dedicated to ... Recursion in real life - 17
There are also dendrites of metals, for example, gold and copper:
Groundhog Day is dedicated to ... Recursion in real life - 18
Examples of recursion from the animal world are also quite clear: the eternal pair of "chicken and egg" and ... evolution:
Groundhog Day is dedicated to ... Recursion in real life - 19
Groundhog Day is dedicated to ... Recursion in real life - 20

Examples of recursion in linguistics and literature

A story from "Cyberiad" by Stanislav Lem about an intelligent machine that had sufficient intelligence and laziness to build a similar one to solve the task and entrust the solution to it. (infinite recursion - each new car built its own kind). N.V. Gogol in the story "Portrait" describes the dream of the artist Chertkov, who, waking up, falls into a dream again, waking up from this dream, he falls into the first dream, from which he will also have to wake up. The Master and Margarita is one of the most striking recursive novels. The theme of Yeshua and Pilate is recursively invoked from the theme of the Master and Margarita. In addition, the "book within a book" technique is also used here. The master writes a novel about Yeshua and Pilate, the text of which merges with the text of the book The Master and Margarita. Another example of the recursion "House, Or here is the shortest story by Isaac Asimov, written for a bet right in the studio while recording an interview.

"... Insert cotter pin A into socket B ..."

Dave Woodbury and John Hansen, clumsy in their suits, watched in awe as the huge crate slowly separated from the transport ship and entered the airlock for re-atmosphere. They spent almost a year on the A-5 space station, and they were understandably fed up with rattling filtration plants, leaking hydroponics tanks, air generators that hummed hoarsely, and sometimes simply failed.

“Everything is falling apart,” Woodbury sighed mournfully, “because we collected all this ourselves.

“Following instructions,” Hansen added, “written by some idiot.

There were certainly grounds for complaint. On a spacecraft, the most scarce place is the place reserved for cargo, which is why all the equipment, compactly packed, had to be delivered to the station disassembled. All devices and installations had to be assembled at the station itself with their own hands, using clearly the wrong tools and following vague and lengthy assembly instructions.

Woodbury diligently wrote down all the complaints, Hansen provided them with the appropriate epithets, and an official request for urgent assistance in this situation went to Earth. And the Earth answered. A special robot was constructed with a positronic brain stuffed with the knowledge of how to assemble any conceivable mechanism.

This robot was now in the unloading cage. Woodbury trembled nervously as the airlock doors finally closed behind her.

The most famous examples of endless recursion in literature are “endless tales”: I opened my eyes: Blue skies, And a green blanket, And shaggy forests ... Here is the river - everything flows, The sun has risen - bakes again ... I took a pen and a notebook And decided Write everything down, I opened my eyes: Blue skies... The priest had a dog The priest had a dog, He loved her, She ate a piece of meat, He killed her And buried it in the ground, And erected a monument, And wrote the inscription: The priest had a dog, He loved her, she ate a piece of meat

Recursive Graphics Examples

Recursion techniques look advantageous in painting and photography. These can be the options "portrait in a portrait", "frame in a frame" or "the artist paints a picture in which he paints a picture in which he is depicted painting a picture":
Groundhog Day is dedicated to ... Recursion in real life - 21
Groundhog Day is dedicated to ... Recursion in real life - 22
Groundhog Day is dedicated to ... Recursion in real life - 23

Recursive humor

It's just tin. Programmers, epta, we live together, agreed as follows: the first one wakes up the second, the second the third, the third the first ... recursion =) as a result, we overslept the lecture. We have for lunch - salad "Recursive": tomatoes, cucumbers, lettuce. xxx: Do you remember Antokha lost his wish? so, I asked him: so that for 2 days he would stick a sticker with this action for 2 days on all objects with which he performed any actions yyy: I would definitely stick a sticker with the inscription “pasted” on the sticker. Small (son 10 months old) drove into recursion ... one nipple in his mouth. gave a second. spat out the first with joy. put in a second one. heard something fall. was delighted to see the first nipple. dropped the second one. put the first one in his mouth. I heard something fall ... has been changing them for 5 minutes. Today I worked with my father, he says to me like “do you want to show recursion?”, I’m like “come on”. He takes the plug of the drill into the extension cord, and he plugs the extension cord into a free outlet of the same extension cord, presses the button, the drill starts working ... Damn, I probably had a very funny face, he laughed until the evening, and I stuck it for a long time why it happens. The drill turned out to be battery operated. If you think that everything in life should have an applied application, then we suggest that you recall the acquired knowledge of programming and try to solve some of the well-known problems that are solved using recursive methods: finding Fibonacci numbers and factorial, as well as the Towers of Hanoi puzzle .
Groundhog Day is dedicated to ... Recursion in real life - 24
February. Well hello February. We are glad to see you. And today - and even more so.
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION