[plt-scheme] Experience Using Mz(Dr)Scheme for Numerical Work

From: karczma at info.unicaen.fr (karczma at info.unicaen.fr)
Date: Mon Apr 18 09:51:27 EDT 2005

The discussion on Scheme/Phys.simul arrived at : 

Matthias Felleisen writes: 

> On Apr 18, 2005, at 9:05 AM, Jens Axel Søgaard wrote:

>> Using nothing but R5RS isn't that difficult, but it requires discipline.
>> In a physics context it is possible to get quite far with small means.
>> Perhaps you know "Structure and Interpretation of Classical Mechanics"?
>> Here is a random page: 
>>    <http://mitpress.mit.edu/SICM/book-Z-H-11.html#%_sec_Temp_58> 
>> showing how to find trajectories for a harmonic oscillator.
> Warning: SICM is _not_ written in R5RS. It implements a special language, 
> which someone here mostly ported to DrScheme.

Actually it is mainly based on MIT-Scheme with its typical extensions. Brian
Beckman asked a long time ago about porting this to PLT (and accidentally
making a "horrible" mistake with one of the Authors' names...), and Matthew
said that he has given up... 

Look, from my perspective - a physicist who knows Scheme fairly well, and
who for some reasons read the Sussman & Wisdom book line by line - I would
recommend that people *inspire* themselves by the book and its philosophy,
but that they DON'T TRY TO CLONE ITS CODE! 

It is adapted to the dialect used, what is not so profound a hindrance,
but it is adapted to the teaching methodology adopted by S&W and their
pals. Seeing Scheme through SICP. Using a specific mathematical philosophy,
quite correct, but restricted.
The Authors wanted to use some geometrical invariance, but they consciously
ignored - e.g., - differential forms. Extending the arithmetic to functional
objects, and needing differentiation, they nevertheless omitted the
'automatic differentiation' machinery. 

The implementation issues became thus rather non-uniform, sometimes not
so well explained. In a few places you open your eyes, and say, oh, my,
it is a pity that Scheme permits no easy currying because of parentheses... 

In a few places I tried - experimentally - to attribute *types* to some
expressions. The way SICM uses overloading it is not possible (for me).
Thus, translation to some other functional language (I thought about Haskell
or Clean, *obviously*...) became doubtful... 


On the other hand, for you who might bear some illusions - SICM is NOT
a book on Scheme applications! It is a fabulous, extremely profound book
on physics, for computing physicists. 

Making trajectories for an integrable system, such as the oscillator, one
may find at every street corner. Reducing complex systems, exploiting
some very high brow variational principles, *here* S&W show all their

Whether Scheme is appropriate for heavy number-crunching is another story.
I have the impression that in order to get some reasonable performance, one
would have to have unboxed numbers with statically compiled non-overloaded

Jerzy Karczmarczuk 

Posted on the users mailing list.