Awefully confused about how to write interpolation routines



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? 

My first thought was a lambda expression, but then I'm not sure how it
would be used.

foo:linterp([1,2,3],[1,4,9]);

foo(2.5);

fine and dandy, but then when I do plot2d(foo,[x,1.2,2.5]); it chokes
(spinning wheels and pouring smoke and taking huge amounts of ram with
no output)

but plot2d('(foo(x)),[x,1.2,2.5]) works fine.

So what's the proper type of thing for a linear interpolation routine
to return?

I'll work out a cubical spline thingy next, and I assume it should do
the same sort of thing, so once I figure out what the right thing is I
can be on my way.

BTW: my plan is to allow symbolic values in the Y values, but require
sorted numerical X values, it's the only thing that makes any sense to
me, otherwise there's no way to know which interval you're in.

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