goshanoob
goshanoob

Reputation: 75

How to find the value of a function after interpolation and differentiation of it in Maxima

There is such Maxima code

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));

I want to find the value of the obtained function qt1(x) for x=1. Then I write qt1(0.3); and I get massage

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);

What should be done?

Upvotes: 0

Views: 98

Answers (1)

slitvinov
slitvinov

Reputation: 5768

Maxima does not know how to differentate charfun2. You can teach it.

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)) $

I changed points in `q'.

Upvotes: 1

Related Questions