Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This works:

Manipulate[Plot[2*x + 3*y, {x, 3, 4}], {y, 3, 4}]

But this doesn't

f=2*x + 3*y
Manipulate[Plot[f, {x, 3, 4}], {y, 3, 4}]

My "f" is a painful long expression so I'd rather be able to get the latter method to work than work with the former.

share|improve this question
up vote 8 down vote accepted

Manipulate has to 'see' the that f depends on y, so define it as follows:

f[x_, y_] = 2*x + 3*y
Manipulate[Plot[f[x, y], {x, 3, 4}], {y, 3, 4}]

Mathematica graphics

By the way, this is mentioned in the "Possible Issues" section of the Manipulatedoc page.

share|improve this answer
Thanks a lot!. That saved me a ton of time. I usually look at "More Information" and all the options and examples but I don't always look at "possible issues". I will keep it in mind to check it every time from now on. Thx. – Amatya Aug 28 '12 at 20:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.