From d4965963248046d74d3773c91b9b0e2d08b49dd2 Mon Sep 17 00:00:00 2001 From: Allen Guan Date: Mon, 26 Oct 2020 15:22:50 +0800 Subject: [PATCH] Fix Linter error --- mathgenerator/funcs/stationary_points.py | 32 +++++++++++++----------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/mathgenerator/funcs/stationary_points.py b/mathgenerator/funcs/stationary_points.py index 93ff673..e248ca3 100644 --- a/mathgenerator/funcs/stationary_points.py +++ b/mathgenerator/funcs/stationary_points.py @@ -1,21 +1,23 @@ from .__init__ import * 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: - solution = ','.join('({},{})'.format( - str(p), - sympy.sympify(problem.replace(x,p)) - ) for p in solution) - problem = 'f(x)=' + str(problem).replace('**', '^') - return problem, solution +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: + 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)