Definitions and variables Mathcad’s power and versatility quickly become apparent once you begin to use variables and functions. By defining variables and functions, you can link equations together and use intermediate results in further calculations. The following examples show how to define and use several variables.
To clear the previous equation and define a variable t, follow these steps:
• Click in the equation you just typed and
press [Space] until the entire expression
is held between the two editing lines. Then
choose Cut from the Edit menu.
• Now begin defining t. Type t:
(the letter t, followed by a colon). Mathcad
shows the colon as the definition symbol = .” .”
• Type 1 0 in the empty placeholder to com-I
plete the definition for t. If you make a mistake, click on the equation and press [Space] until the entire expression is between the two editing lines, just as you did earlier. Then delete it by choosing Cut from the Edit menu. These steps show the form for typing any definition:
• Type the variable name to be defined.
• Type the colon key to insert the definition symbol.
• Type the value to be assigned to the variable. The value can be a single number, as in the example shown here, or a more complicated combination of numbers and previously defined variables. Mathcad worksheets read from top to bottom and left to right. Once you have defined a variable like t, you can compute with it anywhere below and to the right of the equation that defines it. Now enter another definition.
• Press [.J]. This moves the crosshair below the first equation.• To define ace as -9.8, type: acc: -9.8. Then press [.J] again. Figure 1-2 shows the two definitions you just entered.
Now that the variables ace and t are defined, you can use them in other expressions.
• Click the mouse a few lines below the two definitions (see Figure 1-2).
• Type acc/2[Space]*t”2. The caret symbol (“) represents raising to a power, the asterisk (*) is multiplication, and the slash (I) represents division.
• Press the equal sign (=). This equation calculates the distance traveled by a falling body in time t with acceleration ace. When you enter the equation, Mathcad returns the result as shown id Figure 1-3. The window now contains two definitions, which define variables, and one evaluation, which computes a result.Mathcad updates results as soon as you make changes. For example, If you click on
the lOon your screen and change it to some other number, Mathcad changes the result ;s soon as you press [..1] or click outside of the equation.