MathGroup Archive 2009

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

Search the Archive

Re: Dynamic Module

  • To: mathgroup at
  • Subject: [mg96018] Re: [mg95943] Dynamic Module
  • From: Murray Eisenberg <murray at>
  • Date: Sun, 1 Feb 2009 04:42:12 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <>
  • Reply-to: murray at

Just include in your DefaultOptions list the additional option:

   BaseStyle -> 20

Note that there's a flaw in your code, though: since n and p don't get 
initialized, as soon as you evaluate the DynamicModule you get an error 
with the raw code showing (using local variables FE`n$$xx,FE`p$$yy) in 
the "simulated X" field.

John wrote:
> Mathematica 6 help has an example of a dynamic module used to
> construct a dynamic calculating interface. I used it to create a
> calculating interface that simulated X (the number of bad units in a
> sample) when X has the binomial distribution with parameters n (sample
> size) and p (the binomial probability). Values of n and p are entered
> in input fields and the answer appears in a third field.
> It works, but not perfectly. The binomial distribution is momentarily
> confused when  new values of n and p are entered, apparently because,
> for a second or two, n and p have no values. Once the new values are
> entered, the confusion ends and the answer appears.
> I have not yet found a way to change font size in the fields. As it
> is, the font is too small when the panel is projected on a screen.
> My dynamic model is listed below:
>  DynamicModule[{n, p},
>  Deploy[Style[
>    Panel[Grid[
>      Transpose[{{Style["enter n", 20], Style["enter p", 20],
>         Style["simulated X", 20]}, {InputField[Dynamic[n], Number],
>         InputField[Dynamic[p], Number],
>         InputField[
>          Dynamic[ Total[RandomInteger[BinomialDistribution[n, p], 1]],
>            Number], Enabled -> False]}}], Alignment -> Right],
>     ImageMargins -> 10],
>    DefaultOptions -> {InputField -> {ContinuousAction -> True,
>        FieldSize -> {{5, 30}, {1, Infinity}}}}]]]
> What does Alignment-> Right do? I changed it to left, and the
> appearance of the panel was exactly the same.
> Any suggestions will be greatly appreciated.
> John

Murray Eisenberg                     murray at
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

  • Prev by Date: Re: MCMC in Mathematica
  • Next by Date: Re: Significant slow-down with Mathematica
  • Previous by thread: Re: Mathematica and LyX - Graphics and equations
  • Next by thread: Dynamic Module