Personal computing discussed

Moderators: SecretSquirrel, just brew it!

 
SuperSpy
Gold subscriber
Minister of Gerbil Affairs
Posts: 2160
Joined: Thu Sep 12, 2002 9:34 pm
Location: TR Forums

Re: How recursive is the real world?

Tue Mar 28, 2017 8:22 am

just brew it! wrote:
We've come a long way since MS-DOS .BAT files! :wink:


Some of us are still stuck in that world :evil:
Desktop: i7-4790K @4.8 GHz | 32 GB | XFX Radeon 6950 | Windows 10 x64
Laptop: i7 740QM | 12 GB | Mobility Radeon 5850 | Windows 10 x64
 
notfred
Maximum Gerbil
Posts: 4289
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: How recursive is the real world?

Tue Mar 28, 2017 9:23 am

I've used recursion in walking paths across networks for diagnostics. You may have tunnels and you need to know which nodes the path traverses, including all the nodes the tunnels traverse.

I've also seen recursion bite badly, it led to a stack smash that caused a 10G line card to reboot while running live traffic between two cities.
 
Redocbew
Gold subscriber
Graphmaster Gerbil
Posts: 1023
Joined: Sat Mar 15, 2014 11:44 am

Re: How recursive is the real world?

Tue Mar 28, 2017 5:56 pm

derFunkenstein wrote:
We went about it a little differently. We were instructed to address base cases first and then do any calculations and finally call the function again. Not that he said it couldn't be done differently, just that dealing with the base cases first will help us keep the code organized.
...
So it'll become automatic over time, I'm sure. :lol:


Yeah, it does. Recursion helps to give you an appreciation for the complexity of certain problems even if you don't use it much. Once you learn it, recursion makes everything easier. :P

Making the recursive call at the end of the function is called tail recursion, which 223 Fan mentioned earlier. Being able to use tail recursion usually means an iterative solution wouldn't be too difficult, but it does help to keep things simple. There are some cases, like in an XML parser which has to walk the document tree and perform some computation on each node afterwards where tail recursion may not be suitable, and that's when things can start to get interesting.
Do not meddle in the affairs of archers, for they are subtle and you won't hear them coming.
 
SecretSquirrel
Minister of Gerbil Affairs
Posts: 2244
Joined: Tue Jan 01, 2002 7:00 pm
Location: The Colony, TX (Dallas suburb)
Contact:

Re: How recursive is the real world?

Tue Mar 28, 2017 6:20 pm

notfred wrote:
I've used recursion in walking paths across networks for diagnostics. You may have tunnels and you need to know which nodes the path traverses, including all the nodes the tunnels traverse.

I've also seen recursion bite badly, it led to a stack smash that caused a 10G line card to reboot while running live traffic between two cities.


This is a very important point. If the problem space doesn't inherently limit the depth of recursion, the algo must have an exit case that prevents the recursion from getting too deep.

--SS
 
Mr Bill
Gold subscriber
Graphmaster Gerbil
Posts: 1244
Joined: Mon Jan 21, 2002 7:00 pm
Location: Colorado Western Slope
Contact:

Re: How recursive is the real world?

Tue Mar 28, 2017 6:30 pm

lycium wrote:
I develop a commercial fractal art application, Chaotica, and often get emails asking me how much psychedelic drugs I take... I've never actually tried any (unfortunately?), however to me it's very interesting that people ask all the time - there's clearly something about the human brain that sees fractals (the basis of which is recursion) in altered states.

Of course, one sees fractals very often in nature (trees, clouds, coastlines, ...), and a simple recursive cellular automaton even appears on some sea shells: https://en.wikipedia.org/wiki/Rule_30
In the far far ago, TR used to use the mandelbrot set as a benchmark.
This page intentionally left blank
 
just brew it!
Gold subscriber
Administrator
Posts: 47376
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: How recursive is the real world?

Tue Mar 28, 2017 6:33 pm

FWIW, although the Mandelbrot set has the self-similarity at multiple scales typical of fractals, the usual method for calculating it is iterative, not recursive.

Edit: Obligatory Mandelbrot fractal "deep zooms" (raw frames originally rendered on my FX-8350 desktop, using a custom Python/C program):
http://uchima.net/fractal-videos/mbzoom16.mp4
http://uchima.net/fractal-videos/mbzoom22.mp4
The years just pass like trains. I wave, but they don't slow down.
-- Steven Wilson
 
morphine
Gold subscriber
Gerbilus Supremus
Posts: 11285
Joined: Fri Dec 27, 2002 8:51 pm
Location: Portugal (that's next to Spain)

Re: How recursive is the real world?

Tue Mar 28, 2017 9:24 pm

SecretSquirrel wrote:
This is a very important point. If the problem space doesn't inherently limit the depth of recursion, the algo must have an exit case that prevents the recursion from getting too deep. --SS


if ( dives > 100000 )
    return ERR_we_dun_effed_up;
There is a fixed amount of intelligence on the planet, and the population keeps growing :(
 
Captain Ned
Gold subscriber
Global Moderator
Posts: 25434
Joined: Wed Jan 16, 2002 7:00 pm
Location: Vermont, USA

Re: How recursive is the real world?

Tue Mar 28, 2017 9:31 pm

morphine wrote:
if ( dives > 100000 )
    return ERR_we_dun_effed_up;

Eddie could have used that when faced with the Tea Question.
Atheism is a non-prophet organization.

Who is online

Users browsing this forum: No registered users and 1 guest