如何在千里马中插值和区分后找到函数的值

时间:2017-05-23 07:53:31

标签: function interpolation maxima differentiation

有这样的千里马代码

kill(all);load("interpol")$
q1:[[0,0.1], [0.25,0.2], [0.5,0.3], [0.75,0.4]];
f1(x):=''(cspline(q1));
qt1(x):=''(diff(f1(x),x,1));

我想找到qt1(x)获取的函数x=1的值。然后我写qt1(0.3);然后我得到按摩

diff: variable must not be a number; found: 0.3
#0: qt1(x=0.3) (interpol.mac line 106)
-- an error. To debug this try: debugmode(true);

应该做什么?

1 个答案:

答案 0 :(得分:1)

Maxima不知道如何区分charfun2。你可以教它。

load("interpol") $

q: [[0,0.1], [0.25,0.2], [0.5,-0.3], [0.75,1.4]] $

gradef(charfun2(x, A, B), 0) $

e:  cspline(q)  $
de: diff(e, 'x) $

define( f('x),  e) $
define(df('x), de) $

draw2d(explicit(f('x), 'x, 0, 1), 'color='red, explicit(df('x), 'x, 0, 1)) $

我改变了'q'中的分数。