示例#1
0
 def test_jacobian_singularity_avoidance(self):
     '''Not such a good test, very hard to analytically get this jacobian
     Really, just proving that Tools.jacobian doesn't crash
     '''
     jacobian = Tools.jacobian(Azi_Drive.singularity_avoidance,
                               np.array([1.0, 1.0]),
                               dx=0.1)
     self.assertEqual(jacobian.shape, (1, 2))
示例#2
0
    def test_jacobian_test_2(self):
        def test_2((x, y)):
            return np.array([(x ** 2) + (y ** 3), 3 * y])

        exp_result = np.matrix([
            [2, 3],
            [0, 3],
        ])

        jacobian = Tools.jacobian(test_2, np.array([1.0, 1.0]))
        self.assertTrue(np.allclose(jacobian, exp_result))
示例#3
0
    def test_jacobian_test_2(self):
        def test_2((x, y)):
            return np.array([(x**2) + (y**3), 3 * y])

        exp_result = np.matrix([
            [2, 3],
            [0, 3],
        ])

        jacobian = Tools.jacobian(test_2, np.array([1.0, 1.0]))
        self.assertTrue(np.allclose(jacobian, exp_result))
示例#4
0
    def test_jacobian_test_1(self):
        def test_1((x, y)):
            return (x ** 2) + (y ** 2)

        jacobian = Tools.jacobian(test_1, np.array([1.0, 1.0]))
        self.assertTrue(np.allclose(jacobian, [2.0, 2.0]))
示例#5
0
 def test_jacobian_singularity_avoidance(self):
     '''Not such a good test, very hard to analytically get this jacobian
     Really, just proving that Tools.jacobian doesn't crash
     '''
     jacobian = Tools.jacobian(Azi_Drive.singularity_avoidance, np.array([1.0, 1.0]), dx=0.1)
     self.assertEqual(jacobian.shape, (1, 2))
示例#6
0
    def test_jacobian_test_1(self):
        def test_1((x, y)):
            return (x**2) + (y**2)

        jacobian = Tools.jacobian(test_1, np.array([1.0, 1.0]))
        self.assertTrue(np.allclose(jacobian, [2.0, 2.0]))