Jupyter Snippet CB2nd 02_solvers

Jupyter Snippet CB2nd 02_solvers

15.2. Solving equations and inequalities

from sympy import *
init_printing()
var('x y z a')

png

solve(x**2 - a, x)

png

x = Symbol('x')
solve_univariate_inequality(x**2 > 4, x)

png

solve([x + 2*y + 1, x - 3*y - 2], x, y)

png

solve([x**2 + y**2 - 1, x**2 - y**2 - S(1) / 2], x, y)

png

solve([x + 2*y + 1, -x - 2*y - 1], x, y)

png

var('a b c d u v')

png

M = Matrix([[a, b, u], [c, d, v]])
M

png

solve_linear_system(M, x, y)

png

det(M[:2, :2])

png