Re: dynamicmodule with f[x_] possible?
- To: mathgroup at smc.vnet.net
- Subject: [mg104535] Re: dynamicmodule with f[x_] possible?
- From: matthew kooshad <matthewkooshad at gmail.com>
- Date: Tue, 3 Nov 2009 02:55:20 -0500 (EST)
- References: <18085121.1257066820723.JavaMail.root@n11> <hcl3p7$bsr$1@smc.vnet.net>
i tried this, but no luck: 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*)] On Nov 1, 4:57 pm, "David Park" <djmp... 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 > djmp... at comcast.nethttp://home.comcast.net/~djmpark/ > > From: matthew kooshad [mailto:matthewkoos... 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 al= l > 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}}}}]]]