Chapter 15 Points on Curves
ΒΆ
xxxxxxxxxx
var('x,y')
def _(n=3):
plot1=implicit_plot(x^2+2*y^2-n, (x,-n,n), (y,-n,n), plot_points=100)
grid_pts = [[i,j] for i in [-n..n] for j in [-n..n]]
plot_grid_pts = points(grid_pts,rgbcolor=(0,0,0),pointsize=2)
lattice_pts = [coords for coords in grid_pts if (2*coords[1]^2+coords[0]^2)==n]
plot_lattice_pts = points(lattice_pts, rgbcolor = (0,0,1),pointsize=20)
show(plot1 + plot_grid_pts + plot_lattice_pts, figsize=[5,5],aspect_ratio=1)
pretty_print(html("The ellipse $x^2+2y^2=%s"%n))
x3=y2+2
x2+2y2=9
x2β2y2=1