From 9fd4a23815bafeba69308dfbd3dbbdf3711de06b Mon Sep 17 00:00:00 2001 From: adit098 Date: Mon, 19 Oct 2020 20:20:38 +0530 Subject: [PATCH 1/8] fix #242 --- mathgenerator/funcs/DecimalToHexFunc.py | 11 +++++++++++ mathgenerator/mathgen.py | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 mathgenerator/funcs/DecimalToHexFunc.py diff --git a/mathgenerator/funcs/DecimalToHexFunc.py b/mathgenerator/funcs/DecimalToHexFunc.py new file mode 100644 index 0000000..33945d3 --- /dev/null +++ b/mathgenerator/funcs/DecimalToHexFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def DecimalToHexFunc(max_dec=99): + a = random.randint(1, max_dec) + b = hex(a).replace("0x", "") + + problem = "Hexadecimal of " + str(a) + "=" + solution = str(b) + + return problem, solution diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 0e813a6..e935df8 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -156,3 +156,5 @@ complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + geometricprogression=Generator("Geometric Progression", 65, "Initial value,Common Ratio,nth Term,Sum till nth term =", "a,r,ar^n-1,sum(ar^n-1", geomProgrFunc) geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) +decimalToHexadecimal = Generator("Decimal to Hexadecimal", 68, + "Hexadecimal of a=", "b", DecimalToHexFunc) \ No newline at end of file From 9a62fbc6b8e05709e61f1395e2733bb7d82b1643 Mon Sep 17 00:00:00 2001 From: adit098 Date: Mon, 19 Oct 2020 21:33:02 +0530 Subject: [PATCH 2/8] fix #250 --- mathgenerator/funcs/DegreeToRadian.py | 10 ++++++++++ mathgenerator/mathgen.py | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 mathgenerator/funcs/DegreeToRadian.py diff --git a/mathgenerator/funcs/DegreeToRadian.py b/mathgenerator/funcs/DegreeToRadian.py new file mode 100644 index 0000000..ce1389e --- /dev/null +++ b/mathgenerator/funcs/DegreeToRadian.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def DegreeToRadian(maxAngle=360): + angle = random.randint(1, maxAngle) + radian = round(math.radians(angle), 2) + problem = f"{angle} Degrees is equal to Radian = " + solution = radian + + return problem, solution \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index e935df8..4fca697 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -157,4 +157,5 @@ geometricprogression=Generator("Geometric Progression", 65, "Initial value,Commo geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n numbers A1 , A2 , ... , An = ","(A1*A2*...An)^(1/n) = ans",geometricMeanFunc) harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) decimalToHexadecimal = Generator("Decimal to Hexadecimal", 68, - "Hexadecimal of a=", "b", DecimalToHexFunc) \ No newline at end of file + "Hexadecimal of a=", "b", DecimalToHexFunc) +degreeToRadian = Generator("Degree To Radian", 69, "Radian of angle=", "radian", DegreeToRadian) \ No newline at end of file From 57456ca1ad34b3c76acfb8c1efaf1626bd06c70e Mon Sep 17 00:00:00 2001 From: adit098 Date: Mon, 19 Oct 2020 21:44:18 +0530 Subject: [PATCH 3/8] fix #252 --- mathgenerator/funcs/DecimalToOctalFunc.py | 11 +++++++++++ mathgenerator/funcs/__init__.py | 2 ++ mathgenerator/mathgen.py | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 mathgenerator/funcs/DecimalToOctalFunc.py diff --git a/mathgenerator/funcs/DecimalToOctalFunc.py b/mathgenerator/funcs/DecimalToOctalFunc.py new file mode 100644 index 0000000..703ef45 --- /dev/null +++ b/mathgenerator/funcs/DecimalToOctalFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + + +def DecimalToHexFunc(max_dec=99): + a = random.randint(1, max_dec) + b = oct(a) + + problem = "Octal of " + str(a) + "=" + solution = str(b) + + return problem, solution diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index efb1ce7..d9e880a 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -71,3 +71,5 @@ from .multiplyComplexNumbersFunc import * from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * +from .DegreeToRadian import * +from .DecimalToOctal import * \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 4fca697..2d2697d 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -158,4 +158,6 @@ geometricMean=Generator("Geometric Mean of N Numbers",66,"Geometric mean of n nu harmonicMean=Generator("Harmonic Mean of N Numbers",67,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc) decimalToHexadecimal = Generator("Decimal to Hexadecimal", 68, "Hexadecimal of a=", "b", DecimalToHexFunc) -degreeToRadian = Generator("Degree To Radian", 69, "Radian of angle=", "radian", DegreeToRadian) \ No newline at end of file +degreeToRadian = Generator("Degree To Radian", 69, "Radian of angle=", "radian", DegreeToRadian) +decimalToOctal = Generator("Decimal to Octal", 70, + "Octal of a=", "b", DecimalToOctalFunc) \ No newline at end of file From 090afdd4517ed2108a76eb9caea35dc5bec0d2d4 Mon Sep 17 00:00:00 2001 From: adit098 Date: Mon, 19 Oct 2020 22:29:03 +0530 Subject: [PATCH 4/8] fix #251 --- mathgenerator/funcs/__init__.py | 3 ++- mathgenerator/funcs/complexToPolarFunc.py | 13 +++++++++++++ mathgenerator/mathgen.py | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 mathgenerator/funcs/complexToPolarFunc.py diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index d9e880a..c4aa137 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -72,4 +72,5 @@ from .geomProgrFunc import * from .geometricMeanFunc import * from .harmonicMeanFunc import * from .DegreeToRadian import * -from .DecimalToOctal import * \ No newline at end of file +from .DecimalToOctal import * +from .complexToPolarFunc import * \ No newline at end of file diff --git a/mathgenerator/funcs/complexToPolarFunc.py b/mathgenerator/funcs/complexToPolarFunc.py new file mode 100644 index 0000000..ddc86ff --- /dev/null +++ b/mathgenerator/funcs/complexToPolarFunc.py @@ -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 + \ No newline at end of file diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 2d2697d..5701317 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -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) \ No newline at end of file + "Octal of a=", "b", DecimalToOctalFunc) +complexToPolar = Generator("Complex To Polar Form", 71, "rexp(itheta) = ", "plr", complexToPolarFunc) \ No newline at end of file From 85286449a577980bcd2f5595c1f1457754963673 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Wed, 21 Oct 2020 14:08:25 -0400 Subject: [PATCH 5/8] Delete DegreeToRadian.py --- mathgenerator/funcs/DegreeToRadian.py | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 mathgenerator/funcs/DegreeToRadian.py diff --git a/mathgenerator/funcs/DegreeToRadian.py b/mathgenerator/funcs/DegreeToRadian.py deleted file mode 100644 index ce1389e..0000000 --- a/mathgenerator/funcs/DegreeToRadian.py +++ /dev/null @@ -1,10 +0,0 @@ -from .__init__ import * - - -def DegreeToRadian(maxAngle=360): - angle = random.randint(1, maxAngle) - radian = round(math.radians(angle), 2) - problem = f"{angle} Degrees is equal to Radian = " - solution = radian - - return problem, solution \ No newline at end of file From 9c8ee7ee6491d2f2c11c8402d8c9b0a8ed719235 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Wed, 21 Oct 2020 14:08:32 -0400 Subject: [PATCH 6/8] Delete DecimalToHexFunc.py --- mathgenerator/funcs/DecimalToHexFunc.py | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 mathgenerator/funcs/DecimalToHexFunc.py diff --git a/mathgenerator/funcs/DecimalToHexFunc.py b/mathgenerator/funcs/DecimalToHexFunc.py deleted file mode 100644 index 33945d3..0000000 --- a/mathgenerator/funcs/DecimalToHexFunc.py +++ /dev/null @@ -1,11 +0,0 @@ -from .__init__ import * - - -def DecimalToHexFunc(max_dec=99): - a = random.randint(1, max_dec) - b = hex(a).replace("0x", "") - - problem = "Hexadecimal of " + str(a) + "=" - solution = str(b) - - return problem, solution From 29b2a6467d2f3fde1f800d70cf9eda7b00da0258 Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Wed, 21 Oct 2020 14:08:40 -0400 Subject: [PATCH 7/8] Delete DecimalToOctalFunc.py --- mathgenerator/funcs/DecimalToOctalFunc.py | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 mathgenerator/funcs/DecimalToOctalFunc.py diff --git a/mathgenerator/funcs/DecimalToOctalFunc.py b/mathgenerator/funcs/DecimalToOctalFunc.py deleted file mode 100644 index 703ef45..0000000 --- a/mathgenerator/funcs/DecimalToOctalFunc.py +++ /dev/null @@ -1,11 +0,0 @@ -from .__init__ import * - - -def DecimalToHexFunc(max_dec=99): - a = random.randint(1, max_dec) - b = oct(a) - - problem = "Octal of " + str(a) + "=" - solution = str(b) - - return problem, solution From 22edff6736a2098346a02501b1add4f5418b94cb Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Wed, 21 Oct 2020 14:10:45 -0400 Subject: [PATCH 8/8] Update complexToPolarFunc.py --- mathgenerator/funcs/complexToPolarFunc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/complexToPolarFunc.py b/mathgenerator/funcs/complexToPolarFunc.py index ddc86ff..2685d9c 100644 --- a/mathgenerator/funcs/complexToPolarFunc.py +++ b/mathgenerator/funcs/complexToPolarFunc.py @@ -1,6 +1,6 @@ from .__init__ import * -def polar(minRealImaginaryNum = -20, maxRealImaginaryNum = 20): +def complexToPolarFunc(minRealImaginaryNum = -20, maxRealImaginaryNum = 20): num = complex(random.randint(minRealImaginaryNum, maxRealImaginaryNum), random.randint(minRealImaginaryNum, maxRealImaginaryNum)) a= num.real b= num.imag @@ -10,4 +10,6 @@ def polar(minRealImaginaryNum = -20, maxRealImaginaryNum = 20): problem = f"rexp(itheta) = " solution = plr return problem, solution - \ No newline at end of file + + +complex_to_polar = Generator("Complex To Polar Form", 92, "rexp(itheta) = ", "plr", complexToPolarFunc)