|
![](/i/fill.gif) |
Christopher James Huff wrote:
> In article <3eb3ac4c@news.povray.org>, gimi <gim### [at] psico ch> wrote:
>>What du you need recursion for? Most fractals I know of
>>(Mandelbrot included) are computed in simple iterations,
>>as in (pseudo-code):
>
> You can make an iterative version of any recursive algorithm.
AFAIK this is only proven to be true for end-recursive algorithms
(though /many/ of the functions with a single recursion call can
be made end-recursive; but you will usually run into trouble if
the algorithm has multiple recursive calls).
> However, the recursive version is often much simpler,
I agree, but it depends on how you look at it. For people
not too familiar with the concept, an iterative function
is far easier to grasp. - And, as I mentioned before, it's
faster (and more efficient) in almost every case (Note that
I speak as a programmer here, not as a mathematician).
> and most fractals are mathematically defined as recursive
> because of the self-similar nature of fractals.
Can you elaborate on this kind of definition?
I don't doubt this, I just think that one can as well
define them by iterative means ("As long as the conditions
are not fulfilled, do repeat...").
However, I doubt that the relation between recursion and
self-similarity is as strong as you think. Recursion is
often (ab-)used in order to make code look slick, when in
fact it isn't.
> At the time this was written, POV supported function
> recursion, but it still does not support loops, though you can imitate
> it using a long string of select() calls.
You mean "does not support loops" because there is no
proper stack to store (local) variables on? In this
case, yes; but I'd prefer to solve (not "imitate") this
by implementing one - *if* I *really* need to... ;)
BTW, Christopher, what is your profession?
g.
--
9) Count the number of odd entries in the 100th row of
Pascal's triangle.
++++++++++++++++ http://www.psico.ch/ ++++++++++++++++
Post a reply to this message
|
![](/i/fill.gif) |