<jupyter_start><jupyter_text>Conics BUG HUNT!<jupyter_code># Make a gaussian
x = np.linspace(-2,2,100)

# create the gaussian
X,Y = np.meshgrid(x,x)
gauss2d = np.exp( -(X**2+Y)**2 )

# and plot
plt.imshow(gauss2d)
plt.axis('off')
plt.show()
# draw a circle using meshgrid
r = 3

# grid space
x = np.linspace(-r,r,100)
X,Y = np.meshgrid(x)

# create the function
Fxy = X**2 + Y**2 - r**2

# draw it
plt.imshow(Fxy)

plt.axis('off')
plt.show()
# parameters
a = 1
b = 2
h = 2
k = -3

# grid space
axlim = np.max((a,b)) + np.max((abs(h),abs(k)))
x = np.linspace(-axlim,axlim,100)
y = np.linspace(-axlim,axlim,100)
X,Y = np.meshgrid(x,y)

# create the function
Fxy = X**2/a**2 + Y**2/b**2

# draw it as a contour
plt.contour(X,Y,Fxy,0)

# draw guide lines
plt.grid()
plt.title('Ellipse centered at (x,y)=(%s,%s)' %(h,k))
plt.gca().set_aspect('equal')
plt.show()
# hyperbola! (not an "X")

# parameters
a = 1
b = .5
h = 1
k = 2

# grid space
axlim = 2* (np.max((a,b)) + np.max((abs(h),abs(k))))
x = np.linspace(-axlim,axlim,100)
y = np.linspace(-axlim,axlim,100)
X,Y = np.meshgrid(x,y)

# create the function
Fxy = (X-h)**2/a**2 - (Y-k)**2/b**2

# draw it as a contour
plt.contour(X,Y,Fxy,0)

# draw a dot in the center
plt.plot(h,k,'go')

# draw guide lines
plt.plot([-axlim,axlim],[0,0],'--',color=[.8,.8,.8])
plt.plot([0,0],[-axlim,axlim],'k--',color=[.8,.8,.8]) # color overwrites k

plt.gca().set_aspect('equal')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.23140495867768596, 'fraction_numerical': 0.03925619834710744, 'mean_word_length': 4.302919708029197, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '266409', 'license': 'MIT', 'n_tokens_mistral': 737, 'n_tokens_neox': 699, 'n_words': 143, 'path': 'MXC_pymath_conics_BUGHUNT.ipynb', 'repo_name': 'stefan-cross/mathematics-with-python', 'size': '1452'}