1
$\begingroup$
Plot[Evaluate[
    Input["Please input a function of x to plot with one parameter \
        \[Alpha] to manipulate"]], {x, 0, 1}]

This work without doubt. But this not

Manipulate[
    Plot[Evaluate[
        Input["Please input a function of x to plot with one parameter \
          \[Alpha] to manipulate"]], {x, 0, 1}], {\[Alpha], 0, 1}]

1) Is there a way to make it work. 2) I have no experience of cdf. But, if ever there is a way to make it work could it works in cdf ?

$\endgroup$
2
$\begingroup$

There is no reason to keep your Input inside of Manipulate, you don't want a dialog show up every time it updates, right? Probably you need something like this:

ClearAll[f, x, \[Alpha]]
f[x_, \[Alpha]_] = 
  Input["Please input a function of x to plot with one parameter \
\[Alpha] to manipulate"];
Manipulate[Plot[f[x, \[Alpha]], {x, 0, 1}], {\[Alpha], 0, 1}]

You can also take advantage of built-in math expression interpreter and enter functions in a more familiar way, like "sin(alpha pi / x)" for example:

f[x_, \[Alpha]_] = 
 Interpreter["MathExpression"][
  InputString[
   "Please input a function of x to plot with one parameter \[Alpha] \
to manipulate"]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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