mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
🤖 made makeReadme automated
This commit is contained in:
@@ -71,3 +71,8 @@ from .multiplyComplexNumbersFunc import *
|
|||||||
from .geomProgrFunc import *
|
from .geomProgrFunc import *
|
||||||
from .geometricMeanFunc import *
|
from .geometricMeanFunc import *
|
||||||
from .harmonicMeanFunc import *
|
from .harmonicMeanFunc import *
|
||||||
|
from .euclidianNormFunc import *
|
||||||
|
from .angleBtwVectorsFunc import *
|
||||||
|
from .absoluteDifferenceFunc import *
|
||||||
|
from .vectorDotFunc import *
|
||||||
|
from .binary2sComplement import *
|
||||||
|
|||||||
10
mathgenerator/funcs/absoluteDifferenceFunc.py
Normal file
10
mathgenerator/funcs/absoluteDifferenceFunc.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from .__init__ import *
|
||||||
|
|
||||||
|
def absoluteDifferenceFunc (maxA = 100, maxB = 100):
|
||||||
|
a = random.randint(-1*maxA, maxA)
|
||||||
|
b = random.randint(-1*maxB, maxB)
|
||||||
|
absDiff = abs(a-b)
|
||||||
|
|
||||||
|
problem = "Absolute difference between numbers " + str(a) + " and " + str(b) + " = "
|
||||||
|
solution = absDiff
|
||||||
|
return problem, solution
|
||||||
16
mathgenerator/funcs/angleBtwVectorsFunc.py
Normal file
16
mathgenerator/funcs/angleBtwVectorsFunc.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
from .euclidianNormFunc import euclidianNormFunc
|
||||||
|
import math
|
||||||
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
|
def angleBtwVectorsFunc(v1: list, v2: list):
|
||||||
|
sum = 0
|
||||||
|
for i in v1:
|
||||||
|
for j in v2:
|
||||||
|
sum += i * j
|
||||||
|
|
||||||
|
mags = euclidianNormFunc(v1) * euclidianNormFunc(v2)
|
||||||
|
problem = f"angle between the vectors {v1} and {v2} is:"
|
||||||
|
solution = math.acos(sum / mags)
|
||||||
|
# would return the answer in radians
|
||||||
|
return problem, solution
|
||||||
26
mathgenerator/funcs/binary2sComplement.py
Normal file
26
mathgenerator/funcs/binary2sComplement.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
from .__init__ import *
|
||||||
|
|
||||||
|
def binary2sComplementFunc(maxDigits=10):
|
||||||
|
digits = random.randint(1, maxDigits)
|
||||||
|
question = ''.join([str(random.randint(0, 1)) for i in range(digits)]).lstrip('0')
|
||||||
|
|
||||||
|
answer = []
|
||||||
|
for i in question:
|
||||||
|
answer.append(str(int(not bool(int(i)))))
|
||||||
|
|
||||||
|
carry = True
|
||||||
|
j = len(answer) - 1
|
||||||
|
while j >= 0:
|
||||||
|
if answer[j] == '0':
|
||||||
|
answer[j] = '1'
|
||||||
|
carry = False
|
||||||
|
break
|
||||||
|
answer[j] = '0'
|
||||||
|
j -= 1
|
||||||
|
|
||||||
|
if j == 0 and carry == True:
|
||||||
|
answer.insert(0, '1')
|
||||||
|
|
||||||
|
problem = "2's complement of " + question + " ="
|
||||||
|
solution = ''.join(answer).lstrip('0')
|
||||||
|
return problem, solution
|
||||||
7
mathgenerator/funcs/euclidianNormFunc.py
Normal file
7
mathgenerator/funcs/euclidianNormFunc.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
|
def euclidianNormFunc(v1: list):
|
||||||
|
problem = f"Euclidian norm or L2 norm of the vector{v1} is:"
|
||||||
|
solution = sqrt(sum([i**2 for i in v1]))
|
||||||
|
return problem, solution
|
||||||
11
mathgenerator/funcs/vectorDotFunc.py
Normal file
11
mathgenerator/funcs/vectorDotFunc.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
|
def vectorDotFunc(minVal=-20, maxVal=20):
|
||||||
|
a = [random.randint(minVal, maxVal) for i in range(3)]
|
||||||
|
b = [random.randint(minVal, maxVal) for i in range(3)]
|
||||||
|
c = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
|
||||||
|
|
||||||
|
problem = str(a) + " . " + str(b) + " = "
|
||||||
|
solution = str(c)
|
||||||
|
return problem, solution
|
||||||
@@ -70,15 +70,15 @@ surfaceAreaCubeGen = Generator("Surface Area of Cube", 32, "Surface area of cube
|
|||||||
surfaceAreaCuboidGen = Generator("Surface Area of Cuboid", 33, "Surface area of cuboid with sides = a units, b units, c units is", "d units^2", surfaceAreaCuboid)
|
surfaceAreaCuboidGen = Generator("Surface Area of Cuboid", 33, "Surface area of cuboid with sides = a units, b units, c units is", "d units^2", surfaceAreaCuboid)
|
||||||
surfaceAreaCylinderGen = Generator("Surface Area of Cylinder", 34, "Surface area of cylinder with height = a units and radius = b units is", "c units^2", surfaceAreaCylinder)
|
surfaceAreaCylinderGen = Generator("Surface Area of Cylinder", 34, "Surface area of cylinder with height = a units and radius = b units is", "c units^2", surfaceAreaCylinder)
|
||||||
volumeCubeGen = Generator("Volum of Cube", 35, "Volume of cube with side a units is", "b units^3", volumeCube)
|
volumeCubeGen = Generator("Volum of Cube", 35, "Volume of cube with side a units is", "b units^3", volumeCube)
|
||||||
volumeCuboidGen = Generator( "Volume of Cuboid", 36, "Volume of cuboid with sides = a units, b units, c units is", "d units^3", volumeCuboid)
|
volumeCuboidGen = Generator("Volume of Cuboid", 36, "Volume of cuboid with sides = a units, b units, c units is", "d units^3", volumeCuboid)
|
||||||
volumeCylinderGen = Generator( "Volume of cylinder", 37, "Volume of cylinder with height = a units and radius = b units is", "c units^3", volumeCylinder)
|
volumeCylinderGen = Generator( "Volume of cylinder", 37, "Volume of cylinder with height = a units and radius = b units is", "c units^3", volumeCylinder)
|
||||||
surfaceAreaConeGen = Generator("Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is", "c units^2", surfaceAreaCone)
|
surfaceAreaConeGen = Generator( "Surface Area of cone", 38, "Surface area of cone with height = a units and radius = b units is", "c units^2", surfaceAreaCone)
|
||||||
volumeConeGen = Generator("Volume of cone", 39, "Volume of cone with height = a units and radius = b units is", "c units^3", volumeCone)
|
volumeConeGen = Generator( "Volume of cone", 39, "Volume of cone with height = a units and radius = b units is", "c units^3", volumeCone)
|
||||||
commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ", "[c, d, ...]", commonFactorsFunc)
|
commonFactors = Generator("Common Factors", 40, "Common Factors of {a} and {b} = ", "[c, d, ...]", commonFactorsFunc)
|
||||||
intersectionOfTwoLines = Generator("Intersection of Two Lines", 41,"Find the point of intersection of the two lines: y = m1*x + b1 and y = m2*x + b2", "(x, y)", intersectionOfTwoLinesFunc)
|
intersectionOfTwoLines = Generator("Intersection of Two Lines", 41,"Find the point of intersection of the two lines: y = m1*x + b1 and y = m2*x + b2", "(x, y)", intersectionOfTwoLinesFunc)
|
||||||
permutations = Generator("Permutations", 42, "Total permutations of 4 objects at a time from 10 objects is", "5040", permutationFunc)
|
permutations = Generator("Permutations", 42, "Total permutations of 4 objects at a time from 10 objects is", "5040", permutationFunc)
|
||||||
vectorCross = Generator("Cross Product of 2 Vectors", 43, "a X b = ", "c", vectorCrossFunc)
|
vectorCross = Generator("Cross Product of 2 Vectors",43, "a X b = ", "c", vectorCrossFunc)
|
||||||
compareFractions = Generator( "Compare Fractions", 44, "Which symbol represents the comparison between a/b and c/d?", ">/</=", compareFractionsFunc)
|
compareFractions = Generator("Compare Fractions", 44, "Which symbol represents the comparison between a/b and c/d?", ">/</=", compareFractionsFunc)
|
||||||
simpleInterest = Generator("Simple Interest", 45, "Simple interest for a principle amount of a dollars, b% rate of interest and for a time period of c years is = ", "d dollars", simpleInterestFunc)
|
simpleInterest = Generator("Simple Interest", 45, "Simple interest for a principle amount of a dollars, b% rate of interest and for a time period of c years is = ", "d dollars", simpleInterestFunc)
|
||||||
matrixMultiplication = Generator("Multiplication of two matrices",46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc)
|
matrixMultiplication = Generator("Multiplication of two matrices",46, "Multiply two matrices A and B", "C", matrixMultiplicationFunc)
|
||||||
CubeRoot = Generator("Cube Root", 47, "Cuberoot of a upto 2 decimal places is", "b", cubeRootFunc)
|
CubeRoot = Generator("Cube Root", 47, "Cuberoot of a upto 2 decimal places is", "b", cubeRootFunc)
|
||||||
@@ -88,18 +88,23 @@ quadraticEquationSolve = Generator("Quadratic Equation", 50, "Find the zeros {x1
|
|||||||
hcf = Generator("HCF (Highest Common Factor)", 51,"HCF of a and b = ", "c", hcfFunc)
|
hcf = Generator("HCF (Highest Common Factor)", 51,"HCF of a and b = ", "c", hcfFunc)
|
||||||
diceSumProbability = Generator("Probability of a certain sum appearing on faces of dice",52, "If n dices are rolled then probabilty of getting sum of x is =", "z", DiceSumProbFunc)
|
diceSumProbability = Generator("Probability of a certain sum appearing on faces of dice",52, "If n dices are rolled then probabilty of getting sum of x is =", "z", DiceSumProbFunc)
|
||||||
exponentiation = Generator("Exponentiation", 53, "a^b = ", "c", exponentiationFunc)
|
exponentiation = Generator("Exponentiation", 53, "a^b = ", "c", exponentiationFunc)
|
||||||
confidenceInterval = Generator("Confidence interval For sample S", 54, "With X% confidence", "is (A,B)", confidenceIntervalFunc)
|
confidenceInterval = Generator("Confidence interval For sample S",54, "With X% confidence", "is (A,B)", confidenceIntervalFunc)
|
||||||
surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc)
|
surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ c^(1/d)", "</>/=", surdsComparisonFunc)
|
||||||
fibonacciSeries = Generator("Fibonacci Series", 56, "fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a", fibonacciSeriesFunc)
|
fibonacciSeries = Generator("Fibonacci Series", 56, "fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a", fibonacciSeriesFunc)
|
||||||
basicTrigonometry = Generator("Trigonometric Values", 57, "What is sin(X)?", "ans", basicTrigonometryFunc)
|
basicTrigonometry = Generator("Trigonometric Values", 57, "What is sin(X)?", "ans", basicTrigonometryFunc)
|
||||||
sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc)
|
sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58,"Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc)
|
||||||
dataSummary = Generator("Mean,Standard Deviation,Variance",59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc)
|
dataSummary = Generator("Mean,Standard Deviation,Variance",59, "a,b,c", "Mean:a+b+c/3,Std,Var", dataSummaryFunc)
|
||||||
surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere)
|
surfaceAreaSphereGen = Generator("Surface Area of Sphere", 60, "Surface area of sphere with radius = a units is", "d units^2", surfaceAreaSphere)
|
||||||
volumeSphere = Generator("Volume of Sphere", 60,"Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc)
|
volumeSphere = Generator("Volume of Sphere", 61, "Volume of sphere with radius r m = ", "(4*pi/3)*r*r*r", volumeSphereFunc)
|
||||||
nthFibonacciNumberGen = Generator("nth Fibonacci number", 61, "What is the nth Fibonacci number", "Fn", nthFibonacciNumberFunc)
|
nthFibonacciNumberGen = Generator("nth Fibonacci number", 62, "What is the nth Fibonacci number", "Fn", nthFibonacciNumberFunc)
|
||||||
profitLossPercent = Generator("Profit or Loss Percent", 62, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc)
|
profitLossPercent = Generator("Profit or Loss Percent", 63, "Profit/ Loss percent when CP = cp and SP = sp is: ", "percent", profitLossPercentFunc)
|
||||||
binaryToHex = Generator("Binary to Hexidecimal", 63, "Hexidecimal of a=", "b", binaryToHexFunc)
|
binaryToHex = Generator("Binary to Hexidecimal", 64, "Hexidecimal of a=", "b", binaryToHexFunc)
|
||||||
complexNumMultiply = Generator("Multiplication of 2 complex numbers", 64, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc)
|
complexNumMultiply = Generator("Multiplication of 2 complex numbers", 65, "(x + j) (y + j) = ", "xy + xj + yj -1", multiplyComplexNumbersFunc)
|
||||||
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)
|
geometricprogression=Generator("Geometric Progression", 66, "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)
|
geometricMean=Generator("Geometric Mean of N Numbers",67,"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)
|
harmonicMean=Generator("Harmonic Mean of N Numbers",68,"Harmonic mean of n numbers A1 , A2 , ... , An = "," n/((1/A1) + (1/A2) + ... + (1/An)) = ans",harmonicMeanFunc)
|
||||||
|
eucldianNorm=Generator("Euclidian norm or L2 norm of a vector", 69, "Euclidian Norm of a vector V:[v1, v2, ......., vn]", "sqrt(v1^2 + v2^2 ........ +vn^2)", euclidianNormFunc)
|
||||||
|
angleBtwVectors=Generator("Angle between 2 vectors", 70, "Angle Between 2 vectors V1=[v11, v12, ..., v1n] and V2=[v21, v22, ....., v2n]", "V1.V2 / (euclidNorm(V1)*euclidNorm(V2))", angleBtwVectorsFunc)
|
||||||
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user