Commit 91b9327f authored by BITTU KUMAR's avatar BITTU KUMAR

Merge branch 'representation'

parents 26d49985 3c8d7e77
...@@ -13,6 +13,8 @@ class ComplexNumber: ...@@ -13,6 +13,8 @@ class ComplexNumber:
return "({0}+i{1})".format(comp.x,comp.y) return "({0}+i{1})".format(comp.x,comp.y)
def __repr__(comp):
return ('str(comp.x)'" + i"'str(comp.y)')
def __add__(comp,other): def __add__(comp,other):
if (type(other) is ComplexNumber): if (type(other) is ComplexNumber):
...@@ -103,6 +105,7 @@ def conj(comp): ...@@ -103,6 +105,7 @@ def conj(comp):
def mysquare(comp): def mysquare(comp):
return comp**2 return comp**2
def mag(comp): def mag(comp):
return (comp.x**2+comp.y**2)**(0.5) return (comp.x**2+comp.y**2)**(0.5)
...@@ -110,3 +113,6 @@ def mag(comp): ...@@ -110,3 +113,6 @@ def mag(comp):
from complexno import ComplexNumber
def myexponent(x):
epowx=1
m=1
for i in range(1,100):
m*=x/i
epowx+=m
return epowx
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment