diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 4bfd99e..fb8def9 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -80,3 +80,4 @@ from .matrixInversion import * from .sectorAreaFunc import* from .meanMedianFunc import* from .determinantToMatrix22 import * +from .deciToHexaFunc import * diff --git a/mathgenerator/funcs/compoundInterestFunc.py b/mathgenerator/funcs/compoundInterestFunc.py new file mode 100644 index 0000000..dec3e54 --- /dev/null +++ b/mathgenerator/funcs/compoundInterestFunc.py @@ -0,0 +1,11 @@ +from .__init__ import * + +def compoundInterestFunc(maxPrinciple = 10000, maxRate = 10, maxTime = 10, maxPeriod = ): + p = random.randint(100, maxPrinciple) + r = random.randint(1, maxRate) + t = random.randint(1, maxTime) + n = random.randint(1, maxPeriod) + A = p * ((1 + (r/(100*n))**(n*t))) + problem = "Compound Interest for a principle amount of " + str(p) + " dollars, " + str(r) + "% rate of interest and for a time period of " + str(t) + " compounded monthly is = " + solution = round(A, 2) + return problem, solution diff --git a/mathgenerator/funcs/deciToHexaFunc.py b/mathgenerator/funcs/deciToHexaFunc.py new file mode 100644 index 0000000..a815e34 --- /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.cpp b/mathgenerator/funcs/determinantToMatrix22.py similarity index 100% rename from mathgenerator/funcs/determinantToMatrix22.cpp rename to mathgenerator/funcs/determinantToMatrix22.py diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 89bf086..9f570cc 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -112,3 +112,5 @@ invertmatrix = Generator("Inverse of a Matrix", 74, "Inverse of a matrix A is", 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 0b546c2..8a88d21 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,7 @@ setup( license='MIT', packages=find_packages(), install_requires=[ + ], entry_points={ }