# FORM

Algebra
Argument Types:
Real
Complex
Symbol
Expression
Result Type(s):
Expression
Invertible:
No
Valid In Expression:
No
Stack Diagram:
 Real1 → Expression2 Real1 → Expression2 Real3 Expression4 Complex1 → Expression2 Complex1 → Expression2 Real3 Expression4 Symbol1 → Expression2 Symbol1 → Expression2 Real3 Expression4 Expression1 → Expression2 Expression1 → Expression2 Real3 Expression4

This operation takes an expression and allows you to interactively modify that expression in a way that does not change the way the expression would evaluate. For example, adding one and subtracting one to an expression will not change the value of that expression for any given inputs. This is one of the many ways you can modify an expression.

Under most circumstances, the input is a complex expression of some kind. However, you can pass it a real number, complex number or symbol. You can perform some operations on even simple "expressions" like that.

The output in general is a modified version of the input expression. Again, it is possible to simply the expression down to a real number, complex number or a symbol but most times the output will continue to be an expression.

When you execute this operation, the display clears and the input expression is shown in the middle of the display. The left most component of the expression will be highlighted. This indicates what component of the expression is selected and you can operate on. If the selected component is an operation, then you can operate on the sub-expression which is this operation and its arguments. If the selected component is a real number, complex number or symbol, then you can operate on that component independently.

With this operation active, the "FORM" menu buttons are displayed. Among these buttons are the [→] and [←] buttons which allow you to move the selected component of the expression to the left or the right. If you have a hardware keyboard attached to your device, you can also use the left and right cursor keys to move the selected component.

Once you have selected the component you want to operate on, then you can press one or more menu buttons to make a change to that selected component. When you are done, you can press the "Attn" button to leave the interactive editing of the expression. Your edited expression will be pushed onto the stack.

Below is a description of all of the different kinds of sub-operations you can perform in interactive expression editing mode.

## Common Sub-Operations:

The following sub-operations are available regardless of what you have selected in the current expression.

Sub-Operation Description
COLCT This performs the equivalent of the COLCT operation on the sub-expression selected. Normally COLCT performs the action on a complete expression but when executed this way, you can perform it on a subset of the complete expression.
EXPAN This performs the equivalent of the EXPAN operation on the sub-expression selected. Normally EXPAN performs the action on a complete expression but when executed this way, you can perform it on a subset of the complete expression.
LEVEL This displays a popup telling you the level of the currently selected component of the expression. The outer-most operation is always level 1 in an expression. The inputs to at operation are at level 2. If those inputs are themselves sub-expressions, the inputs to that sub-expression is level 3, etc.
EXGET This performs the equivalent of the EXGET operation on the sub-expression selected. When selected, you will leave interactive expression editing mode and go back to normal calculator mode. The expression is pushed to the stack followed by the index of the sub-expression you had selected and finally the sub-expression itself. Normally when you leave interactive editing mode, only the edited expression is pushed to the stack but if you exit this way, you will have these three values pushed onto the stack.
[←] Move the selected component of the expression to the left. If the left-most component is already selected, nothing will happen.
[→] Move the selected component of the expression to the right. If the right-most component is already selected, nothing will happen.

## Conditional Sub-Operations:

The following sub-operations depend on what the input expression looks like. A sample input expression will be shown before and after the action. The expression before the action will have a component highlighted which is what you need to select in order to take that action. If you do not see an action you want to perform, you have the wrong component selected. If you do see an action as an option, that does not necessarily mean that it can actually perform the edit. If you select it and nothing happens, it could not perform that action.

