[Edu-sig] Brute force solutions
David Handy
david at handysoftware.com
Wed Sep 21 20:47:55 CEST 2005
On Wed, Sep 21, 2005 at 09:31:41AM -0700, Kirby Urner wrote:
> Mine original draft makes sense to set the stage, cuz the reasoning is so
> dang primitive. Yours adds a layer of sophistication more reflective of how
> real world programmers learn to squeeze the most out of their cycles.
Your original draft was a great baseline. That's one good reason not to
prematurely optimize: it makes you look like a hero when you optimize
later. :)
>
> Of course all of this requires temporarily ignoring the fact that algebraic
> methods give us a way to compute phi as simply (1 + math.sqrt(5))/2.0.
The technique is generally useful to solve any equation of one variable,
given:
1. You have an interval in which the solution lies
2. You have an error function that is monotonically increasing over the
interval the further you get from the solution (and goes to zero at the
solution)
I think exposing students to numerical equation solving using Python can
give them an understanding that will help them later when they are trying
to, i.e. figure out how to solve a problem with their fancy caculator,
spreadsheet functions, etc.
>
> Kirby
>
>
--
David Handy
Computer Programming is Fun!
Beginning Computer Programming with Python
http://www.handysoftware.com/cpif/
More information about the Edu-sig
mailing list