Re: Re: A problem of numerical precision
- To: mathgroup at smc.vnet.net
- Subject: [mg52649] Re: [mg52637] Re: A problem of numerical precision
- From: DrBob <drbob at bigfoot.com>
- Date: Tue, 7 Dec 2004 04:09:34 -0500 (EST)
- References: <200412030815.DAA25377@smc.vnet.net> <cos0ps$dhq$1@smc.vnet.net> <200412050708.CAA26762@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
I'm using 5.1 and got very different answers. Here's the second case: delta = 1/100; a = 9/10; b = -3*1.4142135623730950``200/10; A = {{1, 0}, {b, a}}; B = {{-1, 1}, {-b, b}}; f[v_, x_] := If[Abs[(10^20)*v - (10^20)*x] > (10^20)*delta, 1, 0]; M = 3000; it = Table[0, {i, M}, {j, 2}]; it[[1]] = {-delta/2, (a + b)*(-delta/2)}; For[i = 1, i < M, it[[i + 1]] = A.it[[i]] + f[it[[i, 1]], it[[i, 2]]]*B.it[[i]]; i++]; temp = Take[it, -1000]; ListPlot[temp]; (a single point, where the other plot was a starburst) You do get the same result for both if you do this the second time: b = -3*1.4142135623730950``200/10; M = 3000; it = Table[0, {i, M}, {j, 2}]; it[[1]] = {-delta/2, (a + b)*(-delta/2)}; For[i = 1, i < M, it[[i + 1]] = A.it[[i]] + f[it[[i, 1]], it[[i, 2]]]*B.it[[i]]; i++]; temp = Take[it, -1000]; ListPlot[temp]; A and B didn't get reset, so it's a very different series. Bobby On Sun, 5 Dec 2004 02:08:18 -0500 (EST), Steve Luttrell <steve_usenet at _removemefirst_luttrell.org.uk> wrote: > In version 5.1 (Windows XP) I get exactly the same result in both cases. > > Steve Luttrell > > "Guofeng Zhang" <guofengzhang at gmail.com> wrote in message > news:cos0ps$dhq$1 at smc.vnet.net... >> >> Hi, >> >> I met one problem when I do some iteration: By increasing numerical >> precision, the results are so different from the original one! I >> don't know what went wrong, and hope to get some answers. >> >> The code is >> >> delta = 1/100; >> a = 9/10; >> b = -3*1.4142135623730950/10; >> A = { {1,0}, {b,a} }; >> B= { {-1,1}, {-b,b} }; >> >> f[v_,x_] := If[ Abs[ (10^20)*v-(10^20)*x]>(10^20)*delta, 1, 0 ]; >> >> M = 3000; >> it = Table[0, {i,M}, {j,2} ]; >> it[ [1] ] = { -delta/2, (a+b)*(-delta/2) }; >> >> For[ i=1, i<M, it[ [i+1]] = A.it[[i]]+f[ it[ [i,1] ], it[ [i,2] ] >> ]*B.it[ [i] ]; i++ ]; >> temp = Take[it, -1000]; >> >> ListPlot[ temp ]; >> >> By evaluating this, I got an oscillating orbit. I got the same using >> another system. However, if I increase the numerical precision by using >> b = -3*1.4142135623730950``200/10; >> to substitute the original b, the trajectory would converge to a fixed >> point instead of wandering around! >> >> I don't know why. I am hoping for suggestions. Thanks a lot. >> >> Guofeng >> >> -- >> Guofeng Zhang >> PhD student >> Dept. of Mathematical and Statistical Sciences >> University of Alberta >> Edmonton AB >> Canada T6G 2G1 >> www.ece.ualberta.ca/~gfzhang >> > > > > > -- DrBob at bigfoot.com www.eclecticdreams.net
- References:
- Re: A problem of numerical precision
- From: "Steve Luttrell" <steve_usenet@_removemefirst_luttrell.org.uk>
- Re: A problem of numerical precision