# OBSUB

Algebra
Argument Types:
Real
List
Expression
Result Type(s):
Expression
Invertible:
No
Valid In Expression:
No
Stack Diagram:
 Expression1 Real2 List3 → Expression4

The OBSUB operation is used to substitute a portion of an expression with the contents of a list. The real argument identifies the component 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.

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

Index Component
1 SIN Operation
2 Symbol X
3 + Operation
4 Real Number 10

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

The list argument must be a list with a single item in it. The list can contain a real number, complex number, symbol or operation. If you try to substitute a real or complex number at a position where the expression has an operation, the OBSUB command will fail. Similarly if you try to substitute an operation where there is not currently an operation.

In the above expression, if you wanted to change the addition to a subtraction, you would specify 3 as the position and the list would look like { - }. The OBSUB command would return 'SIN(X-10)'