# Editing an existing expression MathCad Help

This section describes how to make changes to an existing expression. The simplest changes you can make are discussed in “Changing a name or number” on page 55. Here, the underlying tree structure of a math expression doesn’t matter. As a result, the equation editor behaves very much like a text editor. Most difficulties in editing equations arise from working with operators. That’s because it’s only when you start working with operators that the underlying tree structure of a math expression shows up. The next few sections describe the three things you can do with an operator: inserting an operator, deleting an operator, or replacing one operator with another. The equation editor normally works from left to right. If you want to insert an operator before an existing expression, or if you want to apply a function to an existing expression, see “Inserting an operator” on page 56 and “Applying a function to an expression” on page 60. Although Mathcad inserts parentheses wherever required to prevent ambiguity, you may at times want to add parentheses to clarify an expression or delete extraneous parentheses. To do so, use the techniques described in the sections “Inserting parentheses” on page 61 and “Deleting parentheses” on page 62. Whet1 working with a complicated expression, it is often easier to work with more manageable subexpressions within it. The sections “Moving parts of an expression” on page 62 and “Deleting parts of an expression” on page 63 describe how to use Cut, Copy, and Paste to do so. Changing a name or number To edit a name or number:
• Click on it with the mouse. This places the editing lines wherever you clicked the mouse.
• Move the editing lines if necessary by pressing the [~] and [~] keys. Alternatively, place the mouse pointer wherever you want the editing lines to go, and click the mouse.
• If you type a character, it will appear just to the left of the editing lines. Pressing [Kbps] removes the character to the left of the editing lines. Pressing [Delete] removes the character to the right of the editing lines. If you need to change several occurrences of the same name or number, you may find it useful to choose Replace from the Edit menu. To search for a sequence of characters, choose Find from the Edit menu. These commands are discussed further in Chapter 5,
“Text.

Inserting an operator

The easiest place to insert an operator is between two characters in a name or two numbers in a constant. For example, here is how to insert a plus sign between two characters:
• Place the editing lines where you want
the plus sign to be.
• Press the + key.
Note that Mathcad automatically inserts a space on either side of the plus sign. You should never need to insert a space when typing an equation. Mathcad inserts spaces automatically wherever doing so is appropriate. In fact, if you do try to insert a space,Mathcad assumes you meantto type text rather than math and converts your math region into a text region accordingly.Operators such as division and exponentiation result in more dramatic formatting changes. For example, when you insert a divide sign, Mathcad moves everything that comes after the divide sign into the denominator. Here’s how you insert a divide sign.
• Place the editing lines where you want the divide sign to be..A. Press the / key. Mathcad reformats the I expression to accommodate the division.Some operators require only one operand. Examples are the square root, absolute value,and complex conjugate operators. To insert one of these, place the editing lines on either side of the operand and press the appropriate keystroke. Many of these operators area available on the arithmetic palette as well. For example, to turn x into JX do the following:
• Place the editing lines around the “x,” either preceding or following the character

Applying an operator to an expression

The methods described in the previous section work most predictably when you want to apply an operator to a variable or a number. If, however, you want to apply an operator to an entire expression there are two ways to proceed:

• You can surround that expression in parentheses and proceed as described in the previous section, or
• You can use the editing lines to specify the expression you want to apply the operator to. A l though the first method may be more intuitive, it is definitely slower since you will need to type pairs of parentheses. The more efficient second method is the subject of
this section. The sections “Inserting parentheses” on page 61 and “Deleting parentheses”on page 62 describe ways to work with parentheses more efficiently.The editing lines consist of a horizontal line and a vertical line that moves left to right along the horizontal line. To make an operator apply to an expression, select the expression by placing it between the two editing lines. The following examples show how typing *c results in completely different expressions depending on what was selected.