The minus sign that means “opposite of” uses the same keystroke as the one that means “subtract.” To determine which one to insert, Mathcad looks at where the vertical editing line is. If it’s on the left, Mathcad inserts the “opposite of” minus sign. If it’s on the right, Mathcad inserts the “subtract” minus sign. To move the vertical editing line from one side to the other, use the [Insert] key.The following example shows how to insert a minus sign in front of the expression “sin(a).”If what you really want to do is turn sin (a) into 1 – sin (a) , insert another operator (say, “+”) as described in the section “Inserting an operator” on page 56. Th~n replace the operator with a minus sign as described in the section “Deleting an operator” on page 59. Notice that in Mathcad the unary minus sign in the expression -sin (a) appears smaller than the minus sign in expressions such as 1 – sin (a) .
Applying a function to an expression
To turn an expression into the argument of a function, follow these steps:
• Click in the expression and press I [Space] until the entire expression, Iw t – k zll w . t – (k . z) , is held between the editing lines.Type the single-quote key (the same as the double-quote key, but unshifted). The selected expression is enclosed by parentheses.
• Press [Space].The editing lines now hold the parentheses as well. II(wt – kz necessary, press the [Insert] key. The vertical editing line switches to the Iltwt-kzll left side. If the vertical editing line is already on the left side, skip this step. Now type the name of the function. If the function you wish to use is a built-in I~( w t – k z 1I function, you can choose Function from the Insert menu and double-click on the name of the function
Mathcad places parentheses automatically as needed to maintain the precedence of operations. There may be instances however, when you want to place parentheses to clarify an expression or to change the overall structure of the expression. You can either insert a matched pair of parentheses all at once or you can insert the parentheses one at a time. We recommend you insert a matched pair since this avoids the possibility of unmatched parentheses. To~nclose an expression with a matched pair of parentheses Select the expression by placing it be- I [8j tween the editing lines. You can do this by clicking on the expression and press ing [Space] one or more times.
• Type the single-quote key. The selected I I expression is now enclosed by parentheses.It is sometimes necessary to insert parentheses one at a time using the ( and ) keys. For example, to change a – b + c to a – (b + c) do the following:
• Move the editing lines just to the left ofthe b. Make sure the vertical editing line is on the left as shown. Press [Insert] if necessary to move it over.
• Type (. Now click to the right of the c. I Make sure the vertical editing line is to Ia – (b the right as shown. Press [Insert] if necessary to move it over.
You cannot delete one parenthesis at a time. Whenever you delete one parenthesis, Mathcad deletes the matched parenthesis as well. This prevents you from inadvertently creating an expression having unmatched parentheses.
To delete a matched pair of parentheses:
• Move the editing lines to the right of the Press the [BkSp] key. Note that you could also begin with the editing lines to the left of the “)”and pressing the [Delete] key instead.
Moving parts of an expression
The menu commands Cut, Copy, and Paste from the Edit menu are useful for editing complicated expressions. They function as follows:
• Cut deletes whatever is between the editing lines and copies it to the clipboard . • Copy takes whatever is between the editing lines and copies it to the clipboard. • Paste takes whatever is on the clipboard and places it into your worksheet, either into a placeholder or into the blank space between equations. The following example shows how to use Copy and Paste to eliminate retyping. Suppose you want to build the expression The argument to the sine function is nearly identical to that of the cosine function. You can take advantage of the similarity between the arguments of these two functions by doing the following:
• Build the first term, then leave a placeholder where the argument to the sine should go. Type sin () to do this.
• Click in the argument to the cosine function and press [Space] until the editing ICDS (~l + sin lines hold the argument between them. The expression looks like that shown on the right.
• Choose Copy from the Edit menu.Click on the placeholder inside the sine function. 1 Icos(~) + sin(.) I
• Choose Paste from the Edit menu. The expression now looks like that shown on I cos (w t + x ) + sin (w· t + xl) I the right