MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Execute commands with CDF player

  • To: mathgroup at
  • Subject: [mg121057] Re: Execute commands with CDF player
  • From: John Fultz <jfultz at>
  • Date: Thu, 25 Aug 2011 07:06:14 -0400 (EDT)
  • Delivered-to:
  • Reply-to: jfultz at

The definition of f has to be inside the Manipulate.  There are two typical ways 
to do this.

(* save external definitions in the Manipulate by default *)
Manipulate[Plot[f[x, a], {x, 0, 10}], {a, 1, 5}, SaveDefinitions->True]

(* add an initialization which explicitly sets up the required definitions*)
Manipulate[Plot[f[x, a], {x, 0, 10}], {a, 1, 5},
             Initialization:>(f[x_,a_]:=Sin[a x])]

Incidentally, this has nothing to do with would have experienced 
exactly the same issue with a garden variety notebook when initially opened
(except, of course, that you could have re-evaluated the cells in that case).


John Fultz
jfultz at
User Interface Group
Wolfram Research, Inc.

On Wed, 24 Aug 2011 03:14:22 -0400 (EDT), Joerg Roesgen wrote:
> Hi,
> I am missing something about this CDF player. On the Wolfram website they
> say it's all so easy. Just take your notebook and save it as a CDF, and
> all is fine and dandy. But it's not. I made a notebook with one single
> cell.
> f[x_, a_] := Sin[a x]
> Manipulate[Plot[f[x, a], {x, 0, 10}], {a, 1, 5}]
> All works fine up to here.
> Now, I save it as CDF and open it with the CDF player. Well, but nothing
> is executable or does anything. I see the two lines of input; and
> otherwise there is just an empty box displayed from the Manipulate
> command, but the CDF player does not understand who f[x,a] is.
> So, what now?
> Thanks,
> JR

  • Prev by Date: Re: decoding inbuilt function
  • Next by Date: FindRoot repeatedly evaluating function
  • Previous by thread: Re: Execute commands with CDF player
  • Next by thread: Incompletely simplified Square root.