Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to find the table of values of $x^2 + y^2$ in steps of 1, from $0$ to $5$ for $x$ and $y$, together with the position $(x,y)$: something like this:enter image description here

I can only display the $x^2 + y^2$ value but not the position..

Table[x^2 + y^2, {x, 0, 4, 1}, {y, 0, 4, 1}] // MatrixForm
share|improve this question

closed as off-topic by Mr.Wizard Aug 5 at 21:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Mr.Wizard
If this question can be reworded to fit the rules in the help center, please edit the question.

2  
Table[{x, y, x^2 + y^2}, {x, 0, 5}, {y, 0, 5}] // MatrixForm? –  kale Aug 5 at 12:46
    
Brilliant! Simple and Elegant. –  user44840 Aug 5 at 12:48

2 Answers 2

Table[{"x " <> ToString@x, "y " <> ToString@y, x^2 + y^2},
  {x, 0, 4, 1}, {y, 0, 4, 1}] // MatrixForm

enter image description here

share|improve this answer
foo = Array[{##, Dot[{##}, {##}]} &, {#, #}, 0] &
foo @ 5  // MatrixForm

enter image description here

share|improve this answer

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