I do not think that you are using depends() correctly. You cannot give it a
matrix argument and expect it to work. The correct syntax is,
depends([list of dependent variables],[list of independent
variables]),
i.e., if you have, say, A, B, and C as functions of x and y (i.e., A, B, and
C are your dependent variables, whereas x and y are your independent
variables), then writing
depends([A,B,C],[x,y])
will tell Maxima just that. Subsequently, you could write
diff(A,x)
and get a non-zero result (that is, dA/dx). Without depends(), you'd have to
write
diff(A(x),x)
to get a non-zero result.
However, I am beginning to have a suspicion that what you really mean is
that f_L, c_Lx, and c_Ly are your INDEPENDENT variables, and you have no
dependent variables at all; your matrix is an explicit expression consisting
your independent variables and constants only. That means that you need not
use depends at all.
To replicate what you're doing with jacobian(), you could write
block([y:flatten(args(transpose(K_L))),
x:[f_L,c_Lx,c_Ly]],
block([r:zeromatrix(length(y),length(x))],
for i thru length(y) do
for j thru length(x) do r[i,j]:diff(y[i],x[j]),
r
)
);
Viktor
-----Original Message-----
From: weaker at directbox.com [mailto:weaker at directbox.com]
Sent: Friday, May 30, 2008 1:02 PM
To: vttoth at vttoth.com
Cc: maxima at math.utexas.edu
Subject: depends
Hi Vikor,
I somehow don't get "depends" to work. What I try is
- Writing the matrix
(%i1) K_L : matrix([f_L,beta_L,c_Lx],[0,alpha_L*f_L,c_Ly],[0,0,1]);
(%o1) matrix([f_L,beta_L,c_Lx],[0,alpha_L*f_L,c_Ly],[0,0,1])
- For a test, I want to consider f_L, c_Lx, c_Ly as variables and the rest
as constants
(%i2) depends([f_L,c_Lx,c_Ly],K_L);
(%o2)
[f_L(matrix([f_L,beta_L,c_Lx],[0,alpha_L*f_L,c_Ly],[0,0,1])),c_Lx(matrix([f_
L,beta_L,c_Lx],[0,alpha_L*f_L,c_Ly],[0,0,1])),c_Ly(matrix([f_L,beta_L,c_Lx],
[0,alpha_L*f_L,c_Ly],[0,0,1]))]
- Hoping that Maxima understands that it has to differentiate regarding to
the three depending variables. It doesn't.
(%i3) diff(K_L);
Maxima encountered a Lisp error:
Error in PROGN [or a callee]: Bind stack overflow.
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
- Trying to explicitly tell, what variables are to differentiate - no luck.
(%i4) diff(K_L, [f_L,c_Ly,c_Lx]);
Non-variable 2nd argument to diff:
[f_L,c_Ly,c_Lx]
-- an error. To debug this try debugmode(true);
- What works is the following:
jacobian(flatten(args(transpose(K_L))),[f_L, c_Lx, c_Ly]); /*works!*/
But how would I do that with "depends"?
Any more tips I could try?
Best regards,
weaker