Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 7 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
add comment

Your Answer

 
discard

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.