Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mass/Lebesgue measure? #92

Closed
rytis-paskauskas opened this issue Mar 11, 2024 · 7 comments
Closed

mass/Lebesgue measure? #92

rytis-paskauskas opened this issue Mar 11, 2024 · 7 comments
Labels
question Issue is a question

Comments

@rytis-paskauskas
Copy link

It would be useful to allow some measure theoretic operations, such as adding up masses on intervals. I think that mass could be implemented as a value of IntervalDict. What about mass addition?

@AlexandreDecan
Copy link
Owner

AlexandreDecan commented Mar 11, 2024

Any link showing me what you mean exactly with "mass" and "mass addition"? If the goal is to associate some value with some intervals, then IntervalDict is the way to go. Operations involving multiple IntervalDict instances can be performed using the combine method (not really efficient, that said).

@AlexandreDecan AlexandreDecan added enhancement New feature or request question Issue is a question labels Mar 11, 2024
@AlexandreDecan
Copy link
Owner

I briefly looked at interval masses and this seems quite specific to real number based intervals. I'm unsure this should fit in portion that aims to stay generic.

@rytis-paskauskas
Copy link
Author

rytis-paskauskas commented Mar 11, 2024

Thank you for your consideration.

Here is what I have in mind: if I1, I2 are intervals, and 'mass'[I1]=m1 and 'mass'[I2]=m2, then dict[I1]=m1 and dict[I2]=m2 if I1 and I2 are disjoint, otherwise dict[I1\I2]=m1, dict[I2\I1]=m2, and dict[ I1 & I2]=m1+m2 if they overlap. Masses are summed up in all overlaps, independently of whether intervals are open, closed, integral or real. Not sure I could provide a useful link though.

@rytis-paskauskas
Copy link
Author

rytis-paskauskas commented Mar 11, 2024

The current behavior of IntervalDict upon insertion seems to change the existing keys if there are overlaps. My suggestion is to add new behavior or modify the existing one in such a way that separates the overlapping intervals into separate keys, and that handles the values as illustrated in my previous comment. This is in line with existing behavior that does not preserve left-constness (keys), but it would remove arbitrariness of the current behavior. It would be, I think, valuable functionality which is attractive for probability-related calculations.

@AlexandreDecan
Copy link
Owner

Please have a look at the "combine" method. It handles the example your provided.

@rytis-paskauskas
Copy link
Author

Indeed it does. Thanks.

@AlexandreDecan
Copy link
Owner

Perfect :-)

@AlexandreDecan AlexandreDecan removed the enhancement New feature or request label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issue is a question
Projects
None yet
Development

No branches or pull requests

2 participants