Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 12
0
 def test_exponential_of_0(self):
     input_number = ComplexNumber(0, 0)
     expected = ComplexNumber(1, 0)
     self.assertEqual(input_number.exp(), expected)
Exemplo n.º 13
0
 def test_eulers_identity_formula(self):
     input_number = ComplexNumber(0, math.pi)
     expected = ComplexNumber(-1, 0)
     self.assertEqual(input_number.exp(), expected)