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: [mg104553] Re: [mg104511] Re: [mg104470] dynamicmodule with f[x_] possible?
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Wed, 4 Nov 2009 01:31:21 -0500 (EST)
  • References: <18085121.1257066820723.JavaMail.root@n11>
  • Reply-to: drmajorbob at yahoo.com

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 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: Beginning syntax problems
  • Next by Date: Re: Characteristic Function of Pareto distribution
  • Previous by thread: Re: dynamicmodule with f[x_] possible?
  • Next by thread: Re: Re: dynamicmodule with f[x_] possible?