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

match function bug

ifomenko
15-Moonstone

match function bug

I met strange situation with match function.That`s the problem?

match bug.png

With unitless V all is OK

1 ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
22-Sapphire II
(To:ifomenko)

Igor Fomenko wrote:

I met strange situation with match function.That`s the problem?

With unitless V all is OK

I don't think you're looking at a bug, but more likely the effect of your default TOL setting on how close 3 sq cm has to be each element of V (don't forget Mathcad internally converts sq cm to sq m).

Stuart

View solution in original post

3 REPLIES 3
StuartBruff
22-Sapphire II
(To:ifomenko)

Igor Fomenko wrote:

I met strange situation with match function.That`s the problem?

With unitless V all is OK

I don't think you're looking at a bug, but more likely the effect of your default TOL setting on how close 3 sq cm has to be each element of V (don't forget Mathcad internally converts sq cm to sq m).

Stuart

View solution in original post

It's a tolerance problem:

change the tolerance:

Werner_E
24-Ruby IV
(To:ifomenko)

As Stuart and Fred already have written, its not a bug, its a feature

Hmm, but a very annoying one. Changing the value of TOL to a much lower value may have undesired side effects on other numeric calculations.

In Mathcad we also have "Match" (note the capital "M") with its modifiers , but unfortunately there is no modifier "equal" and equal  means also here wrt the base unit and the value of TOL.

So the only way to avoid this "feature" (which I consider simply a very bad implementation) is to write your own match function:

This also copes with the often annoying error which is thrown by the built-in match, when no value is found.

In Prime the situation is a bit different because you also can provide your own comparison function. So we can do it that way:

So one point for Prime, but still millions of points against 😉

Regards

Werner

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."