Units of measurement, while not required in Mathcad equations, can help detect errors and enhance the display of computed results. Mathcad’s unit capabilities take care of many of the usual chores associated with using units and dimensions in scientific calculation. Once you enter the appropriate definitions Mathcad automatically performs unit conversions and flags incorrect and inconsistent dimensional calculations.
This chapter describes how to use units and dimensions in Mathcad, including unit conversions and dimensional checking.
The following sections make up this
Computing with units
How to use units in an equation and how Mathcad catches any dimensional .mconsis tencies
How Mathcad displays units and how to convert from one unit to another.
Choosing a system of units; defining your own units in terms of fundamental dimensions.
Changing dimension names
How to change the names of Mathcad’s fundamental dimensions
Computing with units
When you first start Mathcad, a complete set of units is available for your calculations. You can treat these units just like built-in variables. To assign units to a number, just multiply it by the name of the unit. For example, type expressions like the following:
If you define a variable which consists of a number followed immediately by a unit name, you can omit the multiplication symbol and Mathcad will treat the multiplication as implied, as you can see in the bottom-most example in Figure 9-1.
Mathcad recognizes most units by their common abbreviations. A list of all of Mathcad’s built-in units is in Appendix B, “Unit Tables.” By default Mathcad uses units from the S1unit system (also known as the International System of Units) in your worksheets. See the section “Built-in units” on page 175 for more information about selecting a unit system.
You can also use the Insert Unit dialog box to insert one of Mathcad’s built-in units into any placeholder. The Insert Unit dialog box offers the following advantages:
• You won’t have to remember the abbreviation Mathcad uses for a unit.
• You’ll see at a glance all available units appropriate to the result you’ve clicked on.
• You can’t make any typing mistakes. To use the Insert Unit dialog box:
• Click in the empty placeholder and choose Unit from the Insert menu. Mathcad opens a dialog box with two scrolling lists
• The list at the bottom shows built-in units, along with their Mathcad names, corresponding to whatever physical quantity is selected in the top scrolling list. For convenience, when “Dimensionless” is selected at the top, a list of all available built-in units shows on the bottom .
• If necessary, use the top scrolling list to display only those units corresponding to a particular physical quantity. This makes it easier to find a particular unit or to see what choices are appropriate.
• In the bottom list, double-click on the unit you want to insert, or click on the unit you want and then click the “Insert” button. Mathcad inserts that unit into the empty placeholder
For some engineering units-such as hp, cal, BTU, and Hz-Mathcad adopts one common definition for the unit name but allows you to use insert one of several alternative unit names, corresponding to alternative definitions of that unit, in your results. The alternative names are presented, where available, along with the standard unit name in the unit list atthe bottom of the Insert Unit dialog box. Mathcad’ s preferred unit name is denoted in square brackets, and the alternative names are given in parentheses. In the case of horsepower, for example, Mathcad uses the U.K. definition
of the unit for the name hp but gives you several variants, such as water horsepower, metric horsepower, boiler horsepower, and electric horsepower.
Note that Mathcad performs some dimensional analysis by trying to match the dimensions of your selected result with one of the common physical quantities in the top scrolling list. If it finds a match, you’ll see all the built-in units corresponding to the highlighted physical quantity in the bottom scrolling list. If nothing matches, Matlrcad simply lists all available built-in units on the bottom
Whenever you enter an expression involving units, Mathcad checks it for dimensional consistency. If you add or subtract values with incompatible units, or violate other principles of dimensional analysis, Mathcad displays an appropriate error message.
For example, suppose you had defined ace as 100· m/ s instead of I ()(). m/ s2 as shown in Figure 9-2. Since ace is in units of velocity and accg is in units of acceleration, it is inappropriate to add them together. When you attempt to do so, Mathcad displays an error message.
Unit errors are usually caused by one of the following:
• An incorrect unit conversion.
• A variable with the wrong units, as shown in Figure 9-2.
• Units in exponents or subscripts (for example v3 . acre or 23. It).
• Units as arguments to inappropriate functions (for example, sin(O· henry)).
Defining your own units
Although Mathcad recognizes many common units, you may need to define your own unit if:
• that unit isn’t in the list of built-in units in Appendix B, “Unit Tables.”
• you prefer to use your own abbreviation instead of that shown in Appendix B, ”’Unit Tables.”
You define your own units in terms of existing units in exactly the same way you would define a variable in terms of an existing variable. Figure 9-3 shows how to define new units as well as how to redefine existing units.
Since units behave just like variables, you may run into unexpected conflicts. For example, if you define the variable m in your worksheet, you won’t be able to use the built-in unit m for meters anywhere below that definition. However, Mathcad will automatically display the unit m in any results involving meters