
Tamas K Papp writes:
Henning Thielemann wrote:
Actually, laziness allows me to formulate algorithms that look more like the specification of the problem than the solution. E.g., I can formulate the solution of a differential equation in terms of a power series or time series in that way. However I have to put some effort into formulating it in a way that works. E.g. I'm only able to solve such equations if it is possible to express the second derivative in terms of the first and the zeroth one. Computer algebra systems are essentially better here.
In my experience, most people use CAS interactively: they encounter an integral or a PDE that's difficult to solve, so they type it into Mathematica (which frequently cannot solve it either, then you go crazy, numerical, or both ;-). It is more like a sophisticated symbolic calculator with a lot of patterns built in for manipulating expressions.
I should have reacted earlier... Please don't exaggerate with *opposing* CAS and Haskell, Prolog, or other *universal* languages. CAS such as Maple, Mupad, and also Mathematica in a sense are also universal, but they simply have * enormous libraries permitting to deal with symbolic expressions ; * Pattern matching/rewriting contraptions useful to manipulate deeply intricate structures. All this CAN BE DONE in Haskell as well, but reinventing the wheel is rarely interesting (sometimes is, though) (*). Still CAS are no magic, and - getting back to Henning's example: No CAS will give you the power expansion of a solution of a differential equation if you can't algorithmize the needed recurrencies. But if you can, then you can do it in a numerical setting using Haskell or something else. Haskell allows you to apply laziness in a "perverse" way as well, for example solving - as a power series - a *singular* equation (Bessel), where you define the first derivative through the function and its second derivative, although at first glance this seems mad. But look here, a quite old stuff... : Theor. Comp. Sci. 187,(1997), pp. 203--219. on-line : http://users.info.unicaen.fr/~karczma/arpap/lazysem.pdf page 4... Jerzy Karczmarczuk ======= (*) A reference for your culture: Jorge Luis Borges, "Pierre Ménard, the Author of Don Quixote". It is a story about a person who WROTE (not: copied) a book, exactly, letter by letter, identical to the book of Cervantes. It was identical, but having been written another time/place, and addressed to different readers, it had a different *deep meaning*, it was a different novel. Or was it?...