diff --git a/tests/2d/scipy/integrate.py b/tests/2d/scipy/integrate.py new file mode 100644 index 00000000..39b163bd --- /dev/null +++ b/tests/2d/scipy/integrate.py @@ -0,0 +1,29 @@ +import sys +from math import * + +# this test is meaningful only if ulab is compiled with ulab.scipy.integrate +# we're not going to test CPython scipy. +try: + from ulab import scipy +except Exception as e: + print ("could not import ulab.scipy: ", e) + sys.exit(1) + +i = scipy.integrate +try: + if str(type(i)) != "": + print ("scipy.integrate is not available") + sys.exit(1) +except Exception as e: + print ("scipy.integrate is not available") + sys.exit(1) + +f = lambda x: x * sin(x) * exp(x) +a=1 +b=2 +# what if they are not all available? +algorithms = ( i.quad, i.romberg, i.simpson, i.quadgk ) +for quad in algorithms: + print (quad(f, a, b)) + + diff --git a/tests/2d/scipy/integrate.py.exp b/tests/2d/scipy/integrate.py.exp new file mode 100644 index 00000000..6a18b121 --- /dev/null +++ b/tests/2d/scipy/integrate.py.exp @@ -0,0 +1,4 @@ +(7.11263821415851, 5.438231077315757e-14) +7.112638214158507 +7.112638214158494 +(7.112638214158507, 7.686723611780195e-14)