##// END OF EJS Templates
Merge pull request #7852 from minrk/open-perm...
Merge pull request #7852 from minrk/open-perm Catch IOError in addition to OSError. Closes #7848

File last commit:

r20541:1e566dcc
r20555:1681cf7f merge
Show More
Factoring.ipynb
115 lines | 2.1 KiB | text/plain | TextLexer

Factoring Polynomials with SymPy

Here is an example that uses SymPy to factor polynomials.

In [ ]:
from IPython.html.widgets import interact
from IPython.display import display
In [ ]:
from sympy import Symbol, Eq, factor, init_printing
init_printing(use_latex='mathjax')
In [ ]:
x = Symbol('x')
In [ ]:
def factorit(n):
    display(Eq(x**n-1, factor(x**n-1)))

Notice how the output of the factorit function is properly formatted LaTeX.

In [ ]:
factorit(12)
In [ ]:
interact(factorit, n=(2,40));