Define equations inside Manipulate

Hi Everyone,

I’d like to define an equation and then Manipulate the input variables. This does not work if I’ve saved the expression as a variable before hand.

Manipulate[x^2, {x,-1,2}]

Works fine, but the next example just shows “x^2”:

y = x^2;
Manipulate[y, {x,-1,2}]

Should I be defining y as a Function, or using the == operator instead? I want to make sure whatever I use will work with the Solve command later, in order to work with a system of other equations.

Thanks!

  • Erik

Try using…

With[{y = x^2}, Manipulate[y, {x, -1, 2}]]