def test_hyper_as_trig(): from sympy.simplify.fu import _osborne as o, _osbornei as i, TR12 eq = sinh(x)**2 + cosh(x)**2 t, f = hyper_as_trig(eq) assert f(fu(t)) == cosh(2 * x) e, f = hyper_as_trig(tanh(x + y)) assert f(TR12(e)) == (tanh(x) + tanh(y)) / (tanh(x) * tanh(y) + 1) d = Dummy() assert o(sinh(x), d) == I * sin(x * d) assert o(tanh(x), d) == I * tan(x * d) assert o(coth(x), d) == cot(x * d) / I assert o(cosh(x), d) == cos(x * d) assert o(sech(x), d) == sec(x * d) assert o(csch(x), d) == csc(x * d) / I for func in (sinh, cosh, tanh, coth, sech, csch): h = func(pi) assert i(o(h, d), d) == h # /!\ the _osborne functions are not meant to work # in the o(i(trig, d), d) direction so we just check # that they work as they are supposed to work assert i(cos(x * y + z), y) == cosh(x + z * I) assert i(sin(x * y + z), y) == sinh(x + z * I) / I assert i(tan(x * y + z), y) == tanh(x + z * I) / I assert i(cot(x * y + z), y) == coth(x + z * I) * I assert i(sec(x * y + z), y) == sech(x + z * I) assert i(csc(x * y + z), y) == csch(x + z * I) * I
def test_hyper_as_trig(): from sympy.simplify.fu import _osborne as o, _osbornei as i, TR12 eq = sinh(x)**2 + cosh(x)**2 t, f = hyper_as_trig(eq) assert f(fu(t)) == cosh(2*x) e, f = hyper_as_trig(tanh(x + y)) assert f(TR12(e)) == (tanh(x) + tanh(y))/(tanh(x)*tanh(y) + 1) d = Dummy() assert o(sinh(x), d) == I*sin(x*d) assert o(tanh(x), d) == I*tan(x*d) assert o(coth(x), d) == cot(x*d)/I assert o(cosh(x), d) == cos(x*d) for func in (sinh, cosh, tanh, coth): h = func(pi) assert i(o(h, d), d) == h # /!\ the _osborne functions are not meant to work # in the o(i(trig, d), d) direction so we just check # that they work as they are supposed to work assert i(cos(x*y), y) == cosh(x) assert i(sin(x*y), y) == sinh(x)/I assert i(tan(x*y), y) == tanh(x)/I assert i(cot(x*y), y) == coth(x)*I assert i(sec(x*y), y) == 1/cosh(x) assert i(csc(x*y), y) == I/sinh(x)