Ejemplo n.º 1
0
    def test_sin(self):
        """
        Test case for  testing sin method
        :return:nothing
        """

        self.assertEqual(0.8414709848078965, MathOperation.sin(1.0))
Ejemplo n.º 2
0
 def get_length(radius):
     """
     This static method calculates the length based on the value of alpha
     :param radius:
     :return:float length
     """
     Solution.set_alpha()
     return 2.0 * radius * (1.0 -
                            MathOperation.cos(Solution.get_alpha() / 2))
Ejemplo n.º 3
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
Ejemplo n.º 4
0
 def test_pi(self):
     """
     Test case for testing pi method
     :return:nothing
     """
     self.assertEqual(3.141592653589793, MathOperation.pi())
Ejemplo n.º 5
0
 def test_cos_negative_value(self):
     """
     Test case for testing cos method against negative value
     :return:nothing
     """
     self.assertEqual(0.5403023058681398, MathOperation.cos(-1.0))
Ejemplo n.º 6
0
 def test_cos(self):
     """
     Test case for testing cos method
     :return:nothing
     """
     self.assertEqual(0.5403023058681398, MathOperation.cos(1.0))
Ejemplo n.º 7
0
 def test_negative_sin(self):
     """
     Test Case for testing sin method against a negative value
     :return:nothing
     """
     self.assertEqual(-0.8414709848078965, MathOperation.sin(-1.0))