# How to make a CDF document with dynamic content?

I would like to create a CDF document that uses dynamic content. The example code is:

fun=x^2-1;
InputField[Dynamic[fun]]


And what I get is \$Aborted instead of interactive document. How to make a useful document?

EDIT:

What I am really trying to do is to make a CDF document in which the given function is plotted. Initially the function is x^2-1, but the user should be able do input any function.

-

## 2 Answers

Actually doing

CDFDeploy["test.cdf", Manipulate[
Plot[fun, {x, 0, 10}],
{fun, x^2 - 1}], Method -> "Standalone"]


you will see that the FreeCDF will not let you do what you want, i.e., some interaction like you get in normal Mathematica by:

Manipulate[
Plot[fun, {x, 0, 10}],
{fun, x^2 - 1}]


Check out the differences between FreeCDF and Enterprise CDF http://www.wolfram.com/cdf/adopting-cdf/licensing-options.html

The important little detail is "arbitary input fields": this is just not enabled in FreeCDF. So, it looks like you have to get Mathematica Enterprise in order to produce EnterpriseCDF's.

Oh, and don't forget to "Contact the CDF Team" : http://www.wolfram.com/cdf/contact-us/

-
Well... that is a pity, but I don't think that I will spend 5,6k pounds just to let my students make interactive plots :p So the question is: what can I do with Standard edition? – Misery Jan 4 '13 at 12:04
So... If I made an application in Mathematica, it would be useful only if someone had CDF-pro or if I made those CDF files using Enterprise edition of Mathematica. Am I right? – Misery Jan 5 '13 at 8:53
I cannot find any official information for the situation in Mathematica 9. Maybe Andre or someone else officially from WRI can answer... It seems unclear right now. – Rolf Mertig Jan 5 '13 at 21:21

This may do what you want:

InputField[Dynamic[x, (x = #^2 - 1) &]]

-
That looks nice, but only for functions like x^2-1. But what if I would like to put there any function. – Misery Jan 4 '13 at 10:38
(x = f[#])& is also OK, assuming that you have defined the 1-argument function f elsewhere. – Stephen Luttrell Jan 4 '13 at 10:54
Thank you! Your answer is very good. I just wasn't aware of limitations of CDF files :( – Misery Jan 5 '13 at 8:50