Back to Pixi

Factoring Polynomials with SymPy

examples/jupyterlab/Factoring.ipynb

0.67.2479 B
Original Source

Factoring Polynomials with SymPy

Here is an example that uses SymPy to factor polynomials.

python
# Imports for JupyterLite
%pip install -q ipywidgets sympy
python
from ipywidgets import interact
python
from sympy import Symbol, Eq, factor
python
x = Symbol("x")
python
def factorit(n):
    return Eq(x**n - 1, factor(x**n - 1))
python
factorit(12)
python
interact(factorit, n=(2, 40));