diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 4e4a1960..fb8def96 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -77,4 +77,7 @@ from .vectorDotFunc import * from .binary2sComplement import * from .matrixInversion import * -from .binaryToHexaFunction import * +from .sectorAreaFunc import* +from .meanMedianFunc import* +from .determinantToMatrix22 import * +from .deciToHexaFunc import * diff --git a/mathgenerator/funcs/deciToHexaFunc.py b/mathgenerator/funcs/deciToHexaFunc.py new file mode 100644 index 00000000..a815e344 --- /dev/null +++ b/mathgenerator/funcs/deciToHexaFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + + +def deciToHexaFunc(max_dec=1000): + a = random.randint(0, max_dec) + b = hex(a) + problem = "Binary of " + str(a) + "=" + solution = str(b) + + return problem, solution diff --git a/mathgenerator/funcs/determinantToMatrix22.py b/mathgenerator/funcs/determinantToMatrix22.py new file mode 100644 index 00000000..a92ac763 --- /dev/null +++ b/mathgenerator/funcs/determinantToMatrix22.py @@ -0,0 +1,12 @@ +from .__init__ import * + +def determinantToMatrix22(maxMatrixVal = 100): + a = random.randint(0, maxMatrixVal) + b = random.randint(0, maxMatrixVal) + c = random.randint(0, maxMatrixVal) + d = random.randint(0, maxMatrixVal) + + determinant = a*d - b*c + problem = f"Det([[{a}, {b}], [{c}, {d}]]) = " + solution = f" {determinant}" + return problem, solution diff --git a/mathgenerator/funcs/meanMedianFunc.py b/mathgenerator/funcs/meanMedianFunc.py new file mode 100644 index 00000000..f1d2596e --- /dev/null +++ b/mathgenerator/funcs/meanMedianFunc.py @@ -0,0 +1,13 @@ +from .__init__ import * + +def meanMedianFunc(maxlen = 10): + randomlist = random.sample(range(1, 99), maxlen) + total = 0 + for n in randomlist: + total = total + n + mean = total/10 + problem = f"Given the series of numbers {randomlist}. find the arithmatic mean and mdian of the series" + randomlist.sort() + median = (randomlist[4]+randomlist[5])/2 + solution = f"Arithmetic mean of the series is {mean} and Arithmetic median of this series is {median}" + return problem, solution diff --git a/mathgenerator/funcs/sectorAreaFunc.py b/mathgenerator/funcs/sectorAreaFunc.py new file mode 100644 index 00000000..6130ad0c --- /dev/null +++ b/mathgenerator/funcs/sectorAreaFunc.py @@ -0,0 +1,10 @@ +from .__init__ import * + +def sectorAreaFunc(maxRadius = 49,maxAngle = 359): + Radius = random.randint(1, maxRadius) + Angle = random.randint(1, maxAngle) + problem = f"Given radius, {Radius} and angle, {Angle}. Find the area of the sector." + secArea = float((Angle / 360) * math.pi*Radius*Radius) + formatted_float = "{:.5f}".format(secArea) + solution = f"Area of sector = {formatted_float}" + return problem, solution diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 3bf1417a..9f570ccf 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -108,4 +108,9 @@ def getGenList(): absoluteDifference=Generator("Absolute difference between two numbers", 71, "Absolute difference betweeen two numbers a and b =", "|a-b|", absoluteDifferenceFunc) vectorDot = Generator("Dot Product of 2 Vectors", 72, "a . b = ", "c", vectorDotFunc) binary2sComplement = Generator("Binary 2's Complement", 73, "2's complement of 11010110 =", "101010", binary2sComplementFunc) -invertmatrix = Generator("Inverse of a Matrix", 74, "Inverse of a matrix A is", "A^(-1)", matrixInversion) \ No newline at end of file +invertmatrix = Generator("Inverse of a Matrix", 74, "Inverse of a matrix A is", "A^(-1)", matrixInversion) +sectorArea=Generator("Area of a Sector", 75,"Area of a sector with radius, r and angle, a ","Area",sectorAreaFunc) +meanMedian=Generator("Mean and Median", 76,"Mean and median of given set of numbers","Mean, Median",meanMedianFunc) +intMatrix22determinant = Generator("Determinant to 2x2 Matrix", 77, "Det([[a,b],[c,d]]) =", " a * d - b * c", determinantToMatrix22) +compoundInterest = Generator("Compound Interest", 78, "Compound interest for a principle amount of p dollars, r% rate of interest and for a time period of t years with n times compounded annually is = ", "A dollars", compoundInterestFunc) +decimalToHexadeci = Generator("Decimal to Hexadecimal", 79,"Binary of a=", "b", deciToHexaFunc) diff --git a/setup.py b/setup.py index 0b546c2e..8a88d213 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,7 @@ license='MIT', packages=find_packages(), install_requires=[ + ], entry_points={ }