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
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
def test_sin_and_cos(self): from pyaudi import gdual_double as gdual from pyaudi import sin, cos, sin_and_cos x = gdual(2.3, "x",8); y = gdual(1.5, "y",8); p1 = x + y; self.assertTrue((sin(2*p1) - 2 * sin(p1) * cos(p1)).is_zero(1e-12)) self.assertTrue((cos(2*p1) - 1 + 2*sin(p1)*sin(p1)).is_zero(1e-12)) self.assertTrue((cos(2*p1) + 1 - 2*cos(p1)*cos(p1)).is_zero(1e-12)) self.assertTrue((cos(2*p1) - cos(p1)*cos(p1) + sin(p1) * sin(p1)).is_zero(1e-12)) self.assertTrue((sin(p1)*sin(p1) + cos(p1)*cos(p1) - 1).is_zero(1e-12)) res = sin_and_cos(p1); self.assertTrue((res[0] - sin(p1)).is_zero(1e-12)) self.assertTrue((res[1] - cos(p1)).is_zero(1e-12))
def test_sin_and_cos(self): from pyaudi import gdual_double as gdual from pyaudi import sin, cos, sin_and_cos x = gdual(2.3, "x", 8) y = gdual(1.5, "y", 8) p1 = x + y self.assertTrue((sin(2 * p1) - 2 * sin(p1) * cos(p1)).is_zero(1e-12)) self.assertTrue( (cos(2 * p1) - 1 + 2 * sin(p1) * sin(p1)).is_zero(1e-12)) self.assertTrue( (cos(2 * p1) + 1 - 2 * cos(p1) * cos(p1)).is_zero(1e-12)) self.assertTrue((cos(2 * p1) - cos(p1) * cos(p1) + sin(p1) * sin(p1)).is_zero(1e-12)) self.assertTrue( (sin(p1) * sin(p1) + cos(p1) * cos(p1) - 1).is_zero(1e-12)) res = sin_and_cos(p1) self.assertTrue((res[0] - sin(p1)).is_zero(1e-12)) self.assertTrue((res[1] - cos(p1)).is_zero(1e-12))