QuantEcon / Expectations.jl

Expectation operators for Distributions.jl objects
MIT License
57 stars 17 forks source link

Bug when computing simple expectations #23

Closed IljaK91 closed 6 years ago

IljaK91 commented 6 years ago

I have encountered a bug today:

using Distributions, Expectations
E    = expectation(Normal(1, 1))
E(x -> x)

julia> E(x -> x)
5.778544334733716e-17

where it clearly should be 1. I can have a look tomorrow to figure out what is happening.

Nosferican commented 6 years ago

Thanks.

arnavs commented 6 years ago

Thanks for posting @IljaK91, will look into this right now.

arnavs commented 6 years ago

This was a straight-up math error with the order of operations on something. I pushed a fix to master and added a test case. Will go through and make sure we have enough non-standard parameter cases in there as sanity checks.

arnavs commented 6 years ago

Tagged a new release https://github.com/econtoolkit/Expectations.jl/tree/v1.0.2 to incorporate these fixes, and more tests.