Message Boards Message Boards

0
|
4864 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Using decimals in recurrence tables

Posted 12 years ago
I'm trying to have the recurrence table find roots of a function, but I can only use these numbers in the equation:
RecurrenceTable[{ a[n + 1] == a[n] + 1, a[1] == 0, p[n + 1] == b[n], p[1] == 1, r[n] == p[n]^2*(p[n]^2*(231*p[n]^2 - 315) + 105) - 5, d[n] == p[n]*(p[n]^2*(1386*p[n]^2 - 1260) + 210), b[n] == (d[n]*p[n] - r[n])/d[n]}, {a, p, r, d, b}, {n, 2}, DependentVariables -> {a, p, r, d, b}]
and it gives exact fraction answers.
There are three problems though.
1) when I try to have p[1]==0.5 or any decimal, it wants to abort
2) when using decimals in p,d,or b, it stalls
3) it runs out of memory when n>4

All I want is to have p[1] at a decimal and I also want to have decimal approximation.  I would use N but it needs n and Scientific form doesn't seem to work.  How can I get itterations approximate to 10^-10 or even make it to n=20 ?
POSTED BY: Zack deZorro
2 Replies
Posted 12 years ago
Thanks, that helped a lot.  r, d, and b were actually the functions I was trying to use but I can maipulate the original functions to help me in my itterations using NestList.
POSTED BY: Zack deZorro
Posted 12 years ago
 In[1]:= f[{a_, p_, r_, d_, b_}] := {a+1, b, p^2*(p^2*(231*p^2-315)+105)-5, p*(p^2*(1386*p^2-1260)+210), (d*p-r)/d};
 NestList[f, {0., 1., 2., 3., 1.(*<--Need correct initial values for r,d and b *)}, 10]
 
 Out[2]={{0., 1., 2., 3., 1.},
 {1., 1., 16., 336., 0.33333},
 {2., 0.33333, 16., 336., 0.95238},
 {3., 0.95238, 3.09465, 29.0370, 0.28571},
 {4., 0.28571, 3.46257, 197.531, 0.84580},
 {5., 0.84580, 1.59796, 33.2511, 0.26818},
{6., 0.26818, -6.52096, 15.1710, 0.79774},
{7., 0.79774, 1.00840, 33.9378, 0.69801},
{8., 0.69801, -6.21544, -24.3524, 0.76803},
{9., 0.76803, -1.90085, -52.2697, 0.44278},
{10., 0.44278, -5.25580, -39.1541, 0.73166}}
I am concerned about your not including \[n\] after all your variables in your example code.
I attempted to define a function f that does what I think your RecurrenceTable was doing.
I was not able to convince myself I knew what the initial values for r, d and b should be.
But I was able to use decimal points and carry out the iterations using NestList.
Will this do what you need, after you correct any of my errors or misunderstandings?
This can rapidly do as many iterations as you like, just as long as your initial values all have decimal points.
POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract