Mathcad: Floating Point Calculations in Symbolics

You may think of using symbolics for problems involving undefined variables (Ref Fig. 1):

While this is a very useful feature, it is also important to note that symbolics can be used to solve problems, which can be calculated numerically.

Whenever something is calculated numerically in Mathcad, the result is stored to 17 digits of precision (Ref Fig. 2).

Click on a result and choose Format > Result to see more decimal places.

The symbolic processor manipulates expressions algebraically to produce exact answers (Ref Fig. 3).

However, if you enter a decimal value in your expression, Mathcad automatically returns a floating-point result. This is true for both menu symbolics and live symbolics.

Menu-driven Symbolics

Both expressions below are evaluated using the Evaluate > Symbolically option on the Symbolics menu (Ref Fig. 4).

Live symbolics

Both menu-driven and live symbolics also offer options for returning a result in terms of a floating point number, even when you enter your calculations using exact values (Ref Fig. 5).

The Floating Point Menu Option

To evaluate an expression with floating point precision using menu-driven symbolics, select your expression (Ref Fig. 6):

Choose Evaluate > Floating Point... from the Symbolics menu (Ref Fig. 7).

A dialog appears asking how many decimals of precision to use (Ref Fig. 8).

Mathcad displays a result using the specified precision (Ref Fig. 9).

floating point evaluation yields (Ref Fig. 10).

Note that the placement of the result with respect to the original expression, as well as the appearance of comments, is determined by the settings on the Evaluation Style dialog found on the Symbolics menu.

The menu-driven option allows you to return up to 4000 decimals of precision. However, Mathcad is not able to display such large results and returns an error message.

The float Keyword

Live Symbolic results are controlled using keywords. The float keyword is the live symbolic equivalent of the Floating Point menu option.

Solve the equation for x using the live symbolic keyword solve, and Mathcad returns three exact roots (Ref Fig. 11).

The display of such results can be unwieldy. If all you need is a floating point approximation, the float keyword can be used to specify the desired precision of the result. Press [Ctrl][Shift][.] to add multiple keywords (Ref Fig. 12).

The default precision for float is 20. An optional integer argument ranging from 1 to 250 can be used to control the result (Ref Fig. 13, 14 and 15).

An important note: float cannot be used to extend precision on floating point calculations using live symbolics.

When you request a live symbolic evaluation (regardless of the modifiers), Mathcad first symbolicly evaluates the expression before applying any keyword modifiers. The evaluation is automatically converted to floating point with the default precision (20) if there are any decimal points in the expression (Ref Fig. 16).

If the expression contains a floating-point number, which is used as the argument to a function, this forces a floating-point evaluation with the default precision. Since the result has already been calculated using only 20 digits of precision, more than 20 digits of precision cannot be returned regardless of the number specified by the keyword (Ref Fig. 17).

Learn more with other tutorials...

Creating Better Homework Papers with Mathcad
Using Multiple Representations to Explore Mathematics with Mathcad 15.0
A Brief Lesson in Numerical Equality with Mathcad 15.0
Want more? Try PTC Mathcad eLearning free!

Try eLearning for PTC Mathcad - Free for 30 days

See how PTC University's eLearning Libraries give you the training you need, anytime you need it.
Register now   
Replay video? Resume video