Re: need help avoiding underflow errors in Nestlist
- To: mathgroup at smc.vnet.net
- Subject: [mg40830] Re: [mg40817] need help avoiding underflow errors in Nestlist
- From: Bobby Treat <drmajorbob+MathGroup3528 at mailblocks.com>
- Date: Mon, 21 Apr 2003 06:54:52 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Here's a function g that has the underflow problem you mention: g[u : {a_, b_, c_, d_}] := u{a^3, a*b*c, b*c*d, u.Reverse@u/4} NestList[g, Table[Random[], {4}], 20] Here are a few ways to use Chop at each step: NestList[Chop@g@# &, Table[Random[], {4}], 25] NestList[Chop[g@#, .0001] &, Table[Random[], {4}], 25] NestList[Chop[g@#, 10^-10] &, Table[Random[], {4}], 25] or gChopped = Chop@g@# &; NestList[gChopped, Table[Random[], {4}], 25] Bobby -----Original Message----- From: D. D. Kapan <ddkapan at yahoo.com> To: mathgroup at smc.vnet.net Subject: [mg40830] [mg40817] need help avoiding underflow errors in Nestlist Hi, I have defined g to takes four values between 0 & 1 and then then return four values on this same interval from a system of four coupled equations. >g[{px1a_, px2a_, py1a_, py2a_}]= {px1p, px2p, py1p, py2p} /. pars3 // Simplify; where p**p are p' versions of four differential equations that work correctly(not shown). I would like to use NestList to generate a series of simsize*simsize simulation of simtime+1 from random starting points and what I have works: >Table[NestList[g, {Random[], Random[], Random[], Random[]}, simtime], {simsize}, {simsize}]; except, depending on initial conditions & for some parameter values, the equation(s) smoothly move towards zero (as they should) and eventually cause underflow problems. What I would like to do is modify g to only calculate down to an arbitrarily small number (e.g. 10^-10) and otherwise return 0 when "nesting" with Nestlist. I am aware of Chop and its arguments, but I haven't been able to implement a redefinition of g such that Chop functions inside the Nestlist or a better call to Nestlist to do the same. I have tinkered with many other functions (including NestWhileList & FixedPointList) but I am stumped since I would like the output to create a non-ragged array. Any help would be greatly appreciated! Durrell