Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.8K Views
|
9 Replies
|
6 Total Likes
View groups...
Share
Share this post:

[?] Inconsistent language design MinMax - Solved in V11.1

POSTED BY: Sander Huisman
9 Replies

I'm not sure what was done in the handling if Interval objects. Might or might not be intended behavior.

As for handling of empty lists, I think it is a sensible departure from the design of Min and Max separately. It means that programs known to generate either purely NumericQ or empty lists can be treated in a uniform manner, without need for safety checks that the list was not empty.

POSTED BY: Daniel Lichtblau

I don't think I'm following you, if you have NumericQ or empty lists now, they are NOT treated in a uniform manner as I showed above...

Also if you interpret MinMax as kind-of giving the range of the numbers, then for an empty set (list) the output will be strange anyhow: if you output {-inf,inf} it is strange because out of nothing the 'size' of the set is infinite, which I guess is equally strange from giving back {0,0} or {inf,-inf}. the last one though, is compatible with the definitions of min and max separately, and the definition of how MinMax[list] should work {Min[list],Max[list]}...

My point is, that the output for an empty list is arbitrary, but there is one output that is at least consistent with the useful behavior of Min and Max... don't you agree?

POSTED BY: Sander Huisman

I agree that there is an output consistent with behavior of Min and Max separately. I agree MinMax does not give that consistent result. I do not agree that that behavior of Min and Max individually is useful in the context of MinMax. Whether consistency is more important is certainly a reasonable point to raise. I would not go so far as to say it trumps all other desired features of such a function, and handling of empty sets the way MinMax now does is such a feature.

POSTED BY: Daniel Lichtblau

What was the rational on returning {-inf,inf} for Minmax[{}] if I may ask?

POSTED BY: Sander Huisman

I don't know the answer. I only claim it makes sense to me, as an edge case.

POSTED BY: Daniel Lichtblau

Well, as of version 11.1 this has been changed; now it gives the expected (at least for me) result:

{Min[{}], Max[{}]}
MinMax[{}]

both return:

{\[Infinity], -\[Infinity]}

as one would expect.

POSTED BY: Sander Huisman

I guess the reasoning is then that the output of MinMax can be interpreted as an interval, and of course {Infinity, -Infinity} makes not sense that way.

POSTED BY: Szabolcs Horvát

If it would be an interval, shouldn't it be a 'null' interval

Interval[]

Such that Min[Interval[]] gives correctly infinity, and Max[Interval[]] gives -infinity. To proof my point further:

{Min[Interval[]], Max[Interval[]]}
MinMax[Interval[]]

gives the same result!

POSTED BY: Sander Huisman

Nope, it's not fixed in 10.4.0.

POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard