Message Boards Message Boards

0
|
3353 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Define equations inside Manipulate

Posted 4 years ago

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
POSTED BY: Erik Schluntz

Try using...

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

POSTED BY: Ian Williams
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract