mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Fix Linter error
This commit is contained in:
@@ -1,21 +1,23 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
import sympy
|
import sympy
|
||||||
|
|
||||||
def stationaryPointsFunc(maxExp=3, maxCoef=10):
|
|
||||||
while True:
|
|
||||||
x = sympy.symbols('x')
|
|
||||||
problem = 0
|
|
||||||
for exp in range(maxExp+1):
|
|
||||||
coefficient = random.randint(0, maxCoef)
|
|
||||||
problem += coefficient*pow(x,exp)
|
|
||||||
solution = sympy.stationary_points(problem, x)
|
|
||||||
|
|
||||||
if len(solution) != 0:
|
def stationaryPointsFunc(maxExp=3, maxCoef=10):
|
||||||
solution = ','.join('({},{})'.format(
|
while True:
|
||||||
str(p),
|
x = sympy.symbols('x')
|
||||||
sympy.sympify(problem.replace(x,p))
|
problem = 0
|
||||||
) for p in solution)
|
for exp in range(maxExp + 1):
|
||||||
problem = 'f(x)=' + str(problem).replace('**', '^')
|
coefficient = random.randint(0, maxCoef)
|
||||||
return problem, solution
|
problem += coefficient * pow(x, exp)
|
||||||
|
solution = sympy.stationary_points(problem, x)
|
||||||
|
|
||||||
|
if len(solution) != 0:
|
||||||
|
solution = ','.join('({},{})'.format(
|
||||||
|
str(p),
|
||||||
|
sympy.sympify(problem.replace(x, p))
|
||||||
|
) for p in solution)
|
||||||
|
problem = 'f(x)=' + str(problem).replace('**', '^')
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
stationary_points = Generator("Stationary Points", 106, "f(x)=x^3-3x", "(-1,2),(1,-2)", stationaryPointsFunc)
|
stationary_points = Generator("Stationary Points", 106, "f(x)=x^3-3x", "(-1,2),(1,-2)", stationaryPointsFunc)
|
||||||
|
|||||||
Reference in New Issue
Block a user