def norms(self): n = self.n_basic tangent_vectors = [ self._y[(i+1)*n:(i+2)*n] for i in range(self._n_lyap) ] norms = orthonormalise(tangent_vectors) if not np.all(np.isfinite(norms)): warn("Norms of perturbation vectors for Lyapunov exponents out of numerical bounds. You probably waited too long before renormalising and should call integrate with smaller intervals between steps (as renormalisations happen once with every call of integrate).") return norms, tangent_vectors
def norms(self): n = self.n_basic tangent_vectors = [ self._y[(i + 1) * n:(i + 2) * n] for i in range(self._n_lyap) ] norms = orthonormalise(tangent_vectors) if not np.all(np.isfinite(norms)): warn( "Norms of perturbation vectors for Lyapunov exponents out of numerical bounds. You probably waited too long before renormalising and should call integrate with smaller intervals between steps (as renormalisations happen once with every call of integrate)." ) return norms, tangent_vectors
def test_orthonormalise_3(self): vectors = [np.array([1.0, 0.0]), np.array([1.0, 1.0])] norms = orthonormalise(vectors) assert_allclose(vectors[0], np.array([1.0, 0.0])) assert_allclose(vectors[1], np.array([0.0, 1.0])) assert_allclose(norms, np.array([1.0, 1.0]))
def test_orthonormalise_6(self): vectors = [np.array([1.0, 1.0]), np.array([1.0, 0.0])] norms = orthonormalise(vectors) assert_allclose(vectors[0], np.array([np.sqrt(0.5), np.sqrt(0.5)])) assert_allclose(vectors[1], np.array([np.sqrt(0.5), -np.sqrt(0.5)])) assert_allclose(norms, np.array([np.sqrt(2), np.sqrt(0.5)]))
def test_orthonormalise_1(self): vectors = [np.array([3.0, 4.0])] norms = orthonormalise(vectors) assert_allclose(vectors[0], np.array([0.6, 0.8])) assert_allclose(norms, np.array([5]))