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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

17-Peridot

## SELECT DIFFERENT

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:ppal)

Here is a utility function. The input is a vector of scalar values of any length. The return value is that vector element which occurs least often. If there are several, the first one to appear is chosen.

And here is a function working just for your special case of a three element vector with one single value

15 REPLIES 15
20-Turquoise
(To:ppal)

17-Peridot
(To:ttokoro)

Hi

Can this be done within a tolerance band?

I'd like to select 15 000

20-Turquoise
(To:ppal)

If A[0<>A[1<>A[2 and you want max. middle or mini also can select after else instead max(A) but sort(A)[1 and min(A).

24-Ruby V
(To:ttokoro)

I guess your approach is not what ppal is looking for. Maybe you misunderstood the intention.

If no two values are equal, not the largest value should be returned but the value which is farthest apart from the other two.

So with input 9, 14, 15 your function would return 15 while it should return 9.

20-Turquoise
(To:Werner_E)

Thanks, I understand what he wants.

24-Ruby V
(To:ttokoro)

Have you tested your function with a couple of triples? I guess its not doing what was demanded.

Just try the original set of (10; 9; 15).

20-Turquoise
(To:Werner_E)

24-Ruby V
(To:ttokoro)

Try (1,2,10). Your f3 would return 2 and not 10.

I don't think that the mean is of much help in this task.

After sorting the values the only thing important is, which of the two outer elements is farther away from the center element. And thats exactly what my functions do -> https://community.ptc.com/t5/Mathcad/SELECT-DIFFERENT/m-p/830256/highlight/true#M203207

24-Ruby V
(To:ppal)

Here is a modified selectMin3 (yes, well, the name was chosen misleading, you should change it).

24-Ruby V
(To:Werner_E)

OK, with the modification done to selectMin3 the approach was unnecessary complicated.

A more straightforward approach is shown here, using just one if-else (function or statement - your choice)

17-Peridot
(To:Werner_E)

I am using this now. It is doing what I wanted to do. Thank you.

23-Emerald III
(To:ppal)

I wonder if this simple implementation works satisfactorily:

Some results:

Success!
Luc

24-Ruby V
(To:LucMeekes)

Sophisticated! 🙂

17-Peridot
(To:LucMeekes)