Community Tip - You can change your system assigned username to something more personal in your community settings. X
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
Hi
Can this be done within a tolerance band?
If I had
I'd like to select 15 000
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).
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.
Thanks, I understand what he wants.
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).
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
Here is a modified selectMin3 (yes, well, the name was chosen misleading, you should change it).
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)
I am using this now. It is doing what I wanted to do. Thank you.
I wonder if this simple implementation works satisfactorily:
Some results:
Success!
Luc
Sophisticated! 🙂
Yes! - Few roads now leading to Rome.
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