Пример #1
0
def test_vector_values3():
    AD1 = AutoDiff(2, [3, 5])
    AD2 = AutoDiff.cos(AD1)
    assert AD2.val == np.cos(2)
    assert all(AD2.der == [-3 * np.sin(2), -5 * np.sin(2)])
Пример #2
0
def test_cos():
    AD1 = AutoDiff(2, 3)
    AD2 = AutoDiff.cos(AD1)
    assert AD2.val == np.cos(2)
    assert AD2.der == -3 * np.sin(2)