mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
complete restructure of the project. minor tweaks
This commit is contained in:
20
mathgenerator/funcs/powerRuleIntegrationFunc.py
Normal file
20
mathgenerator/funcs/powerRuleIntegrationFunc.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def powerRuleIntegrationFunc(maxCoef=10, maxExp=10, maxTerms=5):
|
||||
numTerms = random.randint(1, maxTerms)
|
||||
problem = ""
|
||||
solution = ""
|
||||
|
||||
for i in range(numTerms):
|
||||
if i > 0:
|
||||
problem += " + "
|
||||
solution += " + "
|
||||
coefficient = random.randint(1, maxCoef)
|
||||
exponent = random.randint(1, maxExp)
|
||||
|
||||
problem += str(coefficient) + "x^" + str(exponent)
|
||||
solution += "(" + str(coefficient) + "/" + str(exponent) + ")x^" + str(exponent + 1)
|
||||
|
||||
solution += " + c"
|
||||
return problem, solution
|
||||
Reference in New Issue
Block a user