I generate a Taylor series following these instructions :
f(x) := ''(ratdisrep(taylor(qExct('x),'x,0,5)));
qExct is a function that is not defined : I want to perform a certain computation for any qExct that is a smooth function.
Knowing this, how do I set variable x
to a certain value (e.g. 1) ?
If I do this :
f(1);
Then maxima returns me the following error :
diff: variable must not be a number; found: 1
And if I do that :
f(D);
then it considers D
a variable and substitutes all occurrences of variable x
with variable D
. In particular, it differentiates using d/dD instead of d/dx. However, what I would like is to substitute variable x
with number 1
in the x^n terms only and keep the derivatives as they are…
How do I do this ?
The variable in a diff
expression is not recognized everywhere in Maxim as a dummy (formal) variable, so when you try to evaluate f(1)
, Maxima substitutes 1 into the diff
expression and causes the error. I think that's a bug; I'll make a bug report about it.
As a work around, you can use the add-on package pdiff
(positional derivatives) which is included with Maxima. The notation is a little different from the dy/dx notation which is used by default in Maxima.
(%i1) load (pdiff) $
(%i2) f(x) := ''(ratdisrep(taylor(qExct('x),'x,0,2)));
2
qExct (0) x
""(2)
(%o2) f(x) := ---------------- + qExct (0) x + qExct(0)
2 ""(1)
(%i3) f(h);
2
qExct (0) h
(2)
(%o3) -------------- + qExct (0) h + qExct(0)
2 (1)
(%i4) ev (%, qExct=sin);
(%o4) h
(%i5) ev (%o3, h=1);
qExct (0)
(2)
(%o5) ----------- + qExct (0) + qExct(0)
2 (1)
I think the spurious ""
in the display of f(x) := ...
are minor display bugs; I think you can ignore them.
There is documentation for pdiff
in share/pdiff/pdiff-doc.pdf
in your Maxima installation.