mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
@@ -2,6 +2,7 @@ import random
|
|||||||
import math
|
import math
|
||||||
import fractions
|
import fractions
|
||||||
|
|
||||||
|
|
||||||
from ..__init__ import *
|
from ..__init__ import *
|
||||||
|
|
||||||
from .addition import *
|
from .addition import *
|
||||||
@@ -96,3 +97,4 @@ from .differentiation import *
|
|||||||
from .definite_integral import *
|
from .definite_integral import *
|
||||||
from .is_prime import *
|
from .is_prime import *
|
||||||
from .bcd_to_decimal import *
|
from .bcd_to_decimal import *
|
||||||
|
from .complex_to_polar import *
|
||||||
|
|||||||
15
mathgenerator/funcs/complexToPolarFunc.py
Normal file
15
mathgenerator/funcs/complexToPolarFunc.py
Normal 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)
|
||||||
Reference in New Issue
Block a user