Beispiel #1
0
 def alpha():
     """
     This static method calculates the value of alpha
     :return:nothing
     """
     alpha = 2
     precision = 6
     pi = MathOperation.pi()
     calculated_decimal_places = 1
     for itr in range(0, precision):
         original = alpha - MathOperation.sin(alpha) - pi / 2
         prime = 1.0 - MathOperation.cos(alpha)
         alpha = alpha - (original / prime)
         if itr >= 1:
             calculated_decimal_places += 3 * (2**(itr - 1))
             if calculated_decimal_places > precision:
                 break
     return alpha
Beispiel #2
0
 def test_pi(self):
     """
     Test case for testing pi method
     :return:nothing
     """
     self.assertEqual(3.141592653589793, MathOperation.pi())