Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

From the documentation:

Manipulate[Plot[f[x], {x, 0, 2 Pi}], {f, {Sin, Cos, Tan, Cot}}]

How do I include a function like $1/x$ or $x^2$, etc. in that list?

I (unsuccessfully) tried 1/# and #^2.

share|improve this question
Maybe #^2 & -> x^2, 1/# & -> 1/x, as you also might want the labels for the pure functions? – Pinguin Dirk Feb 1 '13 at 16:12
@PinguinDirk: ugh, I had forgotten my closing &. Thanks. If you post as an answer, I can accept. – JohnD Feb 1 '13 at 16:18

2 Answers 2

up vote 7 down vote accepted

As discussed in comments, here's a possible approach:

Plot[f[x], {x, 0, 2 Pi}], {f, {Sin, Cos, Tan, Cot, #^2 & -> x^2, 
1/# & -> "1/x"}, ControlType -> SetterBar}]

Which results in:

enter image description here

share|improve this answer

This works.

Manipulate[Plot[f[x],{x,0,2 Pi}],{f,{Sin[#]^2 &,#^2&,Cos,Tan,Cot}}]


share|improve this answer

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.