←→ Before Edit Commute the inputs of a sub-expression X + Y Y + X -X + Y Y - X X - Y -Y + X -X - Y -Y - X X * Y Y * X INV(X) * Y Y / X X / Y INV(Y) * X INV(X) / Y INV(Y) * INV(X) Associate to the left X + (Y + Z) (X + Y) + Z X + (Y - Z) (X + Y) - Z X - (Y + Z) (X - Y) - Z X - (Y - Z) (X - Y) + Z X * (Y * Z) (X * Y) * Z X * (Y / Z) (X * Y) / Z X / (Y * Z) (X / Y) / Z X / (Y / Z) (X / Y) * Z X ^ (Y * Z) (X ^ Y) ^ Z Associate to the right (X + Y) + Z X + (Y + X) (X - Y) + Z X - (Y - Z) (X + Y) - Z X + (Y - Z) (X - Y) - Z X - (Y + Z) (X * Y) * Z X * (Y * Z) (X / Y) * Z X / (Y / Z) (X * Y) / Z X * (Y / Z) (X / Y) / Z X / (Y * Z) (X ^ Y) ^ Z X ^ (Y * Z) Distribute prefix -(X + Y) -X - Y -(X - Y) -X + Y -(X * Y) -X * Y -(X / Y) -X / Y -LOG(X) LOG(INV(X)) -LN(X) LN(INV(X)) INV(X * Y) INV(X) / Y INV(X / Y) INV(X) * Y INV(X ^ Y) X ^ -Y INV(ALOG(X)) ALOG(-X) INV(EXP(X)) EXP(-X) Distribute to the left (X + Y) * Z X * Z + Y * Z (X - Y) * Z X * Z - Y * Z (X + Y) / Z X / Z + Y / Z (X - Y) / Z X / Z - Y / Z (X * Y) ^ Z X ^ Z * Y ^ Z (X / Y) ^ Z X ^ Z / Y ^ Z Distribute to the right X * (Y + Z) X * Y + X * Z X * (Y - Z) X * Y - X * Z X / (Y + Z) INV((INV(X) * Y) + INV(X) * Z)) X / (Y - Z) INV((INV(X) * Y) - INV(X) * Z)) X ^ (Y + Z) X ^ Y * X ^ Z X ^ (Y - Z) X ^ Y / X ^ Z LOG(X * Y) LOG(X) + LOG(Y) LOG(X / Y) LOG(X) - LOG(Y) ALOG(X + Y) ALOG(X) * ALOG(Y) ALOG(X - Y) ALOG(X) / ALOG(Y) LN(X * Y) LN(X) + LN(Y) LN(X / Y) LN(X) - LN(Y) EXP(X + Y) EXP(X) * EXP(Y) EXP(X - Y) EXP(X) / EXP(Y) Merge left factors (X * Y) + (X * Z) X * (Y + Z) (X * Y) - (X * Z) X * (Y - Z) (X ^ Y) * (X ^ Z) X ^ (Y + Z) (X ^ Y) / (X ^ Z) X ^ (Y - Z) LN(X) + LN(Y) LN(X * Y) LN(X) - LN(Y) LN(X / Y) LOG(X) + LOG(Y) LOG(X * Y) LOG(X) - LOG(Y) LOG(X / Y) EXP(X) * EXP(Y) EXP(X + Y) EXP(X) / EXP(Y) EXP(X - Y) ALOG(X) * ALOG(Y) ALOG(X + Y) ALOG(X) / ALOG(Y) ALOG(X - Y) Merge right factors (X * Z) + (Y * Z) (X + Y) * Z (X / Z) + (Y / Z) (X + Y) / Z (X * Z) - (Y * Z) (X - Y) * Z (X / Z) - (Y / Z) (X - Y) / Z (X ^ Z) * (Y ^ Z) (X * Y) ^ Z (X ^ Z) / (Y ^ Z) (X / Y) ^ Z Negate twice X -(-X) Double negate and distribute X + Y -(-X - Y) X - Y -(-X + Y) -X + Y -(X - Y) -X - Y -(X + Y) X * Y -(-X * Y) -X * Y -(X * Y) X / Y -(-X / Y) -X / Y -(X / Y) LOG(X) -(LOG(INV(X))) LOG(INV(X)) -(LOG(X)) LN(X) -(LN(INV(X))) LN(INV(X)) -(LN(X)) Invert twice X INV(INV(X)) Double invert and distribute X * Y INV(INV(X) / Y) X / Y INV(INV(X) * Y) X ^ Y INV(X ^ -Y) X ^ -Y INV(X ^ Y) ALOG(X) INV(ALOG(-X)) ALOG(-X) INV(ALOG(X)) EXP(X) INV(EXP(-X)) EXP(-X) INV(EXP(X)) Multiply by one X X * 1 Divide by one X X / 1 To the power of one X X ^ 1 Plus one minus 1 X X + 1 - 1 Replace log of a power with a product of logs LOG(X ^ Y) LOG(X) * Y LN(X ^ Y) LN(X) * Y Replace product of logs with a log of power LOG(X) * Y LOG(X ^ Y) LN(X) * Y LN(X ^ Y) Replace a power product with a power of power ALOG(X * Y) ALOG(X) ^ Y ALOG(X / Y) ALOG(X) ^ INV(Y) EXP(X * Y) EXP(X) ^ Y EXP(X / Y) EXP(X) ^ INV(Y) Replace power of power with power product ALOG(X) ^ Y ALOG(X * Y) ALOG(X) ^ INV(Y) ALOG(X / Y) EXP(X) ^ Y EXP(X * Y) EXP(X) ^ INV(Y) EXP(X / Y) Add fractions over a common denominator A + (B / C) (A * C + B) / C (A / B) + C (A + B * C) / B (A / B) + (C / D) (A * D + B * C) / (B * D) A - (B / C) (A * C - B) / C (A / B) - C (A - B * C) / B (A / B) - (C / D) (A * D - B * C) / (B * D)