예제 #1
0
 def test_exponential_of_a_purely_real_number(self):
     input_number = ComplexNumber(1, 0)
     expected = ComplexNumber(math.e, 0)
     actual = input_number.exp()
     self.assertAlmostEqual(actual.real, expected.real)
     self.assertAlmostEqual(actual.imaginary, expected.imaginary)
예제 #2
0
 def test_exponential_of_a_number_with_real_and_imaginary_part(self):
     input_number = ComplexNumber(math.log(2), math.pi)
     expected = ComplexNumber(-2, 0)
     actual = input_number.exp()
     self.assertAlmostEqual(actual.real, expected.real)
     self.assertAlmostEqual(actual.imaginary, expected.imaginary)
 def test_exponential_of_0(self):
     input_number = ComplexNumber(0, 0)
     expected = ComplexNumber(1, 0)
     self.assertEqual(input_number.exp().real, expected.real)
     self.assertEqual(input_number.exp().imaginary, expected.imaginary)
예제 #4
0
 def test_eulers_identity_formula(self):
     input_number = ComplexNumber(0, math.pi)
     expected = ComplexNumber(-1, 0)
     actual = input_number.exp()
     self.assertAlmostEqual(actual.real, expected.real)
     self.assertAlmostEqual(actual.imaginary, expected.imaginary)
예제 #5
0
 def test_exponential_of_a_number_with_real_and_imaginary_part(self):
     input_number = ComplexNumber(math.log(2), math.pi)
     expected = ComplexNumber(-2, 0)
     actual = input_number.exp()
     self.assertAlmostEqual(actual.real, expected.real)
     self.assertAlmostEqual(actual.imaginary, expected.imaginary)
예제 #6
0
 def test_eulers_identity_formula(self):
     input_number = ComplexNumber(0, math.pi)
     expected = ComplexNumber(-1, 0)
     actual = input_number.exp()
     self.assertAlmostEqual(actual.real, expected.real)
     self.assertAlmostEqual(actual.imaginary, expected.imaginary)
예제 #7
0
 def test_exponential_of_a_purely_real_number(self):
     input_number = ComplexNumber(1, 0)
     expected = ComplexNumber(math.e, 0)
     self.assertEqual(expected.real, input_number.exp().real)
     self.assertEqual(expected.imaginary, input_number.exp().imaginary)
예제 #8
0
 def test_exponential_of_a_purely_real_number(self):
     input_number = ComplexNumber(1, 0)
     expected = ComplexNumber(math.e, 0)
     actual = input_number.exp()
     self.assertAlmostEqual(actual.real, expected.real)
     self.assertAlmostEqual(actual.imaginary, expected.imaginary)
예제 #9
0
 def test_eulers_identity_formula(self):
     input_number = ComplexNumber(0, math.pi)
     expected = ComplexNumber(-1, 0)
     self.assertEqual(expected.real, input_number.exp().real)
     self.assertEqual(expected.imaginary, input_number.exp().imaginary)
예제 #10
0
 def test_exponential_of_a_number_with_real_and_imaginary_part(self):
     input_number = ComplexNumber(math.log(2), math.pi)
     expected = ComplexNumber(-2, 0)
     self.assertEqual(input_number.exp(), expected)
예제 #11
0
 def test_exponential_of_a_purely_real_number(self):
     input_number = ComplexNumber(1, 0)
     expected = ComplexNumber(math.e, 0)
     self.assertEqual(input_number.exp(), expected)
예제 #12
0
 def test_exponential_of_0(self):
     input_number = ComplexNumber(0, 0)
     expected = ComplexNumber(1, 0)
     self.assertEqual(input_number.exp(), expected)
예제 #13
0
 def test_eulers_identity_formula(self):
     input_number = ComplexNumber(0, math.pi)
     expected = ComplexNumber(-1, 0)
     self.assertEqual(input_number.exp(), expected)