1
$\begingroup$

I want a list, where each entry is of the form {x,y}. I want x to go from $-\pi / 2$ all the way up to $\pi/2$. I also want y to go from $-\pi / 2$ all the way up to $\pi/2$. I want everything to increment by, let's say, 1 for now (doesn't matter really). So here's what I want to end up with:

{{-π/2,-π/2}, {-π/2,-π/2 + 1}, {-π/2,-π/2 + 2}, ..., {-π/2 + 1,-π/2}, {-π/2 + 1,-π/2 + 1}, {-π/2 + 1,-π/2 + 2}, ..., {-π/2 + 2,-π/2}, {-π/2 + 2,-π/2 + 1}, {-π/2 + 2,-π/2 + 2}, ...,{π/2,π/2}}

I basically want to create a list of every possible pair of angles, where I can define the increment. I don't really know how I would do this.

$\endgroup$
1
  • $\begingroup$ I know it was just an example. The increments would be defined by $\pi / n$ $\endgroup$ Nov 30, 2014 at 9:52

1 Answer 1

3
$\begingroup$

basically want to create a list of every possible pair of angles

Make range, then use Tuples 2 at times ?

r = Range[-Pi/2, Pi/2, 1];
(Tuples[r, 2]) // N // MatrixForm

Mathematica graphics

Update

r = Range[-Pi/2, Pi/2, Pi/3];
(c = Tuples[r, 2]) // MatrixForm

Mathematica graphics

$\endgroup$
3
  • $\begingroup$ How would I go about including the final term of {π/2,π/2} in it? $\endgroup$ Nov 30, 2014 at 10:10
  • $\begingroup$ @LonelyMathematician I made update. Need to use increment in terms of Pi (since Pi is irrational). I use Pi/3 increments. $\endgroup$
    – Nasser
    Nov 30, 2014 at 10:16
  • $\begingroup$ thank you so much. Made my life easier, as now I am going to start trying to plot (hopefully a fractal--but probably not) with this information. $\endgroup$ Nov 30, 2014 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.