# Plotting results of 'Do' loop in contour graph

I want to plot the results of a 'do' loop as a contour graph:

z = Reap[
Do[
Do[
Sow[
NIntegrate[Sin[a + b*x], {x, -10, 10}]
],
{b, 0, 6, 0.5}
],
{a, 0, 5, 0.5}
]
]


I get a list of values, but I'm not sure of the best way to rearrange everything to be able to plot a b vs a contour of z.

• Would Table and ListContourPlot be any help? – Michael E2 Mar 11 '16 at 11:55
• Related: (97293), (104318) – Michael E2 Mar 11 '16 at 12:18

Why numerically integrate when you can precisely integrate?

ArrayPlot@(z=Table[
Integrate[Sin[a + b x], {x, -10, 10}],
{b, 0, 6, 0.5},
{a, 0, 5, 0.5}])


or

ListPlot[z,
Joined -> True,
PlotRange -> All]

• Yes, but I've just posted a MWE - I'm working on an integral that may not have an analytical solution. – Medulla Oblongata Mar 11 '16 at 11:01
• What is the integral you seek? By the way, you should almost never use Do in Mathematica... there are almost always superior ways to iterate, most notably Table. – David G. Stork Mar 11 '16 at 11:03
• Since you're interested, math.stackexchange.com/questions/1692773/… and I want to vary the 1 and 4, like a and b in this example. – Medulla Oblongata Mar 11 '16 at 11:03