In [1]:
from sympy import *
init_printing(use_unicode=True, wrap_line=False, no_global=True)
import matplotlib.pyplot as plt
%matplotlib notebook
from sympy.abc import x,y
In [2]:
denominator = x**4 + 2*x**2 + 1
factor(denominator)
Out[2]:
$$\left(x^{2} + 1\right)^{2}$$
In [3]:
plot_implicit(Eq(denominator, y), (x, -0.6, 0.6), (y, 0, 2))
Out[3]:
<sympy.plotting.plot.Plot at 0xc5c1908>
In [4]:
plot_implicit(Eq(denominator, y), (x, -6, 6), (y, 0, 1400))
Out[4]:
<sympy.plotting.plot.Plot at 0xc668ef0>
In [5]:
denominator = 1 / (x**4 + 2*x**2 + 1)
factor(denominator)
Out[5]:
$$\frac{1}{\left(x^{2} + 1\right)^{2}}$$
In [6]:
plot_implicit(Eq(denominator, y), (x, -6, 6), (y, 0, 1))
Out[6]:
<sympy.plotting.plot.Plot at 0xc605358>
In [7]:
numerator = x**3 * sin(x)**2
numerator
Out[7]:
$$x^{3} \sin^{2}{\left (x \right )}$$
In [8]:
plot_implicit(Eq(numerator, y), (x, -6, 6), (y, -120, 120))
Out[8]:
<sympy.plotting.plot.Plot at 0xcb09eb8>
In [9]:
wifieqn = numerator*denominator
factor(wifieqn)
Out[9]:
$$\frac{x^{3} \sin^{2}{\left (x \right )}}{\left(x^{2} + 1\right)^{2}}$$
In [10]:
plot_implicit(Eq(wifieqn, y), (x, -6, 6), (y, -0.4, 0.4))
Out[10]:
<sympy.plotting.plot.Plot at 0xc64b898>
In [11]:
integ = integrate(wifieqn, (x, -5, 5))
integ
Out[11]:
$$\int_{-5}^{5} \frac{x^{3} \sin^{2}{\left (x \right )}}{\left(x^{2} + 1\right)^{2}}\, dx$$
In [12]:
integ.doit()
Out[12]:
$$\int_{-5}^{5} \frac{x^{3} \sin^{2}{\left (x \right )}}{\left(x^{2} + 1\right)^{2}}\, dx$$