<jupyter_start><jupyter_text>Revisão Cônicas https://mmas.github.io/conics-matplotlib<jupyter_code>import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

mpl.rcParams['lines.color'] = 'k'
mpl.rcParams['axes.prop_cycle'] = mpl.cycler('color', ['k'])
from __future__ import print_function
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
x = np.linspace(-9, 9, 400)
y = np.linspace(-5, 5, 400)
x, y = np.meshgrid(x, y)
def axes():
    plt.axhline(0, alpha=.3)
    plt.axvline(0, alpha=.3)<jupyter_output><empty_output><jupyter_text>Plotar o grafico de $(y^2 - 4ax = 0)$<jupyter_code>a = .5
axes()
plt.contour(x, y, (y**2 - 4*a*x), [0], colors='k')
plt.show()
axes()
plt.contour(x, y, (y**2 - 4*a*x), [0], colors='k', alpha=.3)
# Focus.
plt.plot(a, 0, 'r*')
# Directrix.
plt.axvline(-a)
plt.show()
def f(m, b):
    plt.figure(2)
    x = np.linspace(-10, 10, num=1000)
    plt.plot(x, m**x + b*x - 1)
    plt.ylim(-5, 5)
    plt.show()

interactive_plot = interactive(f, m=(-2.0, 2.0), b=(-3, 3, 0.5))
output = interactive_plot.children[-1]
output.layout.height = '350px'
interactive_plot

def g(a, b):
    axes()
    plt.contour(x, y, (a*y**2 - b*x), [0], colors='k')
    plt.show()

interactive_plot = interactive(g, a=(-2, 2), b=(-3, 4))
output = interactive_plot.children[-1]
output.layout.height = '500px'
interactive_plot<jupyter_output><empty_output><jupyter_text>$$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 0$$  para: a=2 e b=2$$\frac{x^2}{2^2} + \frac{x^2}{2^2} = 0$$<jupyter_code>a = 2.
b = 2.
axes()
plt.contour(x, y,(x**2/a**2 + y**2/b**2), [1], colors='k')
plt.show()
a = 4.
b = 2.
axes()
plt.contour(x, y,(x**2/a**2 + y**2/b**2), [1], colors='k')
plt.show()
axes()
plt.contour(x, y,(x**2/a**2 + y**2/b**2), [1], colors='k', alpha=.1)
# Eccentricity.
e = np.sqrt(1 - b**2/a**2)
# Foci.
plt.plot(a*e, 0, '.', -a*e, 0, '.')
# Directrices.
plt.axvline(a/e)
plt.axvline(-a/e)
plt.show()
a, b, c, d, e, f = 4, -5, 2, 4, -3, -3
assert b**2 - 4*a*c < 0
axes()
plt.contour(x, y,(a*x**2 + b*x*y + c*y**2 + d*x + e*y + f), [0], colors='k')
plt.show()<jupyter_output><empty_output>