Пример #1
0
 def test_consistency(self):
     from pyaudi import gdual_vdouble as gdual_v
     from pyaudi import gdual_double as gdual_d
     x1 = gdual_d(1, "x", 4)
     y1 = gdual_d(0.1, "y", 4)
     z1 = gdual_d(-0.3, "z", 4)
     f1 = some_complex_rational_f(x1, y1, z1)
     x2 = gdual_d(-0.5, "x", 4)
     y2 = gdual_d(0.03, "y", 4)
     z2 = gdual_d(0.23, "z", 4)
     f2 = some_complex_rational_f(x2, y2, z2)
     x3 = gdual_d(0.441413, "x", 4)
     y3 = gdual_d(-0.2341243241, "y", 4)
     z3 = gdual_d(0.2421413, "z", 4)
     f3 = some_complex_rational_f(x3, y3, z3)
     xv = gdual_v([1, -0.5, 0.441413], "x", 4)
     yv = gdual_v([0.1, 0.03, -0.2341243241], "y", 4)
     zv = gdual_v([-0.3, 0.23, 0.2421413], "z", 4)
     fv = some_complex_rational_f(xv, yv, zv)
     for dx in range(0, 4):
         for dy in range(0, 4):
             for dz in range(0, 4):
                 if dx + dy + dz <= 4:
                     self.assertAlmostEqual(f1.get_derivative([dx, dy, dz]),
                                            fv.get_derivative([dx, dy,
                                                               dz])[0],
                                            delta=1e-12)
                     self.assertAlmostEqual(f2.get_derivative([dx, dy, dz]),
                                            fv.get_derivative([dx, dy,
                                                               dz])[1],
                                            delta=1e-12)
                     self.assertAlmostEqual(f3.get_derivative([dx, dy, dz]),
                                            fv.get_derivative([dx, dy,
                                                               dz])[2],
                                            delta=1e-12)
Пример #2
0
 def test_consistency(self):
     from pyaudi import gdual_vdouble as gdual_v
     from pyaudi import gdual_double as gdual_d
     x1 = gdual_d(1, "x", 4)
     y1 = gdual_d(0.1, "y", 4)
     z1 = gdual_d(-0.3, "z", 4)
     f1 = some_complex_rational_f(x1,y1,z1)
     x2 = gdual_d(-0.5, "x", 4)
     y2 = gdual_d(0.03, "y", 4)
     z2 = gdual_d(0.23, "z", 4)
     f2 = some_complex_rational_f(x2,y2,z2)
     x3 = gdual_d(0.441413, "x", 4)
     y3 = gdual_d(-0.2341243241, "y", 4)
     z3 = gdual_d(0.2421413, "z", 4)
     f3 = some_complex_rational_f(x3,y3,z3)
     xv = gdual_v([1,-0.5, 0.441413], "x", 4)
     yv = gdual_v([0.1,0.03, -0.2341243241], "y", 4)
     zv = gdual_v([-0.3,0.23, 0.2421413], "z", 4)
     fv = some_complex_rational_f(xv,yv,zv)
     for dx in range(0, 4):
         for dy in range(0, 4):
             for dz in range(0, 4):
                 if dx+dy+dz <= 4:
                     self.assertAlmostEqual(f1.get_derivative([dx,dy,dz]), fv.get_derivative([dx,dy,dz])[0], delta=1e-12)
                     self.assertAlmostEqual(f2.get_derivative([dx,dy,dz]), fv.get_derivative([dx,dy,dz])[1], delta=1e-12)
                     self.assertAlmostEqual(f3.get_derivative([dx,dy,dz]), fv.get_derivative([dx,dy,dz])[2], delta=1e-12)