# Mathematica Manipulate[] for plotting a function of several variables

This is a sample snippet from Mathematica documentation for plotting Bessel for various n:

Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, 10},
Filling -> Axis] How can you use Manipulate[] to animate this over both x and n (so if I wanted a slider for x and n). I've tried this:

Manipulate[
Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, xmax},
Filling -> Axis],
{xmax, 0, 10 , Appearance -> "Open"}
]


But get this error: ## 1 Answer

Replace 0 in {xmax, 0, 10 , Appearance -> "Open"} with a small number (say, 10.^-5) to avoid the error:

Manipulate[Plot[BesselJ[n, x], {x, 0, xmax}, Filling -> Axis,
PlotRange -> {{0, 10}, {-.7, .7}}],
{xmax, 10.^-5, 10, Appearance -> "Open"},
{n, 1, 4, 1}] Use TogglerBar as control to select subsets of Range to as the parameter n:

Manipulate[Plot[Evaluate[BesselJ[#, x] & /@ n], {x, 0, xmax},
Filling -> Axis,
PlotRange -> {{0, 10}, {-.7, .7}}],
{{xmax, 6}, 10.^-5, 10, Appearance -> "Open"},
{{n, {1, 3}}, Range, TogglerBar}] • when the function is of two varibles like this:Manipulate[ Plot[Evaluate[prob[y, t, #] & /@ n], {y, 0, 2}, Filling -> Axis, PlotRange -> {{0, 2}, {0, 3}}], {{t, 10.^-5}, 0, TIMELAPSE, Appearance -> "Open"}, {{n, {1}}, Range, TogglerBar} ] it's not working and adding new filled plots, how do you do it with two vars? – SOUser Mar 6 at 17:45