Bill Allombert on Sun, 08 Oct 2017 20:33:45 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: a(n+1) = log(1+a(n))


On Sun, Oct 08, 2017 at 06:20:15PM +0000, Jacques Gélinas wrote:
> 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.

See  ???memoize, ??call

Cheers,
Bill