diff: variable must not be a number; found: | bug??
Subject: diff: variable must not be a number; found: | bug??
From: Leo Butler
Date: Mon, 18 Nov 2013 14:57:27 GMT
Date: Mon, 18 Nov 2013 09:37:05 -0500
From: Evan Cooch <evan.cooch at gmail.com>
Using 5.31.2 under Win 7. Am having major problems trying to figure out
why diff is choking on something. Here is a MWE:
base :
matrix([f1*gam,f2*gam,f3*gam,0,0],[0,0,0,S*eps1,0],[0,0,0,0,S*eps2],[f1*(1-gam),f2*(1-gam),f3*(1-gam),0,0],[0,0,0,S*(1-eps1),S*(1-eps2)]);
cp_base : charpoly(base,lambda);
Then, I want to implicitly differentiate the characteristic polynomial
for f1 wrt to lambda. To do this, I use
depends(lambda,f1);
deriv : diff(cp_base,f1);
lls_f1: solve(deriv,'diff(lambda,f1));
So far, everything works as it should -- the implicit derivative is
exactly what is yielded by other CAS (e.g., Maple).
The problem is when I try to subst in values for the different
parameters (e.g., gam, or f1...). I want to numerically evaluate the
derivative. When I try
lls_f1 :
subst([f3=18,f2=12,f1=8,gam=0.0725,S=0.4,eps1=0.1,eps2=0.02,lambda=1.065],
lls_f1);
Maxima returns the following error:
diff: variable must not be a number; found: 8
Maxima/diff is telling you that when it subst's f1=8 into lls_f1, it
finds diff(blah,8), which is non-sensical.
You want something like
at(lls_f1,[f1=8]);
Insights? Suggestions?
There are lots of previous threads on this topic, see for e.g.
http://comments.gmane.org/gmane.comp.mathematics.maxima.general/35582
Leo