# Getting table headings when creating a table with two variables

I have created a table, and I want the variables that run through to create it, as the headings in their respective place.

So when my table is created by variable a and b, each going from 1 to 10 with step 1, I would like to get the table in a form that horizontal I have a and vertical I have b, and the values put in in their correct place.

Is there a way to achive that?

TableForm[Table[f[a, b], {a, 10}, {b, 10}],
TableHeadings -> {Range, Range}, TableSpacing -> {1, 1}] That's just the simplest 10-by-10 example, which is what the original question asked. Here's something close to what the first comment below asks for:

TableForm[Table[f[a, b], {a, 3, 30, 3}, {b, 60, 100, 10}],
TableHeadings -> {Range[3, 30, 3], Range[60, 100, 10]}, TableSpacing->{1, 1}] The form inside the table is just to indicate that whatever actual function you might use. For example:

f[x_, y_] := N[Sin[x] Log[y]]
TableForm[Table[f[a, b], {a, 3, 30, 3}, {b, 60, 100, 10}],
TableHeadings -> {Range[3, 30, 3], Range[60, 100, 10]},
TableSpacing -> {1, 1}, TableAlignments -> "."] If this is not the sort of display you're trying to obtain, then you'll have to explain in greater detail, and with a specific example of the desired output.

• Sorry, i dont understand :( For example my A goes from 3 to 30 in steps of 3 and my b goes from 60 to 100 or something. I dont want to get the numbers displayed 1,2,3,4, i just want the values that goes into the calculation at that spot to be the headings. – Stephan Ketterer Sep 30 '14 at 14:51

When you create a table or matrix using the Table command, you want the variable that goes with the rows to come first, and the variable for the columns to come second.

mytable = Table[f[a, b], {a, 1, 10}, {b, 1, 10}];


Then to view the results in a visually pleasing manner, use TableForm

mytable // TableForm 