statrs-dev / statrs

Statistical computation library for Rust
https://docs.rs/statrs/latest/statrs/
MIT License
544 stars 78 forks source link

Ensure Uniform constructed on bounded interval #218

Closed YeungOnion closed 1 month ago

YeungOnion commented 2 months ago

In looking at lints (#216, has some of the discussion there) adjacently found that Uniform would allow infinite support. I don't know enough to say if this is well defined mathematically, but a few implications I thought of:

There may be others, but this PR would disallow construction of such a distribution, sf was implemented to have behavior for infinite support, but cdf was not. If someone can declare how it should work, then we can reallow it and implement all the behavior for it.

YeungOnion commented 2 months ago

I removed tests that didn't require that a, b < ∞ AND a<b but I noticed there were tests that specifically tested such behavior, most notably things like

The blame shows @boxtown writing some of those tests 8 years ago and some from @dcraven 3 years ago. Don't suppose you recall why you chose that before, do you? I'd like to know more about what I'm considering removing.

EDIT: Mention @dcraven's additions, despite not being able to find his gh account

YeungOnion commented 1 month ago

More discussion is needed on what's expected behavior for such degenerate cases, #102 will host future discussion, for now I'll exclude this degenerate case.