EXSUB

Member Of Menu: 
Algebra
Argument Types: 
Real
Complex
Symbol
Expression
Result Type(s): 
Expression
Invertible: 
No
Valid In Expression: 
No
Stack Diagram: 
Expression1 Real2 Real3 Expression4
Expression1 Real2 Complex3 Expression4
Expression1 Real2 Symbol3 Expression4
Expression1 Real2 Expression3 Expression4

The EXSUB operation is used to substitute a portion of an expression with the item from the top of the stack. The real argument identifies the subexpression in the expression to replace. An expression is a sequence of real numbers, complex numbers, symbols and operations. If you read your expression from left to right, the left most item in that sequence is 1 and each item after that is the next number in the sequence. If the item at this offset is a real number, complex number or symbol, then the subexpression is that item itself. If the item at this offset is an operation, then the subexpression is the operation and its arguments.

So, for the expression 'SIN(X+10)', the subexpressions are:

Index Subexpression
1 'SIN(X+10)' Expression
2 Symbol X
3 'X+10' Expression
4 Real Number 10

To use EXSUB on this expression, you would specify a number from 1 to 4 depending on which subexpression you wanted to substitute.

In the above expression, if you wanted to change the argument to the SIN operation to 'COS(X)', you would specify 3 as the position put 'COS(X)' at the top of the stack. The EXSUB command would return 'SIN(COS(X))'