Beispiel #1
0
 def test_set_derivative_vector_for_constant_nondiagonal_case(self):
     ode = Ode(coeff_matrix=self.COEFF_MATRIX_CONSTANT_NONDIAGONAL,
               init_condition=self.INIT_CONDITION_CONSTANT_NONDIAGONAL)
     actual = ode.set_derivative_vector(variable_vector=self.INIT_CONDITION_CONSTANT_NONDIAGONAL, actual_position=0,
                                        coeff_matrix=self.COEFF_MATRIX_CONSTANT_NONDIAGONAL, steps=self.STEPS)
     self.assertEqual(actual.size, self.EXPECTED_SIZE_3)
     npt.assert_almost_equal(actual, self.EXPECTED_DERIVATIVE_CONSTANT_NONDIAGONAL, self.DECIMALS_6)
Beispiel #2
0
 def test_set_derivative_vector_for_varying_nondiagonal(self):
     ode = Ode(coeff_matrix=self.COEFF_MATRIX_VARYING_NONDIAGONAL,
               init_condition=self.INIT_CONDITION_VARYING_NONDIAGONAL)
     actual = ode.set_derivative_vector(variable_vector=self.INIT_CONDITION_VARYING_NONDIAGONAL,
                                        actual_position=self.STEPS_VARYING_NONDIAGONAL[1],
                                        coeff_matrix=self.COEFF_MATRIX_VARYING_NONDIAGONAL,
                                        steps=self.STEPS_VARYING_NONDIAGONAL)
     self.assertEqual(actual.size, self.EXPECTED_SIZE_2)
     npt.assert_almost_equal(actual, self.EXPECTED_DERIVATIVE_VARYING_NONDIAGONAL, self.DECIMALS_6)
Beispiel #3
0
 def test_set_derivative_vector_for_dimension_error(self):
     with self.assertRaises(ValueError):
         ode = Ode(coeff_matrix=self.COEFF_MATRIX_DIM_ERROR, init_condition=self.INIT_CONDITION_GENERAL)
         ode.set_derivative_vector(variable_vector=self.INIT_CONDITION_GENERAL, actual_position=self.START_POSITION,
                                   coeff_matrix=self.COEFF_MATRIX_DIM_ERROR, steps=self.STEPS)