September 2014
Intermediate to advanced
512 pages
12h 39m
English
SymPy offers several ways to solve linear and nonlinear equations and systems of equations. Of course, these functions do not always succeed in finding closed-form exact solutions. In this case, we can fall back to numerical solvers and obtain approximate solutions.
We first need to import SymPy. We also initialize pretty printing in the notebook (see the first recipe of this chapter).
In [2]: var('x y z a')
Out[2]: (x, y, z, a)solve() function to solve equations (the right-hand side is 0 by default):In [3]: solve(x**2 - a, x) Out[3]: [-sqrt(a), sqrt(a)]
solve_univariate_inequality() function ...Read now
Unlock full access