Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!news.alpha.net!uwm.edu!lll-winken.llnl.gov!xanth.cs.odu.edu!maui.cc.odu.edu!hearst.acc.Virginia.EDU!murdoch!elvis.med.Virginia.EDU!sdm7g
From: sdm7g@elvis.med.Virginia.EDU (Steven D. Majewski)
Subject: Re: Lisp vs. C++ for scientific applications
X-Nntp-Posting-Host: elvis.med.virginia.edu
Message-ID: <D8H822.DxG@murdoch.acc.Virginia.EDU>
Sender: usenet@murdoch.acc.Virginia.EDU
Organization: University of Virginia
References: <D7LFJp.J03@world.std.com> <PHILG.95Apr30164452@camelot.ai.mit.edu> <KANDERSO.95May1121952@bitburg.bbn.com> <3oqrkg$10i@coils.cims.nyu.edu>
Date: Fri, 12 May 1995 17:46:50 GMT
Lines: 57


>>   In article <D7LFJp.J03@world.std.com> wilcox@world.std.com (gregory c wilcox) writes:
>>
>>      My boss is a C programmer who writes heavy-duty scientific and
>>      mathematical applications. He has heard lots of good things about
>>      object-oriented programming, and he's about to take the plunge into
>>      C++. Before he does, I'd like to give him a short code example of
>>      something you can do with LISP that's harder (or impossible) in C++.
>


"Fast Floating-Point Processing in Common Lisp", 
 by Fateman, Broughan, Willcock & Rettig
<http://www.stat.ucla.edu/develop/lisp/common/docs/fastlisp.ps>

Has some pros and cons (with their answers to the cons) on using
common lisp for numerical programming. 

In the first sentence, they mention the combination of numerical and
symbolic programming - which I think is one of the key points.
Typically, the goal of Lisp or other functional languages in numerical
programming, is to be *nearly* as good as Fortran, so that one can
take advantage of the other capabilities of the language 
( interactive, higher-level functions, object-oriented, graphics, etc.)
without paying a big penalty in numerical performance. 

One example from my own experience was not done in Lisp, but in Python,
but I think the same lesson holds: we were calculating weighing factors
for callibrating elemental x-ray spectra - the math is quite simple and
could have been done on a hand calculator: you collect the spectra for
binary references that have two peaks, NaCl, KCl, etc. for example, get
all of the measured relative ratios, and calculate all of the derived
ratios, and if you can peg one of them down to an absolute value, then
you can calculate all of the weighing factors from the ratios. The only
problem is that all of the ratios should turn out to be consistant, and
they didn't. So I had to add some accounting and backtracking to the
program to look for the "garbage" data that was producing inconsistant
results. I told the folks in the lab which references looked suspicious, 
and they found the problems and redid them.

The language features that made this simple were the interactive nature
and the ability to easily add slots to the data to carry an "audit-trail"
of the reference ratios used to derive it, without having to modify much
of the code. 


I'm currently prototyping some statistics in xlisp-stat. 
I suspect the final result will end up being recoded in C++ 
( And if I can avoid doing so, I will! ;-), but xlisp-stat
is a nice interactive prototyping platform. 
( The Xlisp-stat archives are somewhere on the same server as the URL 
 for the paper above. )

---|  Steven D. Majewski   (804-982-0831)  <sdm7g@Virginia.EDU>  |---
---|  Computer Systems Engineer          University of Virginia  |---
---|  Department of Molecular Physiology and Biological Physics  |---
---|  Box 449 Health Science Center    Charlottesville,VA 22908  |---
