### 4.3.3 Manipulating subexpressions

If a subexpression is selected in the expression editor, then any menu command will be applied to that subexpression.

For example, suppose that you enter the expression

(x+1)*(x+2)*(x-1)

in the expression editor. Note that you can use the abilities of the editor to make this easier. First, enter x+1. Select this with the up arrow, then type * followed by x+2. Select the x+2 with the up arrow and then type * followed by x-1. Using the up arrow again will select the x-1. Select the entire expression with the up arrow, and then select eval from the M menu. This will put all factors at the same level. Suppose you want the factors (x+1)*(x+2) to be expanded. You could select (x+1)*(x+2) with the mouse and do one of the following:

- Select the Expression▸Misc▸normal menu item. You will then have normal((x+1)*(x+2))*(x-1) in the editor. If you hit enter, the result (x2 + 3x + 2)*(x−1) will appear in the output window.
- Again, select the Expression▸Misc▸normal menu item, so again you have normal((x+1)*(x+2))*(x-1) in the editor. Now if you select eval from the M menu, then the expression in the editor will become the result (x2 + 3x + 2)*(x−1), which you can continue editing.
- Choose normal from the M menu. This will apply normal to the selection, and again you will have the result (x2 + 3x + 2)*(x−1) in the editor.

There are also keystroke commands that you can use to operate on subexpressions that you’ve selected. There are the usual Ctrl+Z and Ctrl+Y for undoing and redoing. Some of the others are given in the following table.

Key | Action on selection
Ctrl+D | differentiate
Ctrl+F | factor
Ctrl+L | limit
Ctrl+N | normalize
Ctrl+P | partial fraction
Ctrl+R | integrate
Ctrl+S | simplify
Ctrl+T | copy LATEX version to clipboard