Skip to content

Instantly share code, notes, and snippets.

@mwhudson
Created September 10, 2018 22:41
Show Gist options
  • Save mwhudson/f40be8bc89eea32a469257d3d9cb478c to your computer and use it in GitHub Desktop.
Save mwhudson/f40be8bc89eea32a469257d3d9cb478c to your computer and use it in GitHub Desktop.
Building, see build.log...
Build OK (0:00:03.504582 elapsed)
============================= test session starts ==============================
platform linux -- Python 3.6.6+, pytest-3.6.4, py-1.5.4, pluggy-0.6.0 -- /usr/bin/python3.6
cachedir: ../../../../../.pytest_cache
rootdir: /root/scipy, inifile: pytest.ini
collecting ... collected 1 item
scipy/special/tests/test_orthogonal.py::test_roots_jacobi FAILED [100%]
=================================== FAILURES ===================================
______________________________ test_roots_jacobi _______________________________
def test_roots_jacobi():
rf = lambda a, b: lambda n, mu: sc.roots_jacobi(n, a, b, mu)
ef = lambda a, b: lambda n, x: orth.eval_jacobi(n, a, b, x)
wf = lambda a, b: lambda x: (1 - x)**a * (1 + x)**b
vgq = verify_gauss_quad
vgq(rf(-0.5, -0.75), ef(-0.5, -0.75), wf(-0.5, -0.75), -1., 1., 5)
vgq(rf(-0.5, -0.75), ef(-0.5, -0.75), wf(-0.5, -0.75), -1., 1.,
25, atol=1e-12)
vgq(rf(-0.5, -0.75), ef(-0.5, -0.75), wf(-0.5, -0.75), -1., 1.,
100, atol=1e-11)
vgq(rf(0.5, -0.5), ef(0.5, -0.5), wf(0.5, -0.5), -1., 1., 5)
vgq(rf(0.5, -0.5), ef(0.5, -0.5), wf(0.5, -0.5), -1., 1., 25, atol=1.5e-13)
vgq(rf(0.5, -0.5), ef(0.5, -0.5), wf(0.5, -0.5), -1., 1., 100, atol=1e-12)
vgq(rf(1, 0.5), ef(1, 0.5), wf(1, 0.5), -1., 1., 5, atol=2e-13)
vgq(rf(1, 0.5), ef(1, 0.5), wf(1, 0.5), -1., 1., 25, atol=2e-13)
vgq(rf(1, 0.5), ef(1, 0.5), wf(1, 0.5), -1., 1., 100, atol=1e-12)
vgq(rf(0.9, 2), ef(0.9, 2), wf(0.9, 2), -1., 1., 5)
vgq(rf(0.9, 2), ef(0.9, 2), wf(0.9, 2), -1., 1., 25, atol=1e-13)
> vgq(rf(0.9, 2), ef(0.9, 2), wf(0.9, 2), -1., 1., 100, atol=2e-13)
ef = <function test_roots_jacobi.<locals>.<lambda> at 0xf4b2d5cc>
rf = <function test_roots_jacobi.<locals>.<lambda> at 0xf4b2d584>
vgq = <function verify_gauss_quad at 0xf57cbb6c>
wf = <function test_roots_jacobi.<locals>.<lambda> at 0xf4b2d614>
scipy/special/tests/test_orthogonal.py:331:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
root_func = <function test_roots_jacobi.<locals>.<lambda>.<locals>.<lambda> at 0xf57cbbfc>
eval_func = <function test_roots_jacobi.<locals>.<lambda>.<locals>.<lambda> at 0xf4b2d65c>
weight_func = <function test_roots_jacobi.<locals>.<lambda>.<locals>.<lambda> at 0xf4b2d6a4>
a = -1.0, b = 1.0, N = 100, rtol = 1e-15, atol = 2e-13
def verify_gauss_quad(root_func, eval_func, weight_func, a, b, N,
rtol=1e-15, atol=1e-14):
# this test is copied from numpy's TestGauss in test_hermite.py
x, w, mu = root_func(N, True)
n = np.arange(N)
v = eval_func(n[:,np.newaxis], x)
vv = np.dot(v*w, v.T)
vd = 1 / np.sqrt(vv.diagonal())
vv = vd[:, np.newaxis] * vv * vd
> assert_allclose(vv, np.eye(N), rtol, atol)
E AssertionError:
E Not equal to tolerance rtol=1e-15, atol=2e-13
E
E (mismatch 0.37999999999999545%)
E x: array([[ 1.000000e+00, 3.099016e-16, -1.339924e-15, ..., 1.060805e-16,
E 7.590133e-16, -4.425680e-17],
E [ 3.055861e-16, 1.000000e+00, 5.293052e-16, ..., 2.120712e-15,...
E y: array([[1., 0., 0., ..., 0., 0., 0.],
E [0., 1., 0., ..., 0., 0., 0.],
E [0., 0., 1., ..., 0., 0., 0.],...
N = 100
a = -1.0
atol = 2e-13
b = 1.0
eval_func = <function test_roots_jacobi.<locals>.<lambda>.<locals>.<lambda> at 0xf4b2d65c>
mu = 1.389411127980726
n = array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, ...72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99])
root_func = <function test_roots_jacobi.<locals>.<lambda>.<locals>.<lambda> at 0xf57cbbfc>
rtol = 1e-15
v = array([[ 1. , 1. , 1. , ..., 1. ,
1. , 1. ],
[ -2....1.10173789],
[-26.87377935, 13.10652054, -8.13754995, ..., 0.37165919,
-0.43117974, 0.54852754]])
vd = array([0.84836865, 0.863124 , 0.91800442, 0.97907994, 1.04005166,
1.0992902 , 1.15639074, 1.21133531, 1.264234...68, 3.56316939, 3.58191602, 3.60056513, 3.61911821,
3.63757674, 3.65594213, 3.6742158 , 3.69239909, 3.71049334])
vv = array([[ 1.00000000e+00, 3.09901629e-16, -1.33992385e-15, ...,
1.06080539e-16, 7.59013348e-16, -4.42568009e... [-5.39755171e-17, -6.89731204e-17, 1.30982794e-16, ...,
-2.65623601e-15, 1.13044106e-15, 1.00000000e+00]])
w = array([5.00352544e-09, 5.64277595e-08, 2.78385389e-07, 9.22741153e-07,
2.41132277e-06, 5.37430084e-06, 1.068383...9.39170228e-04, 6.23551455e-04, 3.83915909e-04,
2.12307874e-04, 9.94582488e-05, 3.47711120e-05, 6.22437207e-06])
weight_func = <function test_roots_jacobi.<locals>.<lambda>.<locals>.<lambda> at 0xf4b2d6a4>
x = array([-0.99873145, -0.99659351, -0.9935115 , -0.98948673, -0.98452271,
-0.97862405, -0.97179631, -0.96404595, ...010558, 0.96826872, 0.97551243, 0.98182982,
0.98721489, 0.99166254, 0.99516852, 0.99772947, 0.99934274])
scipy/special/tests/test_orthogonal.py:297: AssertionError
=========================== 1 failed in 0.36 seconds ===========================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment