def test_ADmath_cosr(): f = ADmath.cos(4) assert f == np.cos(4)
def test_sinxcosx(): x = ADnum(0, der=1) f = ADmath.sin(x) * ADmath.cos(x) assert f.val == np.sin(0) * np.cos(0) assert f.der == -(np.sin(0)**2) + np.cos(0)**2
def test_ADmath_cos(): f = ADmath.cos(ADnum(4, der=1)) assert f.val == np.cos(4) assert f.der == -np.sin(4) assert len(f.graph) == 1