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
.
As discussed in comments, here's a possible approach:
Manipulate[
Plot[f[x], {x, 0, 2 Pi}], {f, {Sin, Cos, Tan, Cot, #^2 & -> x^2,
1/# & -> "1/x"}, ControlType -> SetterBar}]
Which results in:
This works.
Manipulate[Plot[f[x],{x,0,2 Pi}],{f,{Sin[#]^2 &,#^2&,Cos,Tan,Cot}}]
David.
#^2 & -> x^2, 1/# & -> 1/x
, as you also might want the labels for the pure functions? $\endgroup$&
. Thanks. If you post as an answer, I can accept. $\endgroup$