Subject: unnecessary prompt while using defined functions
From: amli at comcast.net
Date: Sun, 22 Jul 2007 17:23:51 +0000
Hello,
I am defining some functions that involve subscripted variables, trig functions, and sqrt. There are no conditional
expressions involved. When I use these functions I get a prompt asking for positive, negative, or zero.
inc(1) // no prompt
sca(1) // I get following prompts
Is %mu[1] positive, negative, or zero? pos;
Is %rho[1] positive, negative, or zero? pos;
Is 2 * %mu[1] + %lambda[1] positive, negative, or zero? pos;
I do not understand why I am getting a prompt which happens in sca function and not in inc function. I should not be getting any prompt. Here is the code (WxMaxima 0.7.1)
-----------------------------------------------------------------------------------------------------------------------
load(linearalgebra);
load(eigen);
load("diag");
load("mactex-utilities.lisp");
load("lrats");
vel(ir):=[sqrt(%mu[ir])/sqrt(%rho[ir]),
sqrt(2*%mu[ir]+%lambda[ir])/sqrt(%rho[ir]),sqrt(%mu[ir])/sqrt(%rho[ir])]$
_Av:lambda([ir,th],[sqrt(%mu[ir])/sqrt(%rho[ir]),matrix([-2*sqrt(%mu[ir])*sqrt(%rho[ir])*cos(th)*sin(th)],
[2*sqrt(%mu[ir])*sqrt(%rho[ir])*cos(th)*sin(th)],[0],[0],[0],
[sqrt(%mu[ir])*sqrt(%rho[ir])-2*sqrt(%mu[ir])*sqrt(%rho[ir])*sin(th)^2],[-sin(th)],[cos(th)],[0])])$
_Al:lambda([ir,th],[sqrt(2*%mu[ir]+%lambda[ir])/sqrt(%rho[ir]),
matrix([(2*%mu[ir]*sqrt(%rho[ir])*sin(th)^2+(-2*%mu[ir]-%lambda[ir])*sqrt(%rho[ir]))/sqrt(2*%mu[ir]+%lambda[ir])],
[-(2*%mu[ir]*sqrt(%rho[ir])*sin(th)^2+%lambda[ir]*sqrt(%rho[ir]))/sqrt(2*%mu[ir]+%lambda[ir])],
[-(%lambda[ir]*sqrt(%rho[ir]))/sqrt(2*%mu[ir]+%lambda[ir])],[0],[0],
[-(2*%mu[ir]*sqrt(%rho[ir])*cos(th)*sin(th))/sqrt(2*%mu[ir]+%lambda[ir])],[cos(th)],[sin(th)],[0])])$
_Ah:lambda([ir,th],[sqrt(%mu[ir])/sqrt(%rho[ir]),matrix([0],[0],[0],[-sqrt(%mu[ir])*sqrt(%rho[ir])*sin(th)],
[-sqrt(%mu[ir])*sqrt(%rho[ir])*cos(th)],[0],[0],[0],[1])])$
inc(n):=block([p,th],for m:1 thru 3 do
th[m]:%theta[n,m], addcol(_Ah(n,th[1])[2] * exp(%i * y* sin(th[1])/vel(n)[3]),
_Av(n,th[2])[2]* exp(%i * y* sin(th[2])/vel(n)[2]),
_Al(n,th[3])[2]* exp(%i * y* sin(th[3])/vel(n)[1])));
sca(n):=block([p,th],for m:4 thru 6 do
th[m]:%theta[n,m], addcol(_Ah(n,th[4])[2]*exp(-%i * y* sin(th[4])/vel(n)[3]),
_Av(n,th[5])[2]*exp(-%i * y* sin(th[5])/vel(n)[2]),_Al(n,th[6])[2]*exp(-%i * y* sin(th[6])/vel(n)[1])));
tot(n):=addcol(inc(n),sca(n));
inc(1);
sca(1);
---------------------------------------------------------------------------------------------------------------------------------------
Thank you for your help.
Ram Kochhar