## [Maxima-commits] CVS: maxima/share/misc declin.dem,1.3,1.4

 [Maxima-commits] CVS: maxima/share/misc declin.dem,1.3,1.4 From: Robert Dodier - 2005-01-26 02:11:54 ```Update of /cvsroot/maxima/maxima/share/misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28090/misc Modified Files: declin.dem Log Message: Changing uppercase to lowercase in some demo files. Uppercase in comments is unchanged. All demo files were reviewed at this time but most of them are already in lowercase. Index: declin.dem =================================================================== RCS file: /cvsroot/maxima/maxima/share/misc/declin.dem,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- declin.dem 28 Jul 2002 11:37:28 -0000 1.3 +++ declin.dem 26 Jan 2005 02:09:43 -0000 1.4 @@ -4,54 +4,54 @@ F is to be linear in its first, third and fifth arguments. The predicate to be used for distinguishing the coefficients of these arguments will be called FVARP. */ -DECLARE_LINEAR_OPERATOR(F,[1,3,5],FVARP); -FVARP(EXP):=MEMBER(EXP,[A,B,C]); +declare_linear_operator(f,[1,3,5],fvarp); +fvarp(exp):=member(exp,[a,b,c]); /* An example of an expression with the necessary property is: */ -FF(X,E,Y,F,Z,G,X):=(K1*X+K2*Y+K3*Z)/(E+F)^G; +ff(x,e,y,f,z,g,x):=(k1*x+k2*y+k3*z)/(e+f)^g; /* In this expression, FF is linear in [X, Y, Z], taken as the components of a vector. Note that this is distinguished from being linear in X, Y, or Z taken one at a time. Here is an expression that is equivalent to 0. */ -EXP1:(F(A,X,B,Y,C,Z)*2-F(2*A,X,2*B,Y,2*C,Z))*H(Q)/(A+B)*(F+H); +exp1:(f(a,x,b,y,c,z)*2-f(2*a,x,2*b,y,2*c,z))*h(q)/(a+b)*(f+h); /* The function LINSIMP looks at sums contained in its first argument and combines the F expressions whenever possible. */ -LINSIMP(EXP1,F); +linsimp(exp1,f); /* The function LINSIMP extracts coefficients from the arguments of F whenever it can. */ -EXP2:F(6*A,X,2*B,Y,4*C,Z); -LINSIMP(EXP2,F); +exp2:f(6*a,x,2*b,y,4*c,z); +linsimp(exp2,f); /* To remove the LINEAR_OPERATOR property from F, use REM. */ -REM(F,LINEAR_OPERATOR); +rem(f,linear_operator); /* Now verify that it is gone: */ -ERRCATCH(LINSIMP(EXP,F)); +errcatch(linsimp(exp,f)); /* LINSIMP can simplify with respect to several operators. To illustrate this, we first make the necessary declarations. */ -DECLARE_LINEAR_OPERATOR(F,[1,2,3],FVARP); -DECLARE_LINEAR_OPERATOR(H,[1,2],HVARP); -HVARP(EXP):=MEMBER(EXP,[D,E,F])\$ -EXP3:(F(2*A,-A*X,B/3,W)-F(A,B*X,C,W) - +H(W*E,F*(A+B),3)+2*H(-W*E,F*A,3))/A; -LINSIMP(EXP3,F,H); +declare_linear_operator(f,[1,2,3],fvarp); +declare_linear_operator(h,[1,2],hvarp); +hvarp(exp):=member(exp,[d,e,f])\$ +exp3:(f(2*a,-a*x,b/3,w)-f(a,b*x,c,w) + +h(w*e,f*(a+b),3)+2*h(-w*e,f*a,3))/a; +linsimp(exp3,f,h); /* Notice that in the above example, LINSIMP was NOT confused by the presence of F as both a variable and an undefined operator. LINSIMP will not combine forms that differ in the arguments that are not specified in the linearity declaration: */ -EXP4:F(A,B,C,D,E)-F(A,B,C,D,H); -LINSIMP(EXP4,F); +exp4:f(a,b,c,d,e)-f(a,b,c,d,h); +linsimp(exp4,f); /* But it will make combinations whenever possible, even when the operator appears with varying numbers of arguments: */ -EXP5:F(A,B,C,D,E)-F(A,B,2*C,D,E)+2*F(B,A,C)-H*F(C,2*B,A); -LINSIMP(EXP5,F); +exp5:f(a,b,c,d,e)-f(a,b,2*c,d,e)+2*f(b,a,c)-h*f(c,2*b,a); +linsimp(exp5,f); /* LINSIMP also recognizes the zero case: */ -EXP6:F(0,0,0,A,B,C); -LINSIMP(EXP6,F); +exp6:f(0,0,0,a,b,c); +linsimp(exp6,f); /* Here is an example with SUM: */ -DECLARE_LINEAR_OPERATOR(NOUNIFY(SUM),[1],'SUMVARP); -SUMVARP(EXP):=not(FREEOF('N,EXP)); -A*'SUM(F(N)*X^N,N,0,INF)+B*X*'SUM(G(N)*X^(N-1),N,0,INF); -FACTOR(LINSIMP(%,NOUNIFY('SUM))); +declare_linear_operator(nounify(sum),[1],'sumvarp); +sumvarp(exp):=not(freeof('n,exp)); +a*'sum(f(n)*x^n,n,0,inf)+b*x*'sum(g(n)*x^(n-1),n,0,inf); +factor(linsimp(%,nounify('sum))); ```

 [Maxima-commits] CVS: maxima/share/misc declin.dem,1.3,1.4 From: Robert Dodier - 2005-01-26 02:11:54 ```Update of /cvsroot/maxima/maxima/share/misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28090/misc Modified Files: declin.dem Log Message: Changing uppercase to lowercase in some demo files. Uppercase in comments is unchanged. All demo files were reviewed at this time but most of them are already in lowercase. Index: declin.dem =================================================================== RCS file: /cvsroot/maxima/maxima/share/misc/declin.dem,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- declin.dem 28 Jul 2002 11:37:28 -0000 1.3 +++ declin.dem 26 Jan 2005 02:09:43 -0000 1.4 @@ -4,54 +4,54 @@ F is to be linear in its first, third and fifth arguments. The predicate to be used for distinguishing the coefficients of these arguments will be called FVARP. */ -DECLARE_LINEAR_OPERATOR(F,[1,3,5],FVARP); -FVARP(EXP):=MEMBER(EXP,[A,B,C]); +declare_linear_operator(f,[1,3,5],fvarp); +fvarp(exp):=member(exp,[a,b,c]); /* An example of an expression with the necessary property is: */ -FF(X,E,Y,F,Z,G,X):=(K1*X+K2*Y+K3*Z)/(E+F)^G; +ff(x,e,y,f,z,g,x):=(k1*x+k2*y+k3*z)/(e+f)^g; /* In this expression, FF is linear in [X, Y, Z], taken as the components of a vector. Note that this is distinguished from being linear in X, Y, or Z taken one at a time. Here is an expression that is equivalent to 0. */ -EXP1:(F(A,X,B,Y,C,Z)*2-F(2*A,X,2*B,Y,2*C,Z))*H(Q)/(A+B)*(F+H); +exp1:(f(a,x,b,y,c,z)*2-f(2*a,x,2*b,y,2*c,z))*h(q)/(a+b)*(f+h); /* The function LINSIMP looks at sums contained in its first argument and combines the F expressions whenever possible. */ -LINSIMP(EXP1,F); +linsimp(exp1,f); /* The function LINSIMP extracts coefficients from the arguments of F whenever it can. */ -EXP2:F(6*A,X,2*B,Y,4*C,Z); -LINSIMP(EXP2,F); +exp2:f(6*a,x,2*b,y,4*c,z); +linsimp(exp2,f); /* To remove the LINEAR_OPERATOR property from F, use REM. */ -REM(F,LINEAR_OPERATOR); +rem(f,linear_operator); /* Now verify that it is gone: */ -ERRCATCH(LINSIMP(EXP,F)); +errcatch(linsimp(exp,f)); /* LINSIMP can simplify with respect to several operators. To illustrate this, we first make the necessary declarations. */ -DECLARE_LINEAR_OPERATOR(F,[1,2,3],FVARP); -DECLARE_LINEAR_OPERATOR(H,[1,2],HVARP); -HVARP(EXP):=MEMBER(EXP,[D,E,F])\$ -EXP3:(F(2*A,-A*X,B/3,W)-F(A,B*X,C,W) - +H(W*E,F*(A+B),3)+2*H(-W*E,F*A,3))/A; -LINSIMP(EXP3,F,H); +declare_linear_operator(f,[1,2,3],fvarp); +declare_linear_operator(h,[1,2],hvarp); +hvarp(exp):=member(exp,[d,e,f])\$ +exp3:(f(2*a,-a*x,b/3,w)-f(a,b*x,c,w) + +h(w*e,f*(a+b),3)+2*h(-w*e,f*a,3))/a; +linsimp(exp3,f,h); /* Notice that in the above example, LINSIMP was NOT confused by the presence of F as both a variable and an undefined operator. LINSIMP will not combine forms that differ in the arguments that are not specified in the linearity declaration: */ -EXP4:F(A,B,C,D,E)-F(A,B,C,D,H); -LINSIMP(EXP4,F); +exp4:f(a,b,c,d,e)-f(a,b,c,d,h); +linsimp(exp4,f); /* But it will make combinations whenever possible, even when the operator appears with varying numbers of arguments: */ -EXP5:F(A,B,C,D,E)-F(A,B,2*C,D,E)+2*F(B,A,C)-H*F(C,2*B,A); -LINSIMP(EXP5,F); +exp5:f(a,b,c,d,e)-f(a,b,2*c,d,e)+2*f(b,a,c)-h*f(c,2*b,a); +linsimp(exp5,f); /* LINSIMP also recognizes the zero case: */ -EXP6:F(0,0,0,A,B,C); -LINSIMP(EXP6,F); +exp6:f(0,0,0,a,b,c); +linsimp(exp6,f); /* Here is an example with SUM: */ -DECLARE_LINEAR_OPERATOR(NOUNIFY(SUM),[1],'SUMVARP); -SUMVARP(EXP):=not(FREEOF('N,EXP)); -A*'SUM(F(N)*X^N,N,0,INF)+B*X*'SUM(G(N)*X^(N-1),N,0,INF); -FACTOR(LINSIMP(%,NOUNIFY('SUM))); +declare_linear_operator(nounify(sum),[1],'sumvarp); +sumvarp(exp):=not(freeof('n,exp)); +a*'sum(f(n)*x^n,n,0,inf)+b*x*'sum(g(n)*x^(n-1),n,0,inf); +factor(linsimp(%,nounify('sum))); ```