def test_cosh_types(): with pytest.raises(TypeError): ef.cosh('x') with pytest.raises(TypeError): ef.cosh("1234")
def test_cosh_results(): X = AutoDiff(0.5, 2) f = ef.cosh(X) assert f.val == np.cosh(0.5) assert f.der == np.array([[np.sinh(0.5)*2]]) assert f.jacobian == np.array([[np.sinh(0.5)*1]])
def test_cosh_constant_results(): a = ef.cosh(0.5) assert a == np.cosh(0.5)
def test_cosh_results(): X = Dual(0.5, 2) f = ef.cosh(X) assert f.Real == np.cosh(0.5) assert f.Dual == np.array([[np.sinh(0.5) * 2]])