mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
fix #251
This commit is contained in:
@@ -72,4 +72,5 @@ from .geomProgrFunc import *
|
||||
from .geometricMeanFunc import *
|
||||
from .harmonicMeanFunc import *
|
||||
from .DegreeToRadian import *
|
||||
from .DecimalToOctal import *
|
||||
from .DecimalToOctal import *
|
||||
from .complexToPolarFunc import *
|
||||
13
mathgenerator/funcs/complexToPolarFunc.py
Normal file
13
mathgenerator/funcs/complexToPolarFunc.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from .__init__ import *
|
||||
|
||||
def polar(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
|
||||
|
||||
@@ -160,4 +160,5 @@ decimalToHexadecimal = Generator("Decimal to Hexadecimal", 68,
|
||||
"Hexadecimal of a=", "b", DecimalToHexFunc)
|
||||
degreeToRadian = Generator("Degree To Radian", 69, "Radian of angle=", "radian", DegreeToRadian)
|
||||
decimalToOctal = Generator("Decimal to Octal", 70,
|
||||
"Octal of a=", "b", DecimalToOctalFunc)
|
||||
"Octal of a=", "b", DecimalToOctalFunc)
|
||||
complexToPolar = Generator("Complex To Polar Form", 71, "rexp(itheta) = ", "plr", complexToPolarFunc)
|
||||
Reference in New Issue
Block a user