Merge pull request #254 from adit098/master

fix #250
This commit is contained in:
Luke Weiler
2020-10-21 14:10:54 -04:00
committed by GitHub
2 changed files with 17 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import random
import math
import fractions
from ..__init__ import *
from .addition import *
@@ -96,3 +97,4 @@ from .differentiation import *
from .definite_integral import *
from .is_prime import *
from .bcd_to_decimal import *
from .complex_to_polar import *

View File

@@ -0,0 +1,15 @@
from .__init__ import *
def complexToPolarFunc(minRealImaginaryNum = -20, maxRealImaginaryNum = 20):
num = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum), random.randint(minRealImaginaryNum, maxRealImaginaryNum))
a= num.real
b= num.imag
r = round(math.hypot(a,b), 2)
theta = round(math.atan2(b,a), 2)
plr = str(r) + "exp(i" + str(theta) + ")"
problem = f"rexp(itheta) = "
solution = plr
return problem, solution
complex_to_polar = Generator("Complex To Polar Form", 92, "rexp(itheta) = ", "plr", complexToPolarFunc)