1 | initial version |
For a numerical approximation, use numerical_integral
.
It also gives an estimate for the error.
You can extract the value and discard the estimate.
sage: f = lambda x: RealDistribution('uniform', [0, 2]).distribution_function(x)
sage: numerical_integral(f, 0, 1)
(0.5, 5.551115123125783e-15)
sage: numerical_integral(f, 0, 1)[0]
0.5