コード例 #1
0
def test_ADmath_cosr():
    f = ADmath.cos(4)
    assert f == np.cos(4)
コード例 #2
0
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
コード例 #3
0
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