-
Notifications
You must be signed in to change notification settings - Fork 87
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
Can't calculate moments with Trunc and TruncNormal distributions #371
Comments
I'm not able to replicate the bug on my system. Mind posting your current version of Also if you have only tried to install through conda, do you mind trying out with pip? |
from the And yes, I had already installed chaospy using pip, conda usually has outdated packages. |
May I add I also tested the same minimal code by installing a fresh Python 3.10.2 distribution (from the official website, so not from Anaconda), and installed
|
My best guess is that on your windows machine the machine precision is lower than on mine. I've made the assert more lenient now in version 4.3.5. Place check it out to see if it solves you problem. |
Hi, did you push the update through pip? |
Hm... the building of the docs depend on the existence of indexes for external docs to numpy, scipy etc. Hopefully scipy docs will be up soon. In the mean time I've uploaded 4.3.5 manually now. |
Hi jonathf So I successfully installed the updated version and quickly re-tested the minimal code using the Python REPL. Sadly it seems the error is still present. I tested Here's the output:
I took a look into the traceback and added a
Since it's using the
You might want to test this behavior more thoroughly. Perhaps also add in the code some rounding if the order is incredibly small (in this case it was e-17, practically zero as it should be). Finally, I also tested passing in
|
Still challanging for me to diagnose. Could you perhaps try using |
Here's the full output. I also used
The mean is very close to the true mean. Here's some calculation of the error, both from the scipy values and a few Monte-Carlo runs.
|
That is an excellent idea. I've just released 4.3.6 with a fix. Let me know if it solves the problem. |
I'm using
chaospy
version 4.3.4 installed withpip
, on Python 3.8.12I can't calculate the Expected value with the function
cp.E()
, as it throws the errorUnsupportedFeature
.Here's the input for minimal testing.
With the following output:
The same error is raised if I pass a distribution in the
cp.Trunc()
distribution to limit its range.Many thanks for your help in advance.
The text was updated successfully, but these errors were encountered: