On 17-09-2013 18:48, Ether Jones wrote:
> I have a list of ordered pairs (t,speed) representing the speed of an
> object vs time.
>
> Is there a built-in Maxima function to generate the associated list of
> ordered pairs (t,distance)?
>
> The "t" values are equally spaced apart.
>
Hi,
I'm not aware of any built-in functions, but you could implement the
trapezoid (or other) rule:
list_integrate(x) := block([y: [[x[1][1], 0]]],
for i:2 thru length(x) do
y:endcons( [x[i][1], y[i-1][2] + (x[i][1]-x[i-1][1])*(x[i-1][2] + x[i][2])/2],y),
y)$
and use it like this:
list_integrate( [[1,4], [2,3], [3,6]] ) ----> [[1,0], [2,7/2], [3,8]]
I hope this helps. Regards,
Jaime