Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Graphing conic sections

Project: MA1200
Views: 878
Kernel: Python 3 (Anaconda 5)

Plot hyperbola

I want to graph an equation x2−9y2+2x+36y−44=0x^2 - 9y^2 +2x + 36y - 44 = 0

#packages import numpy as np from sympy import * from sympy.plotting import plot, plot_implicit, plot_parametric
x, y = symbols('x y') plot_implicit(Eq(x**2-9*y**2+2*x+36*y-44, 0), (x,-10,10))
Image in a Jupyter notebook
<sympy.plotting.plot.Plot at 0x7f8f8c8872b0>

The graph below is for the equation x29−y21=1.\frac{x^2}{9} - \frac{y^2}{1} = 1. It is an east-west hyperbola.

plot_implicit(Eq(x**2/9- y**2, 1), (x,-10,10))
Image in a Jupyter notebook
<sympy.plotting.plot.Plot at 0x7f8f8e3d55f8>

The graph below is for the equation x21−y29=1.\frac{x^2}{1} - \frac{y^2}{9} = 1. It is still east-western hyperbola

plot_implicit(Eq(x**2- y**2/9, 1), (x,-5,5))
Image in a Jupyter notebook
<sympy.plotting.plot.Plot at 0x7f8f8a3e17b8>

The graph below is for the equation −x29+y21=1.- \frac{x^2}{9} + \frac{y^2}{1} = 1. Compared to the above equations, we switch the sign of xx term and yy term. Now, it becomes south-north hyperbola.

plot_implicit(Eq(-x**2/9 + y**2, 1), (x,-10,10))
Image in a Jupyter notebook
<sympy.plotting.plot.Plot at 0x7f8f8a31dd30>

I want to plot 25x2+50x+169y2−676y=3524 25 x^2 + 50 x + 169 y^2 - 676 y = 3524

x, y = symbols('x y') p1 = plot_implicit(Eq(25*x**2 + 50* x + 169 * y**2 - 676 * y - 3524, 0), (x, -15, 15)); #p1.save('fig1.png')
Image in a Jupyter notebook