The following table contains different velocity measures of a flying object, the first column corresponds to the moments of observations in seconds, and the second column to velocities in meters per second.
Time (s) | Velocity (m/s) |
---|---|
0 | 0 |
10 | 25 |
15 | 36 |
20 | 68 |
25 | 93 |
30 | 97 |
35 | 99 |
Let's introduce these data into Maxima and see how they look like,
table: [[0,0], [10,25], [15,36], [20,68], [25,93], [30,97], [35,99]]$ load(draw)$ draw2d( points_joined = true, grid = true, points(table)) $
Observed data are joined by segments or linear interpolators, we can take advantage of them to estimate velocities in any point between 0 and 35 seconds.
load("interpol") $ lin: linearinterpol(table, varname=t);
5tcharfun2(t,−∞,10)2+(2t5+85)charfun2(t,30,∞)+(4t5+73)charfun2(t,25,30)+(5t−32)charfun2(t,20,25)+(32t5−60)charfun2(t,15,20)+(11t5+3)charfun2(t,10,15)
In the result above, function charfun_2 is defined in package interpol and returns 1 if the first argument belongs to the interval defined by the other two arguments.
If we want an estimation of the velocity of the flying object at t=7s and t=24s, we can define a function,
v1(t) := ''lin $ [v1(7), v1(24)] ;
[352,88]
In case we prefer a smooth function for interpolation, an alternative is the Lagrangian polynomial,
lag: lagrange(table, varname=t);
33(t−30)(t−25)(t−20)(t−15)(t−10)t4375000−97(t−35)(t−25)(t−20)(t−15)(t−10)t2250000+31(t−35)(t−30)(t−20)(t−15)(t−10)t312500−17(t−35)(t−30)(t−25)(t−15)(t−10)t187500+(t−35)(t−30)(t−25)(t−20)(t−10)t31250−(t−35)(t−30)(t−25)(t−20)(t−15)t150000
This is a sixth degree polynomial,
lag: expand(lag);
−67t639375000+92t5328125−1051t463000+2351t35250−168359t231500+13238t525
We interpolate again for t=7s and t=24s,
v2(t) := ''lag $ [v2(7), v2(24)] ;
[255241878125,700339278125]
Let's now add the Lagrange polynomial to our plot of observed data,
draw2d( points_joined = true, grid = true, points(table), color = red, explicit (v2(t),t,0,35)) $
As is easily seen, the Lagrange polynomial can be a bad interpolator near the boundaries of the experimental data.
In case we want an estimation of the instantaneous acceleration in t=17, since a(t)=dv(t)dt, we can differentiate the interpolator,
/* in m/s^2 */ float(subst(t=17, diff(v2(t),t)));
6.492423771428571
The mean velocity during time interval [10,25], defined as 125−10∫2510v(t)dt, is
/* in m/s */ float(integrate(v2(t),t, 10, 25) / (25-10));
53.77636054421769
The distance covered during this time interval is given by ∫2510v(t)dt, which is equal to
/* in m */ float(integrate(v2(t),t, 10, 25));
806.6454081632653
© 2016, TecnoStats.