Arbitrary-precision interval arithmetic (iv) and integrals

32 views
Skip to first unread message

Taras Boychuk

unread,
Feb 3, 2020, 5:55:55 AM2/3/20
to mpmath

Is it possible to calculate integrals using Arbitrary-precision interval arithmetic?


This code doesn't work:


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?

 

Kris Kuhlman

unread,
Feb 3, 2020, 9:54:41 AM2/3/20
to mpmath

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.


The c library Arb does support this, and there is a python wrapper for the library.


Kris

Taras Boychuk

unread,
Feb 3, 2020, 12:41:37 PM2/3/20
to mpmath
Maybe. But if you replace L1 = iv.mpf('.1') with L1 = iv.mpf('1') if works. Even if replace it with L1 = iv.mpf(1/9) it works. So integration is implemented.

понеділок, 3 лютого 2020 р. 12:55:55 UTC+2 користувач Taras Boychuk написав:
Reply all
Reply to author
Forward
0 new messages