Live Symbolic Evaluation MathCad Help

The symbolic equal sign provides a way to extend Mathcad’s live document interface beyond the numerical evaluation of expressions. You can think of it as being analogous to the equal sign “=”. Unlike the equal sign, which always gives a number on the right hand side, the symbolic equal sign is capable of giving expressions. You can use it to symbolically evaluate expressions, variables, functions, or programs.

To use the symbolic equal sign:

• Make sure the Automatic Calculation command on the Math menu has a checkmark beside it. If it doesn’t, choose it from the menu.
• Make sure the Automatic Calculation command on the Math menu has a checkmark beside it.

• Enter the expression you want to evaluate

IMG

• Press [Ctrl]. (the control key followed by a period). Mathcad isplays an arrow, “~”.

IMG

• Click outside the expression. Mathcad displays a simplified version of the original expression. If an expression cannot be  simplified further, Mathcad simply repeats it to the right of the arrow

IMG

The symbolic equal sign is a live operator just like any Mathcad operator. When you make a change anywhere above or to the left of it, Mathcad updates the result. The symbolic equal sign “knows” about previously defined functions and variables and uses them wherever appropriate. You can force the symbolic equal sign to ignore prior definitions of functions and variables by defining them recursively just before you evaluate them as shown in Figure 17-5.

Figure 17-2 shows some examples of how to use the “~”. Note that the “~” only applies to an entire expression. You cannot, for example, use the “~” to transform only part of an expression

IMG

Figure 17-2 also illustrates the fact that the symbolic processor treats numbers containing a decimal point differently from numbers without a decimal point. The general rule is as follows:

• When you send numbers with decimal points to the symbolic processor, any numerical results you get back will be decimal approximations to the exact answer.
• When you send numbers without decimal points to the symbolic processor, any numerical results you get back will be expressed without decimal points whenever possible.

In Figure 17-2, note how √17 comes back unchanged since there is no rational square root of 17. But √17.0 comes back as a decimal approximation to the irrational number √17.

When a symbolic operation gives an approximate decimal answer, this answer is always displayed with 20 significant digits. Although this display is not affected by Mathcad’s local or global numerical formats, you can use the float keyword described in the next section to control the number of significant digits displayed.

Customizing the symbolic equal sign using keywords

The “→” takes the left-hand side and places a simplified version of it on the right-hand side. By default, it simplifies the left-hand side just as if you had chosen Evaluate⇒ Symbolically from the Symbolics menu (see “Using the Symbolics menu”).

Of course, exactly what “simplify” means is a matter of opinion. As a result, you can, to a limited extent, control how the”→” transforms the expression by using one of the following keywords. To do so:

• Enter the expression you want to evaluate.

iMG

• 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, “→”.

img

• Click on the placeholder to the left of the arrow and type any of the keywords from the following table. If the keyword requires any additional arguments, separate the arguments from the keyword with commas.

img

• Press [Enter] to see the result.

img

Another way to use a keyword is to enter the expression you want to evaluate and click on a keyword button from the Symbolic Keywords palette. This will insert the keyword,placeholders for any additional arguments, and the arrow,→ “-t”. You just need to press
[Enter] to see the result.

img

Note that many ofthe keywords take at least one additional argument, typically the name of a variable with respect to which you are performing the symbolic operation.Some of the arguments listed with the keywords are optional.For more information on each of these keywords, see the sections entitled “Symbolic algebra”  “Symbolic calculus”  and “Symbolic transforms
Figure 17-3 shows some sample uses of keywords. Note that keywords are case sensitive and must therefore be typed exactly as shown. They are not, however, font sensitive.

img

In some cases, you may want to perform two or more types of symbolic evaluation consecutively on an expression. Math cad allows you to apply several symbolic keywords to a single expression. There are two ways of applying multiple keywords. The
method you choose depends on whether you want to see the results from each keyword or only the final result.

• Enter the expression you want to evaluate.

img

• 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, “→”.

img

• Enter the first keyword into the place holder to the left of the arrow, including any comma-delimited arguments the keyword takes.

img

• Press [Enter] to see the result from the first keyword.

img

• Click on the result and press [Ctrl] [Shift 1 . again. The first result disappears temporarily. Enter a second keyword into the placeholder.

img

• Press [Enter] to see the result from the second keyword.

img

Continue applying keywords to the intermediate results in this manner.To apply several keywords and see only the final result:

img

Enter the expression you want to evaluate.

img

• Press [Ctrl] [Shift] . so that Mathcad displays a placeholder to the left of the arrow, “→”.

img

Enter the first keyword into the Place hold-er, including any comma-delimited argu-ments it takes.

img

• Instead of pressing [Enter] to see the result, press [Ctrl] [Shift] . again and enter a second keyword into the placeholder.The second keyword is placed immediately below the first keyword.

img

Continue adding keywords by pressing[Ctrl] [Shift 1 . after each one. Press[Enter] to see the final result.

img

These two methods of applying multiple keywords to an expression are demonstrated in Figure 17-4.

img

Ignoring previous definitions

When you use the symbolic equal sign to evaluate an expression, Mathcad checks all the variables and functions making up that expression to see if they’ve been defined
earlier in the worksheet. If Mathcad does find a definition, it uses it. Any other variables and functions are evaluated symbolically.
There are two exceptions to this. In evaluating an expression made up of previously defined variables and functions, Mathcad ignores prior definitions:

• when the variable has been defined recursively, or
• when the variable has been defined as a range variable.

These are illustrated in Figure 17-5.

img

Posted on November 20, 2015 in Symbolic Calculation

Share the Story

Back to Top
Share This