from __future__ import division, print_function # Python 3 from sympy import init_printing init_printing(use_latex='mathjax',use_unicode=False) # Affichage des résultats from sympy import Eq from sympy.abc import x,y Eq(x, 3) Eq(x + y, 3) from sympy import solve solve(Eq(x, 3), x) solve(Eq(x + y, 3), x) solve(Eq(x, 3)) solve(Eq(x**2, 3)) eq1 = Eq(x + y, 47) eq2 = Eq(x - y, 33) [eq1, eq2] solve([eq1, eq2]) In [279]: solve(eq1, eq2) Traceback (most recent call last): ... TypeError: cannot determine truth value of x - y == 33 eq1 = Eq(x + y, 47) eq2 = Eq(x * y, 510) [eq1, eq2] solve([eq1, eq2]) solve(x - 3) solve(x**2 + x - 6) solve([x + y - 47, x - y - 33]) solve([x + y - 47, x * y - 510]) solve(x**3 + 2*x**2 - 1, x) solve( [x**2 + 4*y**2 -2, -10*x + 2*y -15], [x, y]) ____ ____ ____ ____ 150 \/ 23 *I 15 5*\/ 23 *I 150 \/ 23 *I 15 5*\/ 23 *I [(- --- - --------, --- - ----------), (- --- + --------, --- + ----------)] 101 101 202 101 101 101 202 101 from sympy import roots roots(x - 7) roots(x**6) roots(x**5 - 7*x**4 + 2*x**3 - 14*x**2 + x - 7, x) from sympy.abc import a,b,c roots(a*x + b, x) roots(a*x + b) roots(a*x**2 + b*x + c, x)