Browse code

fixes in tests

Bas Nijholt authored on 29/11/2017 09:56:40
Showing 2 changed files
... ...
@@ -139,11 +139,9 @@ def calc_bdef(ns):
139 139
 
140 140
 # Nodes and Newton polynomials.
141 141
 n = (5, 9, 17, 33)
142
-xi = [-np.cos(np.pi / (n[j] - 1) * np.arange(n[j])) for j in range(4)]
143
-# Set central rule points precisely to zero.  This does not really
144
-# matter in practice, but is useful for tests.
145
-for l in xi:
146
-    l[len(l) // 2] = 0.0
142
+xi = [-np.cos(np.arange(n[j])/(n[j]-1) * np.pi) for j in range(4)]
143
+# Make `xi` perfectly anti-symmetric, important for splitting the intervals
144
+xi = [(row - row[::-1]) / 2 for row in xi]
147 145
 
148 146
 b_def = calc_bdef(n)
149 147
 
... ...
@@ -1,4 +1,5 @@
1 1
 # -*- coding: utf-8 -*-
2
+from functools import partial
2 3
 
3 4
 import numpy as np
4 5
 import pytest
... ...
@@ -50,7 +51,7 @@ def test_machine_precision():
50 51
 
51 52
 
52 53
 def test_machine_precision2():
53
-    f, a, b, tol = [f63, 0, 1, 1e-10]
54
+    f, a, b, tol = [partial(f63, u=0.987654321, e=0.45), 0, 1, 1e-10]
54 55
     igral, err, nr_points, ivals = algorithm_4(f, a, b, tol)
55 56
 
56 57
     learner = run_integrator_learner(f, a, b, tol, nr_points)