I am new to Mathematica and reading my way through a few books. Playing around with Manipulate
and I noticed the following does not work:
y[x_]:=x^n;
plot := Plot[y[x],{x,0,10}, AspectRatio->1];
Manipulate[plot,{n,1,5}]
I expected the above to work as I am using SetDelayed
in my function definition so not sure if I understand why this doesn't work.
However the following does work.
Manipulate[
Module[{y,x,plot},
y[x_]:=x^n;
plot := Plot[y[x],{x,0,10}, AspectRatio->1];
Show[plot]
],
{n,1,5}
]