As described in the preceding section, Mathcad accepts complex numbers of the form a + bi , where a and b are ordinary numbers. You can use j instead of i if you prefer that notation. Complex numbers can also arise if you enter an expression with a complex result. Even a Mathcad expression that involves only real numbers can have a complex value. For example, if you evaluate R,Mathcad will return i. Although you can enter imaginary numbers followed by either i orj, Mathcad normally displays them followed by i. To have Mathcad display imaginary numbers with j; choose Number from the Format menu, click on the “Global” option button, and set “Imaginary” to}. See Chapter 6, “Equation and Result Formatting,” for a full description of the numerical formatting options. When typing complex numbers, remember that you cannot use i or} alone to represent the imaginary unit. You must always type li or lj .If you don’t, Mathcad will interpret the i or} as a variable. When the cursor is outside an equation that shows Ii or I}, Mathcad hides the superfluous 1. Complex operators and functions Mathcad has the following functions and operators for working with complex numbers:
Figure 8-2: Complex numbers in Mathcad ” WM’n complex numbers are available, many functions and operators we think of as returning unique results become multi valued. The impact of this on logarithmic and exponential functions is discussed more fully in Chapter 13, “Built-in Functions.” As a general rule, when a function or operator is multivalued, Mathcad always returns the value making the smallest positive angle relative to the positive real axis in the complex plane. This is the principal value. For example, when asked to evaluate (-1)113, Mathcad will return .5 + .866i despite the fact that we commonly think of the cube root of -1 as being -1. This is because the number .5 + .866i makes an angle of only 60 degrees from the positive real axis. The number -1, on the other hand, is all the way on the other side, 180 degrees frem the positive real axis. The single exception to this rule is the nth root operator described in Chapter 12, “Operators.” This operator always returns a real root whenever one is available. Figure 8-3 compares these two alternatives.