I'm trying to use Manipulate for plotting multidimensional data, where higher dimensions are defined as sliders.
First, this simple example works:
myfun[v1_Real, v2_Real, v3_Real, v4_Real, v5_Real] :=
Sin[v1]*Cos[v2]*v3 + v4*v5
Manipulate[
Plot3D[myfun[v1, v2, v3, v4, v5], {v1, 0, 2}, {v3, 0, 2}], {{v5,
0.5}, 0., 1.}, {{v2, 0.5}, 0., 1.},(*{{v3,0.5},0.,1.},*){{v4, 0.5},
0., 1.}]
But when the dimensions for plotting and for controls are configured to change dynamically, then Mathematica gets stuck:
Manipulate[
With[{myaxis = Sequence @@ {{v[ax1], 0, 2}, {v[ax2], 0, 2}},
mycontrols =
Sequence @@ {{{v[sl1], 0.5}, 0., 1.}, {{v[sl2], 0.5}, 0.,
1.}, {{v[sl3], 0.5}, 0., 1.}}},
Manipulate[Plot3D[myfun[v[1], v[2], v[3], v[4], v[5]], myaxis],
mycontrols]], {ax1, Range[1, 4, 1], ControlType -> Setter}, {ax2,
Range[ax1 + 1, 5, 1], ControlType -> Setter}, {sl1,
Complement[Range@5, {ax1, ax2}], ControlType -> Setter}, {sl2,
Complement[Range@5, {ax1, ax2, sl1}], ControlType -> Setter}, {sl3,
Complement[Range@5, {ax1, ax2, sl1, sl2}], ControlType -> Setter}]
How can I make the last piece of code to evaluate correctly?