Skip to main content
ttokoro
21-Topaz I
June 13, 2018
Solved

I want to know the reasons of my Mathcad sheet errors.

  • June 13, 2018
  • 20 replies
  • 7189 views

Using Mathcad the average value of f(t) and convolution of rectangular waves have wrong results.

I want to know the reasons.

Best answer by ttokoro

Thanks many replyings to my help. I understand they are bugs.

20 replies

24-Ruby IV
June 13, 2018

|  |, if etc - not for symbolic math! Symbolic mathematics (and nature) does not like sharp corners!

Mod-Sim.pngMod-If.png

25-Diamond I
June 13, 2018

If the symbolics does not "like" sharp corners it should say so and not return an awfully wrong result.

What we see here is a clear severe bug of Primes symbolics (= MuPad) which is also present in real Mathcad.

The expression should either be not simplified at all or return the correct symbolic result

B1.png

If you are under maintenance  you may consider reporting this bug to PTC but don't expect a fix within a reasonable time.

Luc may be able to show if this bug is present in Mathcad 11, too, which uses Maple for symbolics. Guess MC11 returns the correct result.

 

Concerning  the second error I am not sure what the reason may be. Here the problem is the numerical evaluation (used by any plot) - the symbolics get the correct results:

B2.png

The precision of numerical integration is dependent on the value of TOL. But changing that value in your sheet does not noticeably affect the outcome.

Here the nature of the integrand might be the cause.

The effect is there in Mathcad 15, too (and I guess it will also be shown in Mathcad 11), but the effect is slighty different depending on the algorithm chosen (we can chose among a couple of algortithms for the integration in real Mathcad - in Prime we can't) and also depending on the value of TOL.

Here some statements from the Mathcad manual/user guide (the last manual which deserved that name was delivered with Mathcad 11, but most statements about numerics still apply):

  • Like all numerical methods, Mathcad's integration algorithm can have difficulty with illbehaved
    integrands. If the expression to be integrated has singularities, discontinuities, or large
    and rapid fluctuations, Mathcad's solution may be inaccurate.

  • Mathcad’s numerical integration algorithm makes successive estimates of the value of the
    integral and returns a value when the two most recent estimates differ by less than the value of
    the built-in variable TOL.
23-Emerald IV
June 13, 2018

I can only agree with Valery: Be very careful when using the | | operator in combinatioin with symbolics.

Here's Mathcad 11:

LM_20180613_Error.png

But then, it's the 13th today...

 

Success!
Luc

25-Diamond I
June 13, 2018

At least Maple got the correct symbolic solution when replacing the absolute value by root of square.

Nevertheless I am surprised that even Maple in MC11 has problems with the absolute value in a way that it returns a completely wrong result. This should never happen in a Math software and I see it as a very severe bug (which will not be fixed, I know). If a software returns no result because its not capable to find a solution, then this may be a sign of quality (or the opposite of it). But returning a wrong result, thats an absolute no-go!

23-Emerald IV
June 13, 2018

What happens in Prime/Mathcad 15 (with symbolic evaluation) if you take the symbolic equivalent of the if() statement: the Heaviside step function:

LM_20180613_Error1.png

 

(Of course, as shown, numeric evaluation gives the right answer with any of the three ways to make the function positive)

 

Success!

Luc

25-Diamond I
June 13, 2018

Similar results in MC15. Heaviside works with symbolics, too.

The drawback of course is that we have to manually derive the points of zero and basically split the function manually at those points. Similar to the distinct integrals I used in my first answer to get the correct symbolic result.

A bug stays a bug even if there may be a workaround and this IS a bug (even in MC15/Maple).

25-Diamond I
June 13, 2018

How about this alternative to the absolute value in MC11?

In MC15 an additional similar bug shows up.

B.png

ttokoro
ttokoro21-Topaz IAuthorAnswer
21-Topaz I
June 18, 2018

Thanks many replyings to my help. I understand they are bugs.

t.t.
ttokoro
ttokoro21-Topaz IAuthor
21-Topaz I
August 15, 2018

Unfortunately, no bug fix with Prime 5.0.

t.t.
skunks
19-Tanzanite
August 15, 2018

the eternal bug in the german release

 

bug.JPG