def test_arccos_illegal_arg(): with pytest.raises(AttributeError): assert ef.arccos("thirty")
def test_arccos_numeric_value(): assert np.isclose(ef.arccos(0.4), np.arccos(0.4))
def test_arccos_numeric_input_no_val(): with pytest.raises(AttributeError): assert ef.arccos(0).val
def test_arccos_numeric_input_no_deriv(): with pytest.raises(AttributeError): assert ef.arccos(-0.9).der
def test_arccos_no_sec_derivative_(): x = AutoDiff(0.2, "x") with pytest.raises(AttributeError): assert ef.arccos(x).der2['x']
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_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_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_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_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_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)