def test_sqrt_numeric_value(): assert np.isclose(ef.sqrt(4), np.sqrt(4))
def test_sqrt_numeric_input_no_deriv(): with pytest.raises(AttributeError): assert ef.sqrt(30).der
def test_sqrt_illegal_arg2(): with pytest.raises(AttributeError): assert ef.sqrt(" ")
def test_sqrt_no_sec_derivative_xy(): x = AutoDiff(4, "x") y = AutoDiff(5, "y") with pytest.raises(AttributeError): assert ef.sqrt(x * x * y * y).der2['x']
def test_sqrt_no_sec_derivative(): x = AutoDiff(4, "x") with pytest.raises(AttributeError): assert ef.sqrt(x).der2['x']
def test_sqrt_deriv2_xy(): x = AutoDiff(1.5, "x", H=True) y = AutoDiff(2.5, "y", H=True) f = ef.sqrt(x * x * y * y) assert np.isclose(f.der2['xy'], 1.0)
def test_sqrt_deriv_y(): x = AutoDiff(1.5, "x") y = AutoDiff(2.5, "y") f = ef.sqrt(x * x * y * y) assert np.isclose(f.der['y'], 1.5)
def test_sqrt_val(): x = AutoDiff(1.5, "x") y = AutoDiff(2.5, "y") f = ef.sqrt(x * x * y * y) assert np.isclose(f.val, 3.75)