cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Prime bug with "filterNaN"

Werner_E
25-Diamond I

Prime bug with "filterNaN"

To whoever may be interested

 

Werner_E_0-1687472599426.png

 

 

 

 

5 REPLIES 5
LucMeekes
23-Emerald III
(To:Werner_E)

Mathcad 11:

LucMeekes_0-1687612311874.png

PrimeExpress4 (with a correct implementation of the filterNaN function):

LucMeekes_1-1687616882533.png

Luc

Werner_E
25-Diamond I
(To:LucMeekes)


PrimeExpress4 (with a correct implementation of the filterNaN function):

🙂

The built-in filterNaN in Prime4 throws the same error as in P9.

Actually the bug is already present in Mathcad 15 😞

LucMeekes
23-Emerald III
(To:Werner_E)

In that case we know who to blame: PTC was responsible for Mathcad 15 and all versions of Prime.

I'm responsible for the implementation of the filterNaN function in the PrimeExpress library.

Note that it has this peculiarity:

LucMeekes_0-1687627954554.png

(It doesn't do vectors, yet)

I now see how to mend that (the dirty way)

LucMeekes_1-1687628406244.png

Luc

lvl107
20-Turquoise
(To:LucMeekes)

if M is a vector then : (MC15)

filterNaN.PNG

Best Regards.

Werner_E
25-Diamond I
(To:LucMeekes)


@LucMeekes wrote:

In that case we know who to blame: PTC was responsible for Mathcad 15 and all versions of Prime.


Not that I have any inhibitions about accusing PTC of screwing up, but we can't be entirely sure in this case. We would have to test it in an early 14 version of Mathcad, where Mathsoft still was responsible.

 

BTW, my guess is that filterNaN somehow uses the vector of row numbers of ALL NaN's in the matrix to finally trim it. After all the help describes filterNaN as a combination of matchNaN and trim (which, without additional modifications,  is true for vectors only)
If the number of NaN's in the matrix is larger than the number of rows of the matrix, the error is thrown. Of course this is silly as the trim-vector would include some row numbers multiple times and therefore its OK if its larger.

Werner_E_0-1687660807470.png

 

Consequently the "trim" command suffers from a similar problem:

Werner_E_1-1687660994595.png

Luc's version of "trim" from his excellent Express-collection does not suffer from this bug.

Announcements

Top Tags