Sharedsupport / 2018-04-25-sympy tutorial.ipynbOpen in CoCalc
Author: William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.
In [1]:
import sympy sympy.sqrt(3)
sqrt(3)
In [3]:
x, y = symbols('x y') expr = x + 2*y expr
x + 2*y
In [5]:
from sympy import expand, factor expanded_expr = expand(x*expr) expanded_expr
x**2 + 2*x*y
In [7]:
factor(expanded_expr)
x*(x + 2*y)
In [ ]: