# Loops and Graphics in Mathematica

I want to create a loop in Mathematica such that it creats multiple graphs for me. For example, I have a command of the form:

Plot3D[new[α, χ, τ] - old[τ], {α, 0, 2 π}, {χ, 0, π}, MaxRecursion -> 0,
AxesLabel -> Automatic] .


I can make a 3D graph for, say, τ = 0.1. What if I want to make multiple graphs for multiple values of τ -- say, for τ = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 and 1.0. That is, for 10 different vales of τ.

Edit: I couldn't find an appropriate tag for 'loops.'

old[τ_] := Sin[τ]
new[α_, χ_, τ_] := Sin[α τ]^2 + Cos[χ τ]^2

result = Table[Plot3D[ new[α, χ, τ] - old[τ], {α, 0, 2 π}, {χ, 0, π},
MaxRecursion -> 0, AxesLabel -> Automatic] , {τ, 1/10, 1, 1/10}]
Export["result.gif", result]


Or use Animate

Animate[Plot3D[ new[α, χ, τ] - old[τ], {α, 0, 2 π}, {χ, 0, π},
MaxRecursion -> 0, AxesLabel -> Automatic] , {τ, 1/10, 1, 1/10}]


For one graph use:

f = Table[new[α, χ, τ] - old[τ], {τ, 1/10, 1, 1/10}]
cd = Table[ColorData[97, c], {c, 10}]

Plot3D[Evaluate@f, {α, 0, 2 π}, {χ, 0, π},
MaxRecursion -> 0, AxesLabel -> Automatic, PlotStyle -> cd]


• Actually, I want them on separate graphs -- and not one. – Junaid Aftab Jul 22 '16 at 20:09
• @JunaidAftab Updated – Young Jul 22 '16 at 20:12
• This seems a flag in the wind – LCarvalho Nov 19 '16 at 16:38