Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14059

Re: Problem with function definition inside DynamicModule

From debguy <johnandsara2@cox.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Problem with function definition inside DynamicModule
Date 2013-04-05 02:29 +0000
Message-ID <kjlcup$b5u$1@smc.vnet.net> (permalink)
References <kjkc64$7n6$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


I have don't have Dynamic to test with in my version, but this might
help.

I think

Dynamic@Plot[f[x], {x, 0, 5}, Epilog -> p1[[1]]

should update if p1 changes but not x.  "f" is a question. I think you
said it does but f[x] does not.  Try this:

f[x_, y_] = Fit[y, Table[x^k, {k, 0, n}], x];

This definition doesn't bury dat inside f.  This may insure Dynamic
chooses the new f.

Also I'm thinking to update plot automatically when dat changes you
want to define datafit to use Dynamic[dat] rather than using dat as a
parameter.  That might be a simpler approach.

Having used Dynamic[dat] in datafit you can then have your update by
parameter with simply:

datafitupdate[x_]:=dat=x;

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Problem with function definition inside DynamicModule "Kevin J. McCann" <kjm@KevinMcCann.com> - 2013-04-04 17:10 +0000
  Re: Problem with function definition inside DynamicModule debguy <johnandsara2@cox.net> - 2013-04-05 02:29 +0000
  Re: Problem with function definition inside DynamicModule debguy <johnandsara2@cox.net> - 2013-04-05 02:29 +0000

csiph-web