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: [mg104596] Re: [mg104511] Re: [mg104470] dynamicmodule with f[x_] possible?
  • From: Matthew Kooshad <matthewkooshad at gmail.com>
  • Date: Wed, 4 Nov 2009 01:39:37 -0500 (EST)
  • References: <18085121.1257066820723.JavaMail.root@n11> <005701ca5af2$c7c19ae0$5744d0a0$@net>

oh sorry, i had posted it to the group, but maybe it didn't go through
properly. i looked on the group and was able to see it.
here it is:
f[x_] := 0
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*)]

you see i am using the derivative there in the addition , subtraction,
and multiplication calculations. it is not using the derivative there
in the calculations however...

thanks again for your help on figuring this out :)

On Tue, Nov 3, 2009 at 5:22 PM, DrMajorBob <btreat1 at austin.rr.com> wrote:
> I have no idea what pieces of code you're putting together to see a failu=
re.
> Send a complete example.
>
> Bobby
>
> On Tue, 03 Nov 2009 14:18:22 -0600, Matthew Kooshad
> <matthewkooshad at gmail.com> wrote:
>
>> 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
>>> up
>>> "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 ter=
ms
>>> 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 replacin=
g 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
>>>
>
>
> --
> DrMajorBob at yahoo.com
>


  • Prev by Date: Re: DateListBarChart / Ticks in BarChart
  • Next by Date: Re: ForAll testing equality, and Limit evaluating wrong
  • Previous by thread: Re: Re: dynamicmodule with f[x_] possible?
  • Next by thread: Re: Re: dynamicmodule with f[x_] possible?