Skip to main content
10-Marble
February 25, 2025
Question

How do I get Mathcad to give me the simplified version of an operation on 2 functions?

  • February 25, 2025
  • 3 replies
  • 736 views

How do I get Mathcad to get from this:

AP_12953245_0-1740496552324.png

to this:

AP_12953245_1-1740496584930.png

without having to redefine f(x) myself?

3 replies

25-Diamond I
February 25, 2025

You may use symbolic evaluation to get an expanded view of the expression but I guess you wont get the summands in the order you show. Unfortunately, Prime does not offer many options to control the way the Symbolics displays its results.

Because you use the decimal point in your expression, the symbolics switch to some kind of float mode and ALL numbers are displayed with at least one decimal, which is quite silly and looks ugly.

Werner_E_0-1740497934276.png

The last result with the modifier "factor" is strange. The factor 1.0 actually should not be shown. It even may be called a bug that Prime does this.

 

For future questions please keep in mind to always attach you worksheet as well.

 

14-Alexandrite
February 25, 2025

@AP_12953245 please keep in mind that Mathcad will not "redefine" f(x) for you in any way.  The methods described by Werner are only only intended to 'display' the result of the symbolic manipulation of expanding and collecting terms, and is very useful in validating your work or simplifying formulas you are trying to derive.  Since your formula is still technically valid in either form, there is no reason to redefine the function anyway—your original definition of f(x) will give you the correct output regardless.  Does this make sense?

25-Diamond I
February 26, 2025

I agree that there is no reason for redefining the function based on the symbolic simplification.

I could be done that way

Werner_E_0-1740530912650.png

and indeed evaluation should be a little bit faster as the calculation  11+47 has not to be done every time you evaluate the function. But I doubt that this decrease of calc time would be noticeable - not even when done million times.

A redefinition would make sense if the original function definition is extremely time consuming and could be simplified symbolically - e.g. when using integrals as numerical integration is rather time consuming.

Here an example with a double integration. The non-simplified function definition takes more than 100 times longer:

Werner_E_1-1740531254483.png

 

Doing the same with the function given here does not show a significant improvement as expected

Werner_E_2-1740531687703.png

 

23-Emerald IV
February 25, 2025

How about:

LucMeekes_0-1740523505316.png

Success!
Luc