I have this manipulate
Manipulate[
If[filllower > fillupper, filllower = fillupper];
Grid[{{Show[
Plot[(Sqrt[2] Sin[n \[Pi] x])^2, {x, 0, 1},
PlotRange -> {{0, 1}, {0, 2}}],
If[filllower == fillupper,
Plot[(Sqrt[2] Sin[n \[Pi] x])^2, {x, 0, 1},
PlotRange -> {{0, 1}, {0, 2}}],
Plot[(Sqrt[2] Sin[n \[Pi] x])^2, {x, filllower, fillupper},
Filling -> 0, PlotRange -> {{0, 1}, {0, 2}}]],
AxesLabel -> {"x", "probability density"}, ImageSize -> 500,
AspectRatio -> .25,
PlotLabel ->
Grid[{{Row[{Style[
"probability = " <>
ToString[
NumberForm[
Abs[Integrate[(Sqrt[2] Sin[n \[Pi] x])^2, {x,
filllower, fillupper}]], {4, 3},
NumberPadding -> {"", "0"},
ExponentFunction -> (Null &)]], "Label"],
Style[" | ", GrayLevel[.5]],
Style["quantum number = " <> ToString[n], "Label"]}]}}],
ImagePadding -> {{50, 50}, {30, 50}}]}, {Plot[(Sqrt[2] Sin[
n \[Pi] x]), {x, 0, 1}, Frame -> True, ImageSize -> 500,
PlotRange -> {-Sqrt[2], Sqrt[2]},
PlotLabel -> Style["wave function of the electron", "Label"],
AspectRatio -> .3, ImagePadding -> {{50, 50}, {50, 30}}]}}],
"X3" -> {{n, 1, "quantum number"}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
ControlType -> SetterBar},
"X" -> {{filllower, 0, "lower limit"}, 0, 1, Appearance -> "Labeled"},
"Y" -> {{fillupper, 1, "upper limit"}, 0, 1,
Appearance -> "Labeled"}]
but i want to have a condition ... for n
odd ( 2 4 6 8 10, continuous this way ...
but for n
even ( 1 3 5 7 ), changes all sin by cos - this is the only change .. and the same plot ... so for n odd, continuous sin
and sin^2
, and for n even, change sen by cos
and cos^2
... how can i do that ? and if its possibles, up to the plots , in the manipulate, show the expression and show modifyng the n value.
n
odd ( 2 4 6 8 10 ... " ? (Same for even.) $\endgroup$