mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
yapf update
This commit is contained in:
@@ -4,7 +4,10 @@ import math
|
||||
|
||||
def angleBtwVectorsFunc(maxEltAmt=20):
|
||||
s = 0
|
||||
v1 = [round(random.uniform(0, 1000), 2) for i in range(random.randint(2, maxEltAmt))]
|
||||
v1 = [
|
||||
round(random.uniform(0, 1000), 2)
|
||||
for i in range(random.randint(2, maxEltAmt))
|
||||
]
|
||||
v2 = [round(random.uniform(0, 1000), 2) for i in v1]
|
||||
for i in range(len(v1)):
|
||||
s += v1[i] * v2[i]
|
||||
|
||||
@@ -69,5 +69,8 @@ def complexQuadraticFunc(prob_type=0, max_range=10):
|
||||
return problem, solution
|
||||
|
||||
|
||||
complex_quadratic = Generator("complex Quadratic Equation", 100, "Find the roots of given Quadratic Equation ",
|
||||
"simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)", complexQuadraticFunc)
|
||||
complex_quadratic = Generator(
|
||||
"complex Quadratic Equation", 100,
|
||||
"Find the roots of given Quadratic Equation ",
|
||||
"simplified solution : (x1, x2), generalized solution : ((-b + sqrt(d))/2a, (-b - sqrt(d))/2a) or ((-b + sqrt(d)i)/2a, (-b - sqrt(d)i)/2a)",
|
||||
complexQuadraticFunc)
|
||||
|
||||
@@ -25,7 +25,8 @@ def decimalToRomanNumeralsFunc(maxDecimal=4000):
|
||||
elif last_value == 4:
|
||||
solution += (roman_dict[divisor] + roman_dict[divisor * 5])
|
||||
elif 5 <= last_value <= 8:
|
||||
solution += (roman_dict[divisor * 5] + (roman_dict[divisor] * (last_value - 5)))
|
||||
solution += (roman_dict[divisor * 5] + (roman_dict[divisor] *
|
||||
(last_value - 5)))
|
||||
elif last_value == 9:
|
||||
solution += (roman_dict[divisor] + roman_dict[divisor * 10])
|
||||
x = math.floor(x % divisor)
|
||||
|
||||
@@ -5,7 +5,8 @@ def nthFibonacciNumberFunc(maxN=100):
|
||||
golden_ratio = (1 + math.sqrt(5)) / 2
|
||||
n = random.randint(1, maxN)
|
||||
problem = f"What is the {n}th Fibonacci number?"
|
||||
ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) / (math.sqrt(5)))
|
||||
ans = round((math.pow(golden_ratio, n) - math.pow(-golden_ratio, -n)) /
|
||||
(math.sqrt(5)))
|
||||
solution = f"{ans}"
|
||||
return problem, solution
|
||||
|
||||
|
||||
@@ -15,4 +15,6 @@ def perimeterOfPolygons(maxSides=12, maxLength=120):
|
||||
|
||||
|
||||
perimeter_of_polygons = Generator(
|
||||
"Perimeter of Polygons", 96, "The perimeter of a x sided polygon with lengths of y cm is: ", "z", perimeterOfPolygons)
|
||||
"Perimeter of Polygons", 96,
|
||||
"The perimeter of a x sided polygon with lengths of y cm is: ", "z",
|
||||
perimeterOfPolygons)
|
||||
|
||||
@@ -16,5 +16,5 @@ def powerOfPowersFunc(maxBase=50, maxPower=10):
|
||||
return problem, solution
|
||||
|
||||
|
||||
power_of_powers = Generator("Power of Powers", 97,
|
||||
"6^4^2 = 6^(4*2) = 6^6", "46656", powerOfPowersFunc)
|
||||
power_of_powers = Generator("Power of Powers", 97, "6^4^2 = 6^(4*2) = 6^6",
|
||||
"46656", powerOfPowersFunc)
|
||||
|
||||
@@ -16,5 +16,6 @@ def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10):
|
||||
return problem, solution
|
||||
|
||||
|
||||
quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 98,
|
||||
"6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc)
|
||||
quotient_of_power_same_base = Generator("Quotient of Powers with Same Base",
|
||||
98, "6^4 / 6^2 = 6^(4-2) = 6^2", "36",
|
||||
quotientOfPowerSameBaseFunc)
|
||||
|
||||
@@ -16,5 +16,6 @@ def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10):
|
||||
return problem, solution
|
||||
|
||||
|
||||
quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", 99,
|
||||
"6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientOfPowerSamePowerFunc)
|
||||
quotient_of_power_same_power = Generator("Quotient of Powers with Same Power",
|
||||
99, "6^4 / 3^4 = (6/3)^4 = 2^4", "16",
|
||||
quotientOfPowerSamePowerFunc)
|
||||
|
||||
Reference in New Issue
Block a user