Two-dimensional grid of points

marc1234 shared this question 4 years ago
Answered

Hello!

I want to create a grid of points. The sequence command works nicely for a single line of the grid:

Sequence[(i,0),i,-5,5]

But I need two variables for the coordinates of the points. I tried nesting two sequence commands like this:

Sequence[Sequence[(i,j),i,-5,5],j,-5,5]

This does almost what I want. But instead of a list of points I get a list of lists of points like this:

{{(0,0),(1,0),(2,0),...}, {(0,1),(1,1),(2,1),...}, ...}

I can't display the points by clicking on this object.

Any ideas how I can display my grid of points?

Thanks a lot in advance!

Comments (4)

photo
1

I just realized that my sequence of sequences doesn't actually do what I wrote above. So I don't have a clue at all how to get the grid.

photo
2

Only one sequence:

Sequence[(Div[n, 6], Mod[n, 6]), n, -30, 35]

photo
1

Here’s a great example.

https://www.geogebra.org/m/kvRkTCec

photo
2

I don’t think my previous link was particularly useful.

However, I just figured out how to modify abakus’ answer for 3D.

Sequence((Mod(i,n),Mod(Div(i,n),n),Div(i,n^(2))),i,0,n^(3)-1)

This creates an n×n×n cubic grid of points, starting at (0,0,0) and extending into the positive octant, i.e. (+,+,+). The numbers also increment in the order x, y, z which was more intuitive to me.

Comments have been locked on this page!

© 2023 International GeoGebra Institute