Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think you sort of answered your own question. Fibonacci and factorial functions have closed forms that can be computed efficiently than implementing the recurrence relation both in terms of clock cycles and developer time. While there are a lot of dynamic programming problems that do not easily reduce to closed form expressions, there are a lot that do. Maybe there are better examples for students to learn that of similar difficultly, but lack closed form solutions. The Fibonacci one still seems useful since you might be on a system that doesn't provide the lgamma function. Now, you might say lgamma isn't obvious, but then, the author would have proved his point.

There are a lot more closed forms of recurrence relations in the math than the two we talked about above, and a good deal of us (me included) are ignorant/negligent of them (by negligent I mean lazy :P). However, this sort of knowledge is exactly the kind that, in large enough occurrences, leads to game changers and serious disruption in industries.



> Fibonacci and factorial functions have closed forms that can be computed efficiently than implementing the recurrence relation both in terms of clock cycles and developer time.

It doesn't matter. The purpose of fibonacci is to understand recursion and dynamic programming. I have never ever encountered a practical problem where I need the value of nth fib. How does it matter it has a closed form and it takes less clock cycles when I almost never need it?

> While there are a lot of dynamic programming problems that do not easily reduce to closed form expressions, there are a lot that do.

The practical dynamic programming problems which have closed form and we need the value and not workout the whole series are rare. Fibonacci is a learning tool, so is factorial. The practical dynamic programming problems viz. longest common subsystem, interleaving, alignment, travelling salesman, matrix multiplication etc either don't have a closed form, or the closed form isn't useful.

"How many ways to change 100 using 1, 5, 10, 20, 50" does have a closed form, but more often than not, if I encounter a practical variant, the closed form is useless as the "how many ways" is not interesting, but the actual combinations are.

> Maybe there are better examples for students to learn that of similar difficultly, but lack closed form solutions. The Fibonacci one still seems useful since you might be on a system that doesn't provide the lgamma function.

The existence of closed form is immaterial. Closed form exists for Fibonacci doesn't affect learning recursion and dynamic programming.

Also, Fibonacci's closed form isn't defined in terms of lgamma.

> However, this sort of knowledge is exactly the kind that, in large enough occurrences, leads to game changers and serious disruption in industries.

I don't have to know the closed form beforehand to find one when I need it.


Those problems which lack closed-form solutions might lack another attribute that the Fibonacci sequence has, namely, it's easy to wrap your head around the nature of the problem and to verify correct answers. It's purely a teaching tool.

It's also worth pointing out that someone who's taught about recursion, dynamic programming, and memoization using the Fibonacci sequence likely knows a lot more about those topics by the end than the person who's told "use lgamma and exp to calculate the nth Fibonacci number" knows about gamma functions. Unless, of course, you think that programmers should all take the necessary mathematics to know how to derive the relevant results themselves---maybe you do---but the author certainly doesn't present a case for that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: