if EXPR is E+D+C+B+A, then PART(EXPR,[2,5]); ==> D+A
while
PART(EXPR,ALLBUT(2,5))==>E+C+B
It also works with the KILL command,
KILL(ALLBUT(name1,...,namek))
will do a KILL(ALL) except it will not KILL the names specified. Note: namei means a name such as function name such as U, F, FOO, or G, not an infolist such as FUNCTIONS.
(C1) IS(X**2 >= 2*X-1); (D1) TRUE (C2) ASSUME(A>1); (D2) DONE (C3) IS(LOG(LOG(A+1)+1)>0 AND A^2+1>2*A); (D3) TRUE
(C1) A+B*C$ (C2) FULLMAP(G,%); (D2) G(B) G(C) + G(A) (C3) MAP(G,D1); (D3) G(B C) + G(A)
(C1) FULLMAPL("+",[3,[4,5]],[[A,1],[0,-1.5]]);
(D1) [[A + 3, 4], [4, 3.5]]
SUBLIS([A=B,B=A],SIN(A)+COS(B));
=> SIN(B) + COS(A)
The variable SUBLIS_APPLY_LAMBDA[TRUE] controls simplification after SUBLIS. For full documentation, see the file SHARE2;SUBLIS INFO.
(C1) SUBST(A,X+Y,X+(X+Y)**2+Y);
2
(D1) Y + X + A
(C2) SUBST(-%I,%I,A+B*%I);
(D2) A - %I B
(Note that C2 is one way of obtaining the complex conjugate of an analytic expression.) For further examples, do EXAMPLE(SUBST);
(C1) X.'DIFF(F(X),X,2);
2
d
(D1) X . (--- F(X))
2
dX
(C2) SUBSTINPART(D**2,%,2);
2
(D2) X . D
(C3) SUBSTINPART(F1,F[1](X+1),0);
(D3) F1(X + 1)
Additional Information
If the last argument to a part function is a list of indices then
several subexpressions are picked out, each one corresponding to an
index of the list. Thus PART(X+Y+Z,[1,3]) is Z+X.
PIECE holds the value of the last expression selected when using the
part functions. It is set during the execution of the function and
thus may be referred to in the function itself as shown below.
If PARTSWITCH[FALSE] is set to TRUE then END is returned when a
selected part of an expression doesn't exist, otherwise an error
message is given.
(C1) 27*Y**3+54*X*Y**2+36*X**2*Y+Y+8*X**3+X+1;
3 2 2 3
(D1) 27 Y + 54 X Y + 36 X Y + Y + 8 X + X + 1
(C2) PART(D1,2,[1,3]);
2
(D2) 54 Y
(C3) SQRT(PIECE/54);
(D3) Y
(C4) SUBSTPART(FACTOR(PIECE),D1,[1,2,3,5]);
3
(D4) (3 Y + 2 X) + Y + X + 1
(C5) 1/X+Y/X-1/Z;
1 Y 1
(D5) - - + - + -
Z X X
(C6) SUBSTPART(XTHRU(PIECE),%,[2,3]);
Y + 1 1
(D6) ----- - -
X Z
Also, setting the option INFLAG to TRUE and calling PART/SUBSTPART is the same as calling INPART/SUBSTINPART.
(C1) 1/(X**2+2);
1
(D1) ------
2
X + 2
(C2) SUBSTPART(3/2,%,2,1,2);
1
(D2) --------
3/2
X + 2
(C3) A*X+F(B,Y);
(D3) A X + F(B, Y)
(C4) SUBSTPART("+",%,1,0);
(D4) X + F(B, Y) + A
Also, setting the option INFLAG to TRUE and calling PART/SUBSTPART is the same as calling INPART/SUBSTINPART.
(C1) ((X+2)**20-2*Y)/(X+Y)**20+(X+Y)**-19-X/(X+Y)**20;
20
1 X (X + 2) - 2 Y
(D1) --------- - --------- + ---------------
19 20 20
(Y + X) (Y + X) (Y + X)
(C2) XTHRU(%);
20
(X + 2) - Y
(D2) -------------
20
(Y + X)