implicit diffferentiation and subst



'subst' is a syntactic substitution.  It can be useful to substitute one
symbolic variable for another, e.g. subst(z,y,'diff(x,y)) => 'diff(x,z).
 But it is not meaningful to substitute a number for a variable of
differentiation: what is dx/d3?

'at', on the other hand, means 'evaluate at'.  For example:

(%i5) 'diff(y,x)=x;
(%o5) 'diff(y,x,1) = x
(%i6) at(%,x=3);
(%o6) ?%at('diff(y,x,1),x = 3) = 3
(%i7) subst(3,x,%o5);
Attempt to differentiate with respect to a number:
3
 -- an error. To debug this try: debugmode(true);

You could also just use subst on the part without diffs:

(%i8) subst(3,x,rhs(%o5));
(%o8) 3

Does this solve your problem?

               -s

On Wed, Oct 5, 2011 at 12:24, egc <cooch17 at verizon.net> wrote:

>  Consider the following --
>
> 1\ create square non-negative projection matrix, in terms of a set of
> underlying parameters:
>
> mat:matrix([0,s_a*m_2,s_a*m_3],[s_o,0,0],[0,s[a],s[a]]);
>
> 2\ generate characteristic polynomial for matrix
>
> cp:charpoly(mat,lam);
>
> 3\ implicitly differentiate cp for lam with respect to parameter s_a
>
> depends(lam,s_a);
> deriv:diff(cp,s_a);
> sol:solve(deriv,'diff(lam,s_a));
>
>
> So far, so good. Returned expression for sol is correct. But, I want to
> evaluate sol given the numerical values of each parameter. However, when I
> try something as obvious as
>
> subst([s_a=0.8,s_o=0.4,m_2=1.2,m_3=1.2,lam=1.1667],sol);
>
> I get the following error message from Maxima
>
> diff: variable must not be a number; found: 0.8
>  -- an error. To debug this try: debugmode(true);
>
>
> OK, so how does one evaluate a diff numerically (if that is a correct
> statement of the problem)?
>
> I've fooled (a bit) with psubst and at, but haven't hit the 'right trick'
> yet.
>
> Surely substituting known values into a differential equation should be
> straightforward (since every other symbolic algebra program I've ever used
> handles this with no problems whatsoever). Perhaps not a problem with
> Maxima, but clearly a magic command (or some such) I'm missing.
>
>
> Thanks in advance for any suggestions/insights...
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>