
On Mar 23, 2011, at 6:57 PM, Henning Thielemann wrote:
James Cook schrieb:
Those are both options, as is to simply restart findRoot if it returns a 'Left' vaule. I personally would incline toward a custom driver function (findRoot). I should probably add one to the library that accepts a step limit and/or one that just iterates until convergence.
I thought that the mosts Haskellish way to do numerical iterations is to generate a list of successive approximations (by List.iterate, of course) and then let the user choose where and why he wants to abort the list, and thus the iteration.
That's probably true, and the same module exports a function that does so. But sometimes you just want to ask "what is the root?", and get an answer without taking (possibly literally) forever. Overall, the code is relatively un-Haskellish to begin with though. It was assembled in a short period of time in order to simply have code that performs the task, and hasn't really been touched since. -- James