Awefully confused about how to write interpolation routines



On Fri, Dec 16, 2005 at 08:48:02PM -0800, Daniel Lakeland wrote:
> 
> Well based on the discussions earlier, I thought I understood
> something about the "maxima way" to write an interpolation routine
> (starting with linear interpolation). But I see from a little
> experimentation that I don't.
> 
> what should "linterp(xs,ys)" return? 

One person has suggested that it should return an expression with a
free variable named "x", rather than a lambda expression. Because this
isn't a simple computation, the expression would be a block, with
local variables and then loops. Since x would be a free variable, I
assume simplification could take place based on recent binding of x,
and then something like "linterp(xs,ys)" would evaluate to a number in
certain contexts, an unevaluated block expression in other contexts
(where x was unbound) and something else in a context where x was
bound, but the "ys" had symbolic components.

Why this is preferred vs returning a lambda expression is not obvious
to me (i'm just so used to scheme and common lisp that I'm not
"getting it")

so, maybe someone could clarify why 

linterp(xs,ys) := a block expression with x unbound that computes interpolated values when evaluated in an environment where x is bound to a number; 

is preferred vs

linterp(xs,ys) := lambda([x], same block expression here);

I can see the advantage for something like the lagrange routine,
because it returns a polynomial which could be manipulated with maxima
routines in a "mathematical" way, but in this case, the return value
is pretty much "computational" rather than algebraic (in other words,
it has loops and tests and incremented variables and soforth). It
seems to me that a "naked" expression will rarely be more useful than
a lambda expression.



-- 
Daniel Lakeland
dlakelan@street-artists.org
http://www.street-artists.org/~dlakelan