from mpmath import quad, iv
L1 = iv.mpf('.1')
L2 = iv.mpf('2')
f = lambda x: 1 / 2
a = quad(f, [L1, L2])
print(a)
What is a correct way?
Note: The support for interval arithmetic in mpmath is still experimental, and many functions do not yet properly support intervals. Please use this feature with caution.