I am new to Mathematica. Once I evaluate the cell containing the code, my Manipulate works as desired; however, if I open the file and do not evaluate the cell, the Manipulate goes haywire. Can anyone help please? The code below is all in the same cell.
Sequence1[n_] := { 1 / n, (-1)^n / n, 1 / Sqrt[n] };
Function1[x_] := { ( x - 2 )^2, 2 - x^2, 2^x };
Manipulate[
Grid[ { { "Function" , "Sequence of Outputs" },
{ data =
List[Transpose[{Table[ Sequence1[n][[sss]], {n, 1, t}],
Table[ Function1[Sequence1[n][[sss]]][[hhh]], {n, 1, t}]}]];
ListPlot[data, PlotRange -> {{-1, 1}, {0, 5}},
AspectRatio -> 1/1, ImageSize -> Full],
ListPlot[Table[Function1[Sequence1[n][[sss]]][[hhh]], {n, 1, t}],
PlotRange -> Automatic, ImageSize -> Full]},
{ "Close-Up" , "Tabular Values" },
{ data =
List[Transpose[{Table[ Sequence1[n][[sss]], {n, 1, t}],
Table[ Function1[Sequence1[n][[sss]]][[hhh]], {n, 1, t}]}]];
ListPlot[data, PlotRange -> {{-.1, .1}, {0, 5}},
AspectRatio -> 1/1, ImageSize -> Full] ,
If[ t < 11,
TableForm[
Transpose[ {Range[1, t],
Table[ Sequence1[n][[sss]], {n, 1, t} ],
Table[Function1[Sequence1[n][[sss]]][[hhh]], {n, 1, t}]}]],
TableForm[
Transpose[ {Range[t - 10, t],
Table[Sequence1[n][[sss]], {n, t - 10, t} ],
Table[Function1[Sequence1[n][[sss]]][[hhh]], {n, t - 10,
t}]}]]]}},
ItemSize -> {{Scaled[.4], Scaled[.4]}}, Frame -> All,
Spacings -> {2, 2}],
{{sss, 3, "sequence"}, {1 -> " 1 / n ", 2 -> " (-1)^n / n ",
3 -> "1 / Sqrt[n] "},
SetterBar}, {{hhh, 3, "f(x)="}, {1 -> "(x-2)^2", 2 -> "2-x^2",
3 -> "2^x"}, SetterBar}, {t, 1, 100, 1}]
Function1
andSequence1
, or the code for theManipulate
? $\endgroup$SaveDefinitions -> True
in theManipulate
. $\endgroup$