Mathcad allows you to manipulate an expression algebraically using either keywords and the symbolic equal sign, or menu commands from the Symbolic menu. Most of the examples in this section demonstrate “live” symbolic operations using symbolic keywords, but you may apply commands from the Symbolic menu to expressions on a case by case basis if you prefer. Keep in mind that, unlike the keyword-modified

expressions, expressions modified by commands from the Symbolic menu do not update automatically, as described in the section “Using the Symbolic menu”

Complex evaluation

When evaluating expressions containing complex numbers, you may want to use the keyword complex:

• Enter the expression you want to evaluate.
• Press [Ctrl] [Shift 1 • (hold down the control and shift keys and type a period).
Mathcad displays a placeholder to the left of the arrow, “~”.
• Type complex into the placeholder.
• Press [Enter] to see the result.

Mathcad will assume all the terms in the expression are written in the form a + b . i .The results will also be in this form. Figure 17-7 shows an example.Another way to evaluate an expression in the complex domain is to enclose the expression between the editing lines and choose Evaluate⇒Complex from the Symbolic menu.

Floating point evaluation
Ordinarily, the symbolic processor returns results by rearranging variables. Thus, when Mathcad evaluates an expression involving 1t or e, it will usually return another expression involving 1t or exp(x). To force Mathcad to return a number instead, use the keyword float:

• Enter the expression you want to evaluate.
• Press [Ctrl] [Shift 1 . (hold down the control and shift keys and type a period).
Mathcad displays a placeholder to the left of the arrow, “→”.
• Type float into the placeholder.
• Press [Enter] to see the result.

Mathcad by default returns a result with up to 20 digits to the right of the decimal point.
To specify a different number of digits for the result, follow the keyword float with a
comma and an integer between 0 and 250. Figure 17-7 shows an example.
Another way to perform floating point evaluation on an expression is to enclose the expression between the editing lines and choose Evaluate ⇒floating Point from the Symbolic menu. This brings up a dialog box in which you can specify the number of digits to the right of the decimal point.

Constrained evaluation

When evaluating some expressions, you may want to force Mathcad to make certain assumptions about the variables involved. For example, you might want Mathcad to assume x is real when evaluating the square root of x. To impose constraints on the
variables in an expression, use the keyword assume:

• Enter the expression you want to evaluate.
• Press [Ctrl] [Shift 1 • (hold down the control and shift keys and type a period).
Mathcad displays a placeholder to the left of the arrow, “-/’.
• In the placeholder, type assume followed by a comma and a constraining equation
such as x<10.
• Press [Enter] to see the result.

You can also use the assume keyword to tell Mathcad to consider a variable to be real
or falling in a certain range of real values. To do so, you can use the following
“modifiers” : To use a modifier, separate it from the assume keyword with a comma. For example,to use “x=real” as a modifier with the assume keyword on an expression:

• Enter the expression to simplify.
• Press [Ctrl] [Shift 1 • (hold down the control and shift keys and type a period).
Mathcad displays a placeholder to the left of the arrow, “~”.
• Enter assume, x=real into the placeholder (press [Ctrl]= for the equal sign).
• Press [Enter] to see the result.

The last example in Figure 17-7 illustrates how an integral can be made to converge by assuming a variable is positive and greater than 1. Note that in order to specify more than one condition, you simply separate the conditions with a comma.

Simplifying an expression
To force Mathcad to carry out basic algebraic and trigonometric simplification of a selected expression, use the keyword simplify:
• Enter the expression you want to evaluate.• Press [Ctrl] [Shift) . (hold down the control and shift keys and type a period).Mathcad displays a placeholder to the left of the arrow, “→”.• Type simplify into the placeholder.• Press [Enter] to see the result.

When the symbolic processor simplifies an expression, it performs arithmetic, cancels common factors, uses basic trigonometric and inverse function identities, and simplifies square roots and powers.

To control the simplification performed by the simplify keyword, you can use the following “modifiers”:  To use a modifier, separate it from the simplify keyword with a comma. For example,to use the “trig” modifier with the simplify keyword on an expression:

• Enter the expression to simplify.
• Press [Ctrl] [Shift 1 • (hold down the control and shift keys and type a period).
Mathcad displays a placeholder to the left of the arrow, “~”.
• Enter simplify, trig into the placeholder.
• Press [Enter] to see the result.

Figure 17-8 shows some examples using the simplify keyword with and without additional modifiers.

Note that you can also simplify an expression by placing it between the two editing lines and choosing Simplify from the Symbolic menu. This method is useful when you want to simplify parts of an expression. Mathcad may sometimes be able to simplify parts of an expression even when it cannot simplify the entire expression. If simplifying the entire expression doesn’t give the answer you want, try selecting sub expressions and choosing Simplify from the Symbolic menu. If Mathcad can’t simplify an expression any further, you’ll just get the original expression back as the answer.

In general, when you simplify an expression, the simplified result will have the same numerical behavior as the original expression. However, when the expression includes functions with more than one branch, such as square root or the inverse trigonometric
functions, the symbolic answer may differ from a numerical answer. For example,simplifying a in (sin (θ)) yields θ but this equation holds true numerically in Mathcad only when θ is a number between π2 and π2.

Expanding an expression

To expand all powers and products of sums in an expression, use the keyword expand:

• Enter the expression you want to expand.
• Press [Ctrl] [Shift 1 • (hold down the control and shift keys and type a period).
Mathcad displays a placeholder to the left of the arrow, “→”.
• Type expand into the placeholder.
• Press [Enter] to see the result

Mathcad expands all powers and products of sums in the selected expression. If the expression is a fraction, the numerator will be expanded and the expression will be written as a sum of fractions. Sines, cosines and tangents of sums of variables, or integer
multiples of variables will be expanded as far as possible into expressions involving only sines and cosines of single variables. If you don’t want certain sub expressions to be expanded, follow the expand keyword with a comma and the expressions. See
Figure 17-10 for some examples.

Another way to expand an expression is to enclose the expression between the editing lines and choose Expand from the Symbolics menu.

Expanding an expression to a series

To expand an expression to a series, use the keyword series:
• Enter the expression you want to expand. • Press [Ctrl] [Shift 1 • (hold down the control and shift keys and type a period).
Mathcad displays a placeholder to the left of the arrow, “→”.
• In the placeholder, type series followed by a comma and the variable or expression for which you want to find a series expansion. • Press [Enter] to see the result.

Mathcad will then generate a series of order 6. To specify a different order of expansion, follow the variable of expansion with a comma and an appropriate integer. The order is the order of the error term in the ex pension. For example, if Mathcad expands sin(x)
to a series in x, it returns an expansion of the sine function in powers of x in which the highest power is x5 . The error is thus O(x6).

Mathcad will find Taylor series (series in non negative powers of the variable) for functions that are analytic at 0, and Laurent series for functions that have a pole of finite order at 0. To develop a series with a center other than 0, the argument to the series
keyword should be of the form var=z, where z is any real or complex number. For example, series I x=l expands around the point x=l. Press [Ctrl] =for the equal sign.

To expand a series around more than one variable, follow the series keyword with a comma and the variables, separated from each other by commas. The last example in Figure 17-9 shows an expression expanded around x and y.

Figure 17-9 shows some examples of expanded expressions.

Another way to generate a series expansion is to enter the expression and click on a variable for which you want to find a series expansion. Then choose Variable-e-Expand to Series from the Symbolic menu. A dialog box will prompt you for the order
of the series. This command is limited to a series in a single variable; any other variables in the expression will be treated as constants. The results also contain the error term using the 0 notation. Before you use the series for further calculations you will need to delete this error term.

In using the approximations you get from the symbolic processor, keep in mind that the Taylor series for a function may converge only in some small interval around the center. Furthermore, functions like sin or exp have series with infinitely many terms,while the polynomials returned by Mathcad have only a few terms (how many depends on the order you select). Thus, when you approximate a function by the polynomial returned by Mathcad, the approximation will be reasonably accurate close to the center, but may be quite inaccurate for values far from the center.

Factoring an expression

To factor an expression, use the keyword factor:

• Enter the expression you want to factor.
• Press [Ctrl] [Shift 1(hold down the control and shift keys and type a period) Mathcad displays a placeholder to the left of the arrow, “→”.
• In the placeholder, type factor.
• Press [Enter] to see the result.

If this expression is a single integer, Mathcad will factor it into powers of primes.Otherwise, Mathcad will attempt to convert the expression into a product of simpler functions. The symbolic processor will combine a sum of fractions into a single fraction
and will often simplify a complex fraction with more than one fraction bar. If you want to factor an expression over certain radicals, follow the factor keyword with a comma and the radicals.
When you’re simplifying by factoring, you may be able to simplify your expression quite a bit by factoring sub expressions even if the expression taken as a whole can’t be factored. To do so, enclose a sub expression between the editing lines and choose Factor
from the Symbolic menu. You can also use this menu command to factor an entire expression, but keep in mind that the Symbolic menu commands do not use any previous definitions in your worksheet and do not automatically update. See the examples in Figure 17-10 for examples of factoring expressions.

Collecting like terms

To simplify an expression by collecting terms containing like powers of a variable:

• Enter the expression.
• Press [Ctrl] [Shift ]
• (hold down the control and shift keys and type a period).Mathcad displays a placeholder and the arrow, “→”.
• In the placeholder, type collect followed by a comma and the variable or sub expression on which to collect.
• Press [Enter] to see the result.

The result is a polynomial in the variable or sub expression. The sub expression you select must be a single variable or a built-in function together with its argument. To collect on more than one variable, follow the collect keyword with a comma and the variables on which to collect, separated from each other by commas. See Figure 17 -1 0 for examples of simplifying expressions by collecting like terms. An alternative method for collecting terms of an expression is to click on a variable in an expression and choose Collect from the Symbolic menu.

Partial fraction decomposition
To convert an expression to its partial fraction decomposition, use the keyword convert:

• Enter the expression.Press [Ctrl] [Shift 1 • (hold down the control and shift keys and type a period).Mathcad displays a placeholder to the left of the arrow, “→”.
• In the placeholder, type convert, paranoiac followed by a comma and the variable in the denominator of the expression on which to convert.
• Press [Enter] to see the result.

The symbolic processor will try to factor the denominator of the expression into linear or quadratic factors having integer coefficients. If it succeeds, it will expand the expression into a sum of fractions with these factors as denominators. All constants in
the selected expression must be integers or fractions; Mathcad will not expand an expression that contains decimal points. See Figure 17-11 for some examples. Another way to convert an expression to a partial fraction is enter the expression and click on a variable in the denominator. Then choose Variable⇒Convert to Partial

Finding coefficients of a polynomial

Many expressions can be rewritten as polynomials, either in a particular variable or with respect to a sub expression. To force the symbolic processor rewrite an expression as a polynomial and return the coefficients:

• Enter the expression you want to rewrite.
• Press [Ctrl] [Shift 1 • (hold down the control and shift keys and type a period).
Mathcad displays a placeholder to the left of the arrow, “→”.

• In the placeholder, type coeffs followed by a comma and the variable or function in which you want your expression to be regarded as a polynomial.

• Press [Enter] to see the result. Mathcad returns a vector containing the coefficients of the equivalent polynomial. The
first element of the vector is the constant term and the last element is the coefficient of the highest order term in the expression. Figure 17-11 shows two examples.

Another way to rewrite an expression as a polynomial is to enclose it between the two editing lines and choose Polynomial Coefficients from the Symbolic menu.

Substituting an expression for a variable

To replace a variable in an expression with another variable or sub expression, use the keyword substitute:

• Enter the expression.
• Press [Ctrl] [Shift 1 • (hold down the control and shift keys and type a period).
Mathcad displays a placeholder to the left of the arrow, “→”.
• In the placeholder, type substi tute followed by a comma and an expression of the form var l=var 2 where var l is a variable and var 2 is a variable or expression. Press [Ctrl] = for the equal sign.
• Press [Enter] to see the result.

Mathcad will replace var 1 with var 2. If var 1 occurs more than once in the expression you are transforming, Mathcad replaces each occurrence. Figure 17-12 shows some examples.

Note that Mathcad will not substitute a variable for an entire vector or a matrix. You can, however, substitute a scalar expression for a variable that occurs in a matrix. To do so, select the expression that will replace the variable and choose Copy from the Edit menu. Click on an occurrence of the variable you want to replace and choose
Variable⇒Substitute from the Symbolic menu. You can also use this menu command
to perform a substitution in any expression.

Evaluating a summation

To evaluate a sum symbolically, you can use Mathcad’s summation operator and the live symbolic equal sign:

• Create the summation operator by typing [Ctrl][Shift]4.
• Enter the expression you want to sum in the placeholder to the right of the “∑.
• Enter the index variable and summation range in the placeholders above and below
the ‘∑’ as shown in Figure 17-13.
• Press [Ctrl]. (the control key followed by a period). Mathcad displays an arrow,
“→”.
• Press [Enter] to see the result.

The procedure is the same for a product over a range, except that you type [Ctrl][Shift]3 to get the product operator.If you use umerical limits in a summation or product range, be sure that the upper limit of the range is greater than or equal to the lower limit.

Another way to evaluate a summation is to enclose the summation expression between the editing lines and choose Evaluate⇒Symbolically from the Symbolic menu. Figure 17-13 illustrates various results of symbolic evaluation.

Posted on November 20, 2015 in Symbolic Calculation