def test_ArcCos(): Test_Dual_Number_1 = DualNumber(0.5) assert EF.ArcCos(Test_Dual_Number_1).val == np.arccos(0.5) and EF.ArcCos(Test_Dual_Number_1).der == -1 / np.sqrt( 0.75) Test_Dual_Number_1 = 0.5 assert EF.ArcCos(Test_Dual_Number_1).val == np.arccos(0.5) and EF.ArcCos(Test_Dual_Number_1).der == 0 with pytest.raises(ValueError): x = DualNumber(5) EF.ArcCos(x)
def rm_test_ArcCos(): Test_Dual_Number_1 = DualNumber(0.5,Reverse=True) assert EF.ArcCos(Test_Dual_Number_1).val == np.arccos(0.5) and EF.ArcCos(Test_Dual_Number_1).der == 0