MathGroup Archive 2009

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

Search the Archive

Re: dynamicmodule with f[x_] possible?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104511] Re: [mg104470] dynamicmodule with f[x_] possible?
  • From: Matthew Kooshad <matthewkooshad at gmail.com>
  • Date: Tue, 3 Nov 2009 02:50:44 -0500 (EST)
  • References: <18085121.1257066820723.JavaMail.root@n11> <005701ca5af2$c7c19ae0$5744d0a0$@net>

thanks a lot, David :)
does the 2nd example need f[x] set above it too (like f[x_] := BesselI[1,x])?
i tried the 2nd example without the f[x] set above it, and i replaced
N@f[x] with N@f'[x] , but that didn't work to show the derivative.
it's my first time to see this N@ syntax, so i'm not sure why it
didn't show the derivative. any ideas?
i wish for the derivative to be calculated each time i press enter in
the text box based on whatever function is in the inputfield.
thanks again,

On Sun, Nov 1, 2009 at 6:56 AM, David Park <djmpark at comcast.net> wrote:
> For a simple case:
>
> f[x_] := BesselI[1, x]
>
> DynamicModule[
>  {x = 0},
>  Column[{
>   Row[{"x: ", InputField[Dynamic[x], FieldSize -> {5, 1}]}],
>   Dynamic@Row[{"f[x]: ", N[f[x]]}]
>   }](* Column *)
>  ]
>
> For something like your example:
>
> DynamicModule[{x = 0, b = 0},
>  Deploy[Style[
>   Panel[Grid[
>     Transpose[{{Style["x", Red], Style["b", Red], "sum", "diff",
>        "product"}, {InputField[Dynamic[x]], InputField[Dynamic[b]],
>        InputField[Dynamic[N@f[x] + b], Enabled -> False],
>        InputField[Dynamic[N@f[x] - b], Enabled -> False],
>        InputField[Dynamic[N@f[x] b], Enabled -> False]}}],
>     Alignment -> Right](* Grid *),
>    ImageMargins -> 10](* Panel *),
>   DefaultOptions -> {InputField -> {ContinuousAction -> True,
>       FieldSize -> {{5, 30}, {1, Infinity}}}}
>   ](* Style *)
>  ](* Deploy *)
>  ]
>
>
> David Park
> djmpark at comcast.net
> http://home.comcast.net/~djmpark/
>
>
> From: matthew kooshad [mailto:matthewkooshad at gmail.com]
>
> hello, i would like to make f[x_] dynamic and based on input.
> i've tried changing "a = 0" for example to f[_x] = 0 and replacing all
> other "a" with f[x], but no luck there. will someone please guide me
> on this? thank you :)
>
> DynamicModule[{a = 0, b = 0},
>  Deploy[Style[
>   Panel[Grid[
>     Transpose[{{Style["a", Red], Style["b", Red],
>        "sum", "diff", "product"}, {InputField[Dynamic[a]],
>        InputField[Dynamic[b]],
>        InputField[Dynamic[a + b], Enabled -> False],
>        InputField[Dynamic[a - b], Enabled -> False],
>        InputField[Dynamic[ab], Enabled -> False]}}],
>     Alignment -> Right], ImageMargins -> 10],
>   DefaultOptions -> {InputField -> {ContinuousAction -> True,
>       FieldSize -> {{5, 30}, {1, Infinity}}}}]]]
>
>
>


  • Prev by Date: Re: Re: Wrong Simplify[] Answer for
  • Next by Date: Plotting with dotted lines solved (Re: plotting with dotted lines, not dashed)
  • Previous by thread: Re: dynamicmodule with f[x_] possible?
  • Next by thread: Re: dynamicmodule with f[x_] possible?