Conicas na forma polar

A forma geral de uma cônica na forma polar é $$ r = \frac{de}{e\cos{\theta} + 1} $$ Vamos fazer dois exemplos: $$r = \frac{2}{1+\cos{\theta}} \text{ e } r = \frac{3}{1+0.5\cos{\theta}}$$


In [22]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
theta = np.arange(-1.7,1.7,0.1)

In [23]:
r = lambda x: 2.0/(1+np.cos(x))

In [24]:
theta


Out[24]:
array([-1.70000000e+00, -1.60000000e+00, -1.50000000e+00, -1.40000000e+00,
       -1.30000000e+00, -1.20000000e+00, -1.10000000e+00, -1.00000000e+00,
       -9.00000000e-01, -8.00000000e-01, -7.00000000e-01, -6.00000000e-01,
       -5.00000000e-01, -4.00000000e-01, -3.00000000e-01, -2.00000000e-01,
       -1.00000000e-01,  1.55431223e-15,  1.00000000e-01,  2.00000000e-01,
        3.00000000e-01,  4.00000000e-01,  5.00000000e-01,  6.00000000e-01,
        7.00000000e-01,  8.00000000e-01,  9.00000000e-01,  1.00000000e+00,
        1.10000000e+00,  1.20000000e+00,  1.30000000e+00,  1.40000000e+00,
        1.50000000e+00,  1.60000000e+00])

In [25]:
rho =r(theta)
rho


Out[25]:
array([2.29580137, 2.06015556, 1.86787196, 1.70944972, 1.57791073,
       1.46804317, 1.375898  , 1.29844641, 1.2333422 , 1.17875411,
       1.1332458 , 1.09568892, 1.0651995 , 1.04109136, 1.02284185,
       1.01006705, 1.00250417, 1.        , 1.00250417, 1.01006705,
       1.02284185, 1.04109136, 1.0651995 , 1.09568892, 1.1332458 ,
       1.17875411, 1.2333422 , 1.29844641, 1.375898  , 1.46804317,
       1.57791073, 1.70944972, 1.86787196, 2.06015556])

In [26]:
## primeiro vou tentar um grafico polar
ax=plt.subplot(111,projection='polar')
ax.plot(theta,rho)


Out[26]:
[<matplotlib.lines.Line2D at 0x28797aaf550>]

In [27]:
ponto = lambda x: [r(x)*np.cos(x) , r(x)*np.sin(x)]
par = ponto(theta)

In [28]:
ax2=plt.subplot(111)
plt.grid()
ax2.plot(par[0],par[1])
ax2.plot([2,2],[-2,2])
ax2.plot([0,0], "ro")
ax2.set_aspect('equal')
plt.xlim(-1,4)
plt.savefig('conica3.png', format='png')



In [29]:
## O outro é uma elipse
theta1=np.arange(0,6.5,0.05)
r1=lambda x: 3/(1+0.5*np.cos(x))
ax3=plt.subplot(111,projection="polar")
ax3.plot(theta1,r1(theta1))


Out[29]:
[<matplotlib.lines.Line2D at 0x2879737d0a0>]

In [30]:
## Em coordenadas cartesianas outra vez
ponto1 = lambda x: [r1(x)*np.cos(x),r1(x)*np.sin(x)]
elipse = ponto1(theta1)

In [31]:
ax4=plt.subplot(111)
plt.grid()
ax4.plot(elipse[0],elipse[1])
ax4.plot([6,6],[-3,3])
ax4.plot([0],[0], "ro")
ax4.set_aspect('equal')
plt.savefig('conica4.png',format="png")



In [ ]: