diff --git a/control/statesp.py b/control/statesp.py index 6b3a1dff3..ffd579247 100644 --- a/control/statesp.py +++ b/control/statesp.py @@ -921,6 +921,10 @@ def horner(self, x, warn_infinite=True): out[:, :, idx] = complex(np.nan, np.nan) else: out[:, :, idx] = complex(np.inf, np.nan) + else: + if np.any(np.isnan(out[:, :, idx])): + print(idx, x_idx, self.A, self.B) + print(out[:, :, idx]) return out diff --git a/control/tests/flatsys_test.py b/control/tests/flatsys_test.py index 373af8dae..6f4ef7cef 100644 --- a/control/tests/flatsys_test.py +++ b/control/tests/flatsys_test.py @@ -339,8 +339,9 @@ def test_point_to_point_errors(self): traj_kwarg = fs.point_to_point( flat_sys, timepts, x0, u0, xf, uf, cost=cost_fcn, basis=fs.PolyFamily(8), minimize_kwargs={'method': 'slsqp'}) - np.testing.assert_almost_equal( - traj_method.eval(timepts)[0], traj_kwarg.eval(timepts)[0]) + np.testing.assert_allclose( + traj_method.eval(timepts)[0], traj_kwarg.eval(timepts)[0], + atol=1e-5) # Unrecognized keywords with pytest.raises(TypeError, match="unrecognized keyword"): diff --git a/control/tests/timeresp_test.py b/control/tests/timeresp_test.py index c74c0c06d..d9cb065f6 100644 --- a/control/tests/timeresp_test.py +++ b/control/tests/timeresp_test.py @@ -681,7 +681,8 @@ def test_forced_response_T_U(self, tsystem, fr_kwargs, refattr): fr_kwargs['X0'] = tsystem.X0 t, y = forced_response(tsystem.sys, **fr_kwargs) np.testing.assert_allclose(t, tsystem.t) - np.testing.assert_allclose(y, getattr(tsystem, refattr), rtol=1e-3) + np.testing.assert_allclose(y, getattr(tsystem, refattr), + rtol=1e-3, atol=1e-5) @pytest.mark.parametrize("tsystem", ["siso_ss1"], indirect=True) def test_forced_response_invalid_c(self, tsystem):