def test_int_mid_rect_20(self): self.assertEqual(int_mid_rect(0, 0, 100000), 0)
if a < -1 or a > 0.999999999: print("You entered wrong data\n") else: break except ValueError: print("You entered wrong data\n") while 1: try: b = float(input("Enter higher border of the integral (from -0.999999999 to 1): ")) if b < -0.999999999 or b > 1: print("You entered wrong data\n") elif b < a: print("Higher border can`t be less than lower border. Please, repeat entering of the higher border of the integral:\n") else: break except ValueError: print("You entered wrong data\n") while 1: try: n = int(input("Enter number of grid intervals (from 10 to 1000000): ")) if n < 10 or n > 1000000: print("You entered wrong data\n") else: break except ValueError: print("You entered wrong data\n") print("\nResult of the integral x*arcsin(x) from", a, " to ", b," equals ", int_mid_rect(a, b, n))
def test_int_mid_rect_10(self): self.assertEqual(int_mid_rect(0, 0.9, 1000), 0.27163939357734845)
def test_int_mid_rect_70(self): self.assertEqual(int_mid_rect(0.999999999, 1, 10), 1.5707663905513454e-09)
def test_int_mid_rect_50(self): self.assertEqual(int_mid_rect(-1, 0, 100000), 0.39269907896918677)
def test_int_mid_rect_40(self): self.assertEqual(int_mid_rect(-1, 1, 1000), 0.7853822437404907)
def test_int_mid_rect_30(self): self.assertEqual(int_mid_rect(0, 0.5, 10), 0.0426886755045163)