def test_arctan_s(s):
    def value(x):
        return math.atan(x)

    output = ad.arctan(s)
    assert output.value == pytest.approx(value(s))
    assert output.derivatives == {}
def test_arctan_sm(m):
    def value(x):
        return math.atan(x)

    output = ad.arctan(m)
    for i in range(len(m)):
        assert output.value[i] == pytest.approx(value(m[i]))
    assert output.derivatives == {}
def test_arctan_d(b):
    def value(x):
        return math.atan(x)

    def der(x):
        return 1 / (1 + x**2)

    output = ad.arctan(b)
    assert output.value == pytest.approx(value(b.value))
    coef = der(b.value)
    assert output.derivatives == pytest.approx({
        'x': coef * 1.2,
        'y': coef * 9.5,
        'z': coef * 5
    })
def test_arctan_dm(dm):
    def value(x):
        return math.atan(x)

    def der(x):
        return 1 / (1 + x**2)

    output = ad.arctan(dm)
    for i in range(len(dm.value)):
        assert output.value[i] == pytest.approx(value(dm.value[i]))
        coef = der(dm.value[i])
        assert output.derivatives['x'][i] == pytest.approx(
            coef * dm.derivatives['x'][i])
        assert output.derivatives['y'][i] == pytest.approx(
            coef * dm.derivatives['y'][i])
        assert output.derivatives['z'][i] == pytest.approx(
            coef * dm.derivatives['z'][i])
def test_arctan_no_change(b):
    b_d = b.derivatives
    output = ad.arctan(b)
    assert b_d == b.derivatives