Commit 3c8d7e77 authored by BITTU KUMAR's avatar BITTU KUMAR

Adding

parent e803c84b
...@@ -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):
...@@ -101,6 +103,7 @@ def conj(comp): ...@@ -101,6 +103,7 @@ def conj(comp):
return comp return comp
def mag(comp): def mag(comp):
return (comp.x**2+comp.y**2)**(0.5) return (comp.x**2+comp.y**2)**(0.5)
...@@ -108,3 +111,6 @@ def mag(comp): ...@@ -108,3 +111,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