"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "mpmath/tests/test_rootfinding.py" between
mpmath-0.18.tar.gz and mpmath-0.19.tar.gz

About: mpmath is a Python library for arbitrary-precision floating-point arithmetic.

test_rootfinding.py  (mpmath-0.18):test_rootfinding.py  (mpmath-0.19)
skipping to change at line 32 skipping to change at line 32
# test types # test types
f = lambda x: (x - 2)**2 f = lambda x: (x - 2)**2
#assert isinstance(findroot(f, 1, force_type=mpf, tol=1e-10), mpf) #assert isinstance(findroot(f, 1, force_type=mpf, tol=1e-10), mpf)
#assert isinstance(findroot(f, 1., force_type=None, tol=1e-10), float) #assert isinstance(findroot(f, 1., force_type=None, tol=1e-10), float)
#assert isinstance(findroot(f, 1, force_type=complex, tol=1e-10), complex) #assert isinstance(findroot(f, 1, force_type=complex, tol=1e-10), complex)
assert isinstance(fp.findroot(f, 1, tol=1e-10), float) assert isinstance(fp.findroot(f, 1, tol=1e-10), float)
assert isinstance(fp.findroot(f, 1+0j, tol=1e-10), complex) assert isinstance(fp.findroot(f, 1+0j, tol=1e-10), complex)
def test_bisection(): def test_bisection():
# issue 233 # issue 273
assert findroot(lambda x: x**2-1,(0,2),solver='bisect') == 1 assert findroot(lambda x: x**2-1,(0,2),solver='bisect') == 1
def test_mnewton(): def test_mnewton():
f = lambda x: polyval([1,3,3,1],x) f = lambda x: polyval([1,3,3,1],x)
x = findroot(f, -0.9, solver='mnewton') x = findroot(f, -0.9, solver='mnewton')
assert abs(f(x)) < eps assert abs(f(x)) < eps
def test_anewton(): def test_anewton():
f = lambda x: (x - 2)**100 f = lambda x: (x - 2)**100
x = findroot(f, 1., solver=ANewton) x = findroot(f, 1., solver=ANewton)
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS