2
$\begingroup$

Is it possible to compute a value for

n=10^9; Nest[# + Log[#] &, 2., n]

for large n? $10^9$ seems to be the max for me - is it possible to use previous results to compute piecewise, or any other workaround?

$\endgroup$
  • 2
    $\begingroup$ Have you actually tried taking the output and feeding it back in? a = Nest[#+Log[#]&, 2., 10^9]; b = Nest[#+Log[#]&, a, 10^9] Because it sounds like Nest takes a 32 bit integer for the third argument. $\endgroup$ – N.J.Evans May 14 '15 at 17:56
  • 1
    $\begingroup$ @martin glad to help! I've wasted entire days on things like this. :-/ $\endgroup$ – N.J.Evans May 14 '15 at 18:01
  • 2
    $\begingroup$ Interestingly, this function has a series expansion around 1 which begins like the following : 1 + 2^n (x0-1) + (2^(n-2) - 4*4^(n-2)) (x0-1)^2 +... for initial value x0 and n the nesting depth. I'm still working on the higher order terms $\endgroup$ – Histograms May 14 '15 at 18:45
  • 1
    $\begingroup$ @martin I can't seem to come up with a general formula for the cubic term :( but all the coefficients seem to always be divisible by a large power of 2, smaller than n. A remarkably interesting function! I was able to get the first two just by looking at the coefficients of Series[Nest[# + Log[#] &, x, n], {x, 1, 4}] for different n values. The second order term just happens to have a coefficient from this sequence. $\endgroup$ – Histograms May 14 '15 at 19:55
  • 1
    $\begingroup$ @martin So I couldn't get any further with this and I suspect the coefficients have a very complex form, but I did make this somewhat irrelevant tweet sized fractal thing out of a similar related function log(x) - x : d=0.005;n=15;t=ParallelTable[If[NumericQ@#,Abs@#,0]&@Nest[(Log@#-#)&,x0+I y0,n],{x0,-1,1,d},{y0,-1,1,d}];ColorNegate@Image[Tanh[0.65*t]] I think I can see Satan in there somewhere. $\endgroup$ – Histograms May 21 '15 at 13:09
4
$\begingroup$

So it seems that Nest is limited to 32-bit integers for the 3rd argument. The way around this is to apply Nest to the result of the first ~2^32 Nests. Supplying his own function using Fold, @martin suggests

f[x_, r_] := Nest[# + Log[#] &, x, r]; 
g[r_, times_] := Fold[f[#1, #2] &, f[2., r], ConstantArray[r, times - 1]];
 {f[2., 3*10^3], g[10^3, 3]}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.