# Create a list of plots of sin(xt), where x goes from 0 to 10 and t goes from 1 to 6

I would like to create a table like the one shown below in mathematica: Here is the code i wrote: I was wondering if there is more efficient way to writing the code where i don't have to type out individual sin(xt) for each value of x and t.

This is a modified version of the question that is in the book "Hands-on Start to Wolfram Mathematica and Programming with the Wolfram Language, Second Edition". If anyone has the pdf solutions to the all exercises in the book, would you be able to send it to me?

(* create your values *)
rows = Range;
cols = Range;
vals = Outer[Sin@*Times, rows, cols];
(* make a table *)
tf = TableForm[N@vals, TableHeadings -> {rows, cols}];
(* label it *)
Labeled[tf, {"x-vals", "t-vals"}, {Left, Top}, RotateLabel -> True]


You may want to use NumberForm for a nicer display of the values. E.g.,

vals = Map[NumberForm[#, {4, 3}] &, vals, {2}]
tf = TableForm[N@vals, TableHeadings -> {rows, cols},
TableAlignments -> Right]; Here is one way:

table = ConstantArray["", {12, 8}];
table[[3 ;;, 3 ;;]] = Table[N@Sin[x t], {x, 10}, {t, 6}];
table[[1, 3 ;;]] = Range;
table[[1, 2]] = "t-values";
table[[2, 1]] = "x-values";
table[[3 ;;, 1]] = Range;
Grid[
table,
Alignment -> Left,
Frame -> True,
Dividers -> All
] The title of your question refers to "plots of sin(x t)." You could also add the literal plots as Tooltips to the table headings. Using Alan's answer as a starting point.

(*create your values*)
rows = Range;
cols = Range;
vals = Outer[Sin@*Times, rows, cols];
(*make a table*)
tf = TableForm[N@vals,
Tooltip[#,
Show[
Plot[Sin[#*t], {t, 0, cols[[-1]]}],
DiscretePlot[Sin[#*t], {t, 1, cols[[-1]], 1},
PlotStyle -> Red],
AxesLabel ->
(Style[#, 12, Bold] & /@ {"t", "Sin[x t]"}),
PlotLabel -> StringForm["x = ", #]]] & /@ rows,
Tooltip[#,
Show[
Plot[Sin[x*#], {x, 0, rows[[-1]]}],
DiscretePlot[Sin[x*#], {x, 1, rows[[-1]], 1},
PlotStyle -> Red],
AxesLabel ->
(Style[#, 12, Bold] & /@ {"x", "Sin[x t]"}),
PlotLabel -> StringForm["t = ", #]]] & /@ cols}];
(*label it*)
Labeled[tf, {"x-vals", "t-vals"}, {Left, Top},
RotateLabel -> True]