예제 #1
0
파일: test.py 프로젝트: darioizzo/audi
    def test_inverse_functions(self):
        from pyaudi import gdual_double as gdual
        from pyaudi import sinh, cosh, tanh
        from pyaudi import asinh, acosh, atanh
        from pyaudi import sin, cos, tan
        from pyaudi import asin, acos, atan

        x = gdual(1.1, "x",6);
        y = gdual(1.2, "y",6);
        p1 = 1. / (x + y);

        self.assertTrue((cos(acos(p1))-p1).is_zero(1e-12))
        self.assertTrue((acos(cos(p1))-p1).is_zero(1e-12))

        self.assertTrue((sin(asin(p1))-p1).is_zero(1e-12))
        self.assertTrue((asin(sin(p1))-p1).is_zero(1e-12))

        self.assertTrue((tan(atan(p1))-p1).is_zero(1e-12))
        self.assertTrue((atan(tan(p1))-p1).is_zero(1e-12))

        self.assertTrue((cosh(acosh(p1))-p1).is_zero(1e-12))
        self.assertTrue((acosh(cosh(p1))-p1).is_zero(1e-12))

        self.assertTrue((sinh(asinh(p1))-p1).is_zero(1e-12))
        self.assertTrue((asinh(sinh(p1))-p1).is_zero(1e-12))

        self.assertTrue((tanh(atanh(p1))-p1).is_zero(1e-12))
        self.assertTrue((atanh(tanh(p1))-p1).is_zero(1e-12))
예제 #2
0
파일: test.py 프로젝트: bluescarni/audi
    def test_inverse_functions(self):
        from pyaudi import gdual_double as gdual
        from pyaudi import sinh, cosh, tanh
        from pyaudi import asinh, acosh, atanh
        from pyaudi import sin, cos, tan
        from pyaudi import asin, acos, atan

        x = gdual(1.1, "x", 6)
        y = gdual(1.2, "y", 6)
        p1 = 1. / (x + y)

        self.assertTrue((cos(acos(p1)) - p1).is_zero(1e-12))
        self.assertTrue((acos(cos(p1)) - p1).is_zero(1e-12))

        self.assertTrue((sin(asin(p1)) - p1).is_zero(1e-12))
        self.assertTrue((asin(sin(p1)) - p1).is_zero(1e-12))

        self.assertTrue((tan(atan(p1)) - p1).is_zero(1e-12))
        self.assertTrue((atan(tan(p1)) - p1).is_zero(1e-12))

        self.assertTrue((cosh(acosh(p1)) - p1).is_zero(1e-12))
        self.assertTrue((acosh(cosh(p1)) - p1).is_zero(1e-12))

        self.assertTrue((sinh(asinh(p1)) - p1).is_zero(1e-12))
        self.assertTrue((asinh(sinh(p1)) - p1).is_zero(1e-12))

        self.assertTrue((tanh(atanh(p1)) - p1).is_zero(1e-12))
        self.assertTrue((atanh(tanh(p1)) - p1).is_zero(1e-12))
예제 #3
0
파일: test.py 프로젝트: bluescarni/audi
    def test_tanh(self):
        from pyaudi import gdual_double as gdual
        from pyaudi import sinh, cosh, tanh

        x = gdual(2.3, "x", 10)
        y = gdual(1.5, "y", 10)

        p1 = x + y
        self.assertTrue((tanh(p1) - sinh(p1) / cosh(p1)).is_zero(1e-12))
예제 #4
0
파일: test.py 프로젝트: darioizzo/audi
    def test_tanh(self):
        from pyaudi import gdual_double as gdual
        from pyaudi import sinh, cosh, tanh

        x = gdual(2.3, "x",10);
        y = gdual(1.5, "y",10);

        p1 = x + y;
        self.assertTrue((tanh(p1) - sinh(p1) / cosh(p1)).is_zero(1e-12))
예제 #5
0
파일: test.py 프로젝트: darioizzo/audi
    def test_sinh_and_cosh(self):
        from pyaudi import gdual_double as gdual
        from pyaudi import sinh, cosh, sinh_and_cosh
        x = gdual(2.3, "x",8);
        y = gdual(1.5, "y",8);

        p1 = x + y;

        self.assertTrue((sinh(2*p1) - 2 * sinh(p1) * cosh(p1)).is_zero(1e-12))
        self.assertTrue((cosh(2*p1) - 1 - 2*sinh(p1)*sinh(p1)).is_zero(1e-12))
        self.assertTrue((cosh(2*p1) + 1 - 2*cosh(p1)*cosh(p1)).is_zero(1e-12))
        self.assertTrue((cosh(2*p1) - cosh(p1)*cosh(p1) - sinh(p1) * sinh(p1)).is_zero(1e-12))
        self.assertTrue((- sinh(p1)*sinh(p1) + cosh(p1)*cosh(p1) - 1).is_zero(1e-12))

        res = sinh_and_cosh(p1);
        self.assertTrue((res[0] - sinh(p1)).is_zero(1e-12))
        self.assertTrue((res[1] - cosh(p1)).is_zero(1e-12))
예제 #6
0
파일: test.py 프로젝트: bluescarni/audi
def some_complex_irrational_f(x, y, z):
    from pyaudi import exp, log, cos, sin, tan, sqrt, cbrt, cos, sin, tan, acos, asin, atan, cosh, sinh, tanh, acosh, asinh, atanh
    from pyaudi import abs as gd_abs
    from pyaudi import sin_and_cos, sinh_and_cosh
    f = (x + y + z) / 10.
    retval = exp(f) + log(f) + f**2 + sqrt(f) + cbrt(f) + cos(f) + sin(f)
    retval += tan(f) + acos(f) + asin(f) + atan(f) + cosh(f) + sinh(f)
    retval += tanh(f) + acosh(f) + asinh(f) + atanh(f)
    a = sin_and_cos(f)
    b = sinh_and_cosh(f)
    retval += a[0] + a[1] + b[0] + b[1]
    return retval
예제 #7
0
파일: test.py 프로젝트: darioizzo/audi
def some_complex_irrational_f(x,y,z):
    from pyaudi import exp, log, cos, sin, tan, sqrt, cbrt, cos, sin, tan, acos, asin, atan, cosh, sinh, tanh, acosh, asinh, atanh
    from pyaudi import abs as gd_abs
    from pyaudi import sin_and_cos, sinh_and_cosh
    f = (x+y+z) / 10.
    retval = exp(f) + log(f) + f**2 + sqrt(f) + cbrt(f) + cos(f) + sin(f)
    retval += tan(f) + acos(f) + asin(f) + atan(f)  + cosh(f) + sinh(f)
    retval += tanh(f) + acosh(f) + asinh(f) + atanh(f)
    a = sin_and_cos(f)
    b = sinh_and_cosh(f)
    retval+=a[0]+a[1]+b[0]+b[1]
    return retval
예제 #8
0
파일: test.py 프로젝트: bluescarni/audi
    def test_sinh_and_cosh(self):
        from pyaudi import gdual_double as gdual
        from pyaudi import sinh, cosh, sinh_and_cosh
        x = gdual(2.3, "x", 8)
        y = gdual(1.5, "y", 8)

        p1 = x + y

        self.assertTrue(
            (sinh(2 * p1) - 2 * sinh(p1) * cosh(p1)).is_zero(1e-12))
        self.assertTrue(
            (cosh(2 * p1) - 1 - 2 * sinh(p1) * sinh(p1)).is_zero(1e-12))
        self.assertTrue(
            (cosh(2 * p1) + 1 - 2 * cosh(p1) * cosh(p1)).is_zero(1e-12))
        self.assertTrue((cosh(2 * p1) - cosh(p1) * cosh(p1) -
                         sinh(p1) * sinh(p1)).is_zero(1e-12))
        self.assertTrue(
            (-sinh(p1) * sinh(p1) + cosh(p1) * cosh(p1) - 1).is_zero(1e-12))

        res = sinh_and_cosh(p1)
        self.assertTrue((res[0] - sinh(p1)).is_zero(1e-12))
        self.assertTrue((res[1] - cosh(p1)).is_zero(1e-12))
예제 #9
0
 def do(self, x1, x2):
     import pyaudi as pd
     res = x1.sinh()
     assert (res == pd.sinh(x1))