implicit differentiation and subscripted variables?
Subject: implicit differentiation and subscripted variables?
From: egc
Date: Mon, 03 Oct 2011 09:54:00 -0400
I am in the process of porting over a *lot* of lecture notes from Maple
-> Maxima. For the most part, this has been a relatively straightforward
'port'.
But, I am stuck a bit on handling implicit differentiation (which is a
one-line command in Maple, but requires a couple of steps in Maxima). My
problem isn't so much >1 steps ( can probably write a wrapper to shield
students from the multiple steps), but rather, why the depends command
is blowing up. Take the following example:
mat:matrix([0,s[a]*m[1],s[a]*m[a]],[s[o],0,0],[0,s[a],0]);
cp:charpoly(mat,lambda);
Now, what I want students to do is implicitly differentiate lambda wrt
to each other variable in the characteristic polynomial. So, for
example, to implicitly differentiate lambda wrt s[a], I would start with
depends(lambda,s[a]);
But, this throws an error:
depends: argument must be a symbol; found s[a]
-- an error. To debug this try: debugmode(true);
Guessing that this is because depends doesn't like my attempt to
'subscript' s[a], I try
mat:matrix([0,sa*m1,sa*ma],[so,0,0],[0,sa,0]);
cp:charpoly(mat,lambda);
depends(lambda,sa);
Now, this works fine (so, my guess was right).
Problem is, using
mat:matrix([0,s[a]*m[1],s[a]*m[a]],[s[o],0,0],[0,s[a],0]);
generates pretty ugly output (not concerned about aesthetics, as much as
the fact that the lack of explicit subscripting makes the process more
error prone for students). So, is there a recommended way to allow for
subscripting of matrix elements (or any variable, for that matter) that
won't cause depends to have 'issues'?
Thanks in advance.