def test_arcsin_numeric_input_no_deriv(): with pytest.raises(AttributeError): assert ef.arcsin(-0.2).der
def test_cos_deriv_y(): x = AutoDiff(4, "x") y = AutoDiff(5, "y") f = ef.cos(x * y) assert np.isclose(f.der['y'], -3.6517810029105107)
def test_arctan_numeric_value(): assert np.isclose(ef.arctan(4), np.arctan(4))
def test_arctan_deriv2_y(): x = AutoDiff(0.5, "x", H=True) y = AutoDiff(0.6, "y", H=True) f = ef.arctan(x * x * y * y) assert np.isclose(f.der2['y'], 0.480041826860598)
def test_arctan_no_sec_derivative_xy(): x = AutoDiff(4, "x") y = AutoDiff(5, "y") with pytest.raises(AttributeError): assert ef.arctan(x * x * y * y).der2['x']
def test_sin_val(): x = AutoDiff(4, "x") y = AutoDiff(5, "y") f = ef.sin(x * y) assert np.isclose(f.val, 0.9129452507276277)
def test_arctan_deriv_y(): x = AutoDiff(0.5, "x") y = AutoDiff(0.6, "y") f = ef.arctan(x * x * y * y) assert np.isclose(f.der['y'], 0.2975895248487253)
def test_arccos_deriv_y(): x = AutoDiff(0.5, "x") y = AutoDiff(0.6, "y") f = ef.arccos(x * x * y * y) assert np.isclose(f.der['y'], -0.30122243130330484)
def test_arccos_deriv2_x(): x = AutoDiff(0.5, "x", H=True) y = AutoDiff(0.6, "y", H=True) f = ef.arccos(x * x * y * y) assert np.isclose(f.der2['x'], -0.7347410013030223)
def test_cos_val(): x = AutoDiff(4, "x") y = AutoDiff(5, "y") f = ef.cos(x * y) assert np.isclose(f.val, 0.40808206181339196)
def test_arccos_deriv_x(): x = AutoDiff(0.5, "x") y = AutoDiff(0.6, "y") f = ef.arccos(x * x * y * y) assert np.isclose(f.der['x'], -0.3614669175639658)
def test_arccos_val(): x = AutoDiff(0.5, "x") y = AutoDiff(0.6, "y") f = ef.arccos(x * x * y * y) assert np.isclose(f.val, 1.4806743817803012)
def test_arccos_val_error(): x = AutoDiff(1.1, "x") y = AutoDiff(2.2, "y") with pytest.warns(RuntimeWarning): assert ef.arccos(x * x * y * y)
def test_arcsin_numeric_value(): assert np.isclose(ef.arcsin(0.2), np.arcsin(0.2))
def test_cos_deriv_x(): x = AutoDiff(4, "x") y = AutoDiff(5, "y") f = ef.cos(x * y) assert np.isclose(f.der['x'], -4.564726253638138)
def test_arccos_deriv2_y(): x = AutoDiff(0.5, "x", H=True) y = AutoDiff(0.6, "y", H=True) f = ef.arccos(x * x * y * y) assert np.isclose(f.der2['y'], -0.5102368064604322)
def test_arctan_val(): x = AutoDiff(0.5, "x") y = AutoDiff(0.6, "y") f = ef.arctan(x * x * y * y) assert np.isclose(f.val, 0.08975817418995052)
def test_arccos_deriv2_xy(): x = AutoDiff(0.5, "x", H=True) y = AutoDiff(0.6, "y", H=True) f = ef.arccos(x * x * y * y) assert np.isclose(f.der2['xy'], -1.2147290303591283)
def test_arctan_deriv_x(): x = AutoDiff(0.5, "x") y = AutoDiff(0.6, "y") f = ef.arctan(x * x * y * y) assert np.isclose(f.der['x'], 0.3571074298184704)
def test_arccos_no_sec_derivative_(): x = AutoDiff(0.2, "x") with pytest.raises(AttributeError): assert ef.arccos(x).der2['x']
def test_arctan_deriv2_x(): x = AutoDiff(0.5, "x", H=True) y = AutoDiff(0.6, "y", H=True) f = ef.arctan(x * x * y * y) assert np.isclose(f.der2['x'], 0.6912602306792611)
def test_arccos_no_sec_derivative_xy(): x = AutoDiff(0.1, "x") y = AutoDiff(0.3, "y") with pytest.raises(AttributeError): assert ef.arccos(x * x * y * y).der2['x']
def test_arctan_deriv2_xy(): x = AutoDiff(0.5, "x", H=True) y = AutoDiff(0.6, "y", H=True) f = ef.arctan(x * x * y * y) assert np.isclose(f.der2['xy'], 1.1712292419301682)
def test_arccos_numeric_input_no_val(): with pytest.raises(AttributeError): assert ef.arccos(0).val
def test_arctan_numeric_input_no_deriv(): with pytest.raises(AttributeError): assert ef.arctan(30).der
def test_arccos_numeric_input_no_deriv(): with pytest.raises(AttributeError): assert ef.arccos(-0.9).der
def test_arctan_illegal_arg(): with pytest.raises(AttributeError): assert ef.arctan("thirty")
def test_arccos_numeric_value(): assert np.isclose(ef.arccos(0.4), np.arccos(0.4))
def test_autodiff_eq(): a = AutoDiff(2, "a") b = AutoDiff(4, "b") assert ef.power(a, 2).val == b.val
def test_arcsin_numeric_input_no_val(): with pytest.raises(AttributeError): assert ef.arcsin(0.2).val