The summation operator sums an expression over all values of an index. The iterated product operator works much the same way. It takes the product of an expression over all values of an index
To create a summation operator in your worksheet:
• Click in a blank space. Then type [Ctrl][Shift]4. A summation sign
with four placeholders appears
In the placeholder to the left of the equal sign, type a variable name. This variable is the index of summation. It is defined only within the summation operator and L- _ therefore has no effect on, and is not influenced by, variable definitions outside the summation operator.
• In the placeholder to the right of the equal sign, type an integer or any expression that evaluates to an integer
• In the remaining placeholder, type the pression you want to sum. Usually, this expression will involve the index of a pair of parentheses around the placeholder.
Iterated products are similar. Just type [Ctrl][Shift]3 and fill in the placeholders as described earlier
Figure 12-1 shows some examples of how to use the summation and product operators. You can use a summation or an iterated product just as you would any other expression.
To evaluate multiple summations, place another summation in the final placeholder of the first summation. An example of this appears at the bottom of Figure 12-1
When you use the summation operator shown in Figure 12-1, the summation must be carried out over integers and in steps of one. Mathcad provides more general versions of these operators that can use any range variable you define as an index of summation. To use these operators, first define a range variable. In the following example type i :1, 2; 10.Then do the following:
If you don’t want to take the time to click in each placeholder, you can enter the previous expression by typing
A generalized version of the iterated product also exists. To use it, type #. Then fill in the two placeholders
Figure 12-2 shows some examples of how to apply the range sum and range product operators. These operators, unlike the summation and product operators created with [Ctrl][Shift]4 and [Ctrl][Shift]3, cannot stand alone. They require the existence of a range variable. Note however, that a single range variable can be used with any number of these operators.
You can use summations and iterated products just as you would any other expression. To evaluate multiple summations, use two range variables as shown in Figure 12-2.
Variable upper limit of summation
Mathcad’s range summation operator runs through each value of the range variable you place in the bottom placeholder. It is possible, by judicious use of boolean expressions, to sum only up to a particular value. In Figure 12-3, the term i ~ x returns the value 1 whenever it is true and 0 whenever it is false. Although the summation operator still sums over each value of the index of summation, those terms for which i > x are multiplied by 0 and hence do not contribute to the summation.
You can also use the four-placeholder summation and product operators to compute sums and products with a variable upper limit, but note that the upper limit in these operators must be an integer
The vector-sum operator
Tbe operation of summing the elements of a vector is so common that Mathcad provides a special operator for it. While the ordinary summation operator sums a ranged expression, the vector sum operator sums the elements of a vector without needing a range variable
To sum all the elements of a vector v defined elsewhere in your worksheet, follow these steps:
• Click in blank space or on a placeholder. Then press [Ctrl]4.
You can use Mathcad’s derivative operator to evaluate the derivative of a function at a particular point
With Mathcad’s derivative algorithm, you can expect the first derivative to be accurate to within 7 or 8 significant digits, provided that the value at which you evaluate the derivative is not too close to a singularity of the function. The accuracy of this algorithm tends to decrease by one significant digit for each increase in the order of the derivative (see the section “Derivatives of higher order” on page 245)
Keep in mind that the result of differentiating is not a function, but a single number: the computed derivative at the indicated value of the differentiation variable. In the previous example, the derivative of x3 is not the expression 3×2 but 3×2 evaluated at x = 2. If you want to evaluate derivatives symbolically, see Chapter 17, “Symbolic Calculation. “
Although differentiation returns just one number, you can still define one function as the derivative of another. For example
Evaluatingfix) will retum the numerically computed derivative of g(x) at .x .
You can use this technique to evaluate the derivative of a function at many points. An example of this is shown in Figure 12-5.
There are some important things to remember about differentiation in Mathcad:
• The expression to be differentiated can be either real or complex.
• The differentiation variable must be a single variable name. If you want to evaluate the derivative at several different values stored in a vector, use the technique illustrated in Figure 12-6
Derivatives of higher order
Mathcad has an additional derivative operator for evaluating the nth order derivative of a function at a particular point.
As an example, here’s how you would evaluate the third derivative of x9 with respect to x at the point x = 2:
• First define the point at which you want to evaluate the derivative. Type x:
• Click on the expression above and to the right of the previous placeholder and type 3. Thi must be an integer between 0 and 5 inclusive. Note that the placeholder in the numerator automatically mirrors whatever you’ve typed
For n = 1, this operator gives the same answer as the first-derivative operator discussed above. For n = 0, it simply returns the value of the function itself.