Here's a first attempt at imitating your first link: {{{ var('x,y') ngamma = n(euler_gamma) def dirich(r): return r*log(r)+(2*ngamma-1)*r
def lattice_pts(r): tab = [[i,j] for i in range(1,ceil(r)) for j in range(1,ceil(r))] tab2 = [q for q in tab if q[0]*q[1] <= r] return tab2 @interact def lattice_plot(r = slider(1,20,.05,default = 15.6)): var('x') cr = Integer(ceil(r)) p = plot(r/x,1,cr, plot_points = 200) pts = points([[i,j] for i in range(1,cr) for j in range(1,cr)], rgbcolor = (0,0,0), pointsize = 1) lpts = lattice_pts(r) lpts_gr = points(lpts, rgbcolor = (0,0,1)) html('Number of lattice points = ' + str(len(lpts))) html('Dirichlet estimate = ' + str(dirich(r))) show(p+pts+lpts_gr, figsize = [5,5], xmin = -1, xmax = cr, ymin = -1, ymax = cr) }}} On Jan 14, 11:21 pm, kcrisman <kcris...@gmail.com> wrote: > Dear support, > > I would like to (easily) plot an integer lattice and then be able to > highlight certain points on it for a class. Basically, I want to be > able to easily do (a static version of, not necessarily manipulate) > what the Mma > Demonstrationhttp://demonstrations.wolfram.com/LatticePointsUnderAHyperbola/ > does. The code for this demo looked extremely unhelpful. A related > one that would be very helpful > ishttp://demonstrations.wolfram.com/ModularArithmetic/, > (which is similar to some of the things the hopefully soon-to-be open > source PascGalois project does). > > I suspect that matrix_plot or whatever would in theory be able to do > at least some of this (like the second one) but I don't think this > would give me labeled rows and columns, and I have no idea how to use > any regular plotting commands to do it without pretty much literally > putting in every line and point by hand, which is quite daunting. > > I know this is possible in Sage, but I am wondering if there is a way > that is slick enough that I would actually want to do it (as opposed > to what I would do, which would involve too many loops and points and > errors trying to get them to look nice). Not asking for mockups of > the demos above, just for hints as to how (or whether) one might > easily get nice matrix_plot-esque modular things or nicely labeled > wire-screen plots like in these examples. > > Thanks, > - kcrisman --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---