|Jacques Gélinas on Sun, 08 Oct 2017 20:20:24 +0200|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|RE: a(n+1) = log(1+a(n))|
Generating plots would involve recalculating the same logarithms over and over again, which should be avoided by precomputing them. P1 = precision(1.0); v = 2; Vh = vector(20000, n, v = log(precision(1+v,P1))); h(n) = n*(n*Vh[n] - 2) / ( log(n) + (n==1) ) pv(M,N,fn) = vector(N-M+1,n,fn(M+n-1)); pl(M=1,N=100,fn) = plothraw(pv(M,N,n->n),pv(M,N,fn),1); pl(1,20000,h) Jacques Gélinas P.S. memoize.gp by Kevin Ryde is a more elegant solution.