arithmetic complex
arithmetic complex
ALGORITHM:
PROGRAM :
import math
class Complex:
self.real = real
self.imag = imag
def conjugate(self):
def polarform(self):
r = (self.real**2 + self.imag**2)**0.5
conjugate = other.conjugate()
def __str__(self):
if self.imag >= 0:
else:
C1=Complex(3,6)
C2=Complex(2,-5)
print(C1.conjugate())
print(C2.conjugate())
print(C1.polarform())
print(C1+C2)
print(C1-C2)
print(C1*C2)
print(C1/C2)
print(C1)
print(C2)
OUTPUT:
C1.conjugate() = (3-6j)
C2.conjugate() = ( 2 + 5i )
C1 + C2 = ( 5 + 1i )
C1 - C2 = ( 1 + 11i )
C1 * C2 = ( 36 - 3i )
C1 / C2 = -0.8275862068965517 + 0.9310344827586207i
C1 = ( 3 + 6i )
C2 = ( 2 - 5i )
RESULT:
The arithmetic complex class using python program has been implemented successfully.