-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
Description
Hello, I am new to sympy and wanted to solve an equation to x. I´ve got an Error: "expected an integer, got 1/16"
My code I tested with is:
import sympy as sp
x, y = sp.symbols("x y")
equation = sp.sympify("sqrt(x) - y + sqrt(x*(2 - x))")
try: solutions = sp.solve(equation, x)
except Exception as e:
print("Testcase 1 failed:", e)
equation = sp.sympify("sqrt(x) - y + sqrt(x*(2 - x))")
try: solutions = sp.solveset(equation, x)
except Exception as e:
print("Testcase 2 failed:", e)
equation = sp.sympify("sqrt(x) - y + sqrt(x*(2 - x))")
try: solutions = sp.solve(equation, x, manual=True)
except Exception as e:
print("Testcase 3 failed:", e)
equation = sp.sympify("sqrt(x) - y + sqrt(x*(2 - x))")
try: solutions = sp.solve(equation, x, dict=True)
except Exception as e:
print("Testcase 4 failed:", e)
equation = sp.Eq(sp.sympify("sqrt(x) + sqrt(x*(2 - x))"), sp.sympify("y"))
try: solutions = sp.solve(equation, x)
except Exception as e:
print("Testcase 5 failed:", e)
The output of this code is:
Testcase 1 failed: expected an integer, got 1/16
Testcase 2 failed: expected an integer, got 1/16
Testcase 3 failed: expected an integer, got 1/16
Testcase 4 failed: expected an integer, got 1/16
Testcase 5 failed: expected an integer, got 1/16
Press any key to continue . . .