# How to use Do and NestList combine?

g[x_]:=((i - 1/i)*x + (1/i)*(x/2))/2;


I want to find the following list

NumberForm[NestList[g, 0.8, 20], 16];


But don't know how to use "Do" for the values of i= {1,2,3,4,.....} varies with each step

Help would be very welcome

• Maybe g[x_, i_] := ((i - 1/i) x + (1/i) (x/2))/2; FoldList[g, 0.8, Range[20]] – BlacKow Apr 13 '16 at 17:05
• Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Apr 13 '16 at 17:22

I assume that you want to obtain following list

{0.8,g[0.8 (*with i=1*)],g[g[0.8] (*with i=2*)]...}


One way:

g[x_, i_] := ((i - 1/i) x + (1/i) (x/2))/2;
FoldList[g, 0.8, Range[20]]


Another way, if you really want to use NestList

g2[{x_, i_}] := {((i - 1/i) x + (1/i) (x/2))/2, i + 1};
First@Transpose@NestList[g2, {0.8, 1}, 20]

• Thanks a lot Dear, but I think the sequence be look like {0.8,g[0.8 (with i=1)],g[g[0.8 (with i=1)] (with i=2)]...}, Is it the same one or will be different??? – Marwat Apr 15 '16 at 17:46
• @Marwat yes it is the same one. I just dropped there "with i=1" in my description. – BlacKow Apr 15 '16 at 17:56