MathGroup Archive 2009

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

Search the Archive

Re: Re: dynamicmodule with f[x_] possible?

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

ok, thanks for the note about N@.

any idea why it doesn't work to put the derivative (N@f'[x]) there
rather than simply N@f[x] ?

thanks!

On Tue, Nov 3, 2009 at 2:16 PM, DrMajorBob <btreat1 at austin.rr.com> wrote:
> anything@anythingElse is the same thing as anything[anythingElse]. Look u=
p
> "Prefix" in Help.
>
> It only works when "anything" accepts a single argument, of course.
>
> And yes... both versions need f defined (unless you want results in terms=
 of
> an unknown f).
>
> Bobby
>
> On Tue, 03 Nov 2009 01:50:44 -0600, Matthew Kooshad
> <matthewkooshad at gmail.com> wrote:
>
>> 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}}}}]]]
>>>
>>>
>>>
>>
>
>
> --
> DrMajorBob at yahoo.com
>


  • Prev by Date: Re: Set::setps error? Twitter.m's OOP-like approach?
  • Next by Date: Re: Conventional way of doing "struct"-like things?
  • Previous by thread: Re: Re: dynamicmodule with f[x_] possible?
  • Next by thread: Re: Re: dynamicmodule with f[x_] possible?