# Solution of recursive equations with FixedPointList

I want to solve an equation numerically for given starting values, then evaluate 3 integrals for this solution, set the results to the new starting values and iterate until the result converges. Here is what I do for given starting value:

Clear[xb, R, T, mu];
start = {1000, 3000, 0.7};
{R, T, mu} = start;
xb = xb /.FindRoot[NIntegrate[d a 2 Pi x, {x, 0, xb}] - L, {xb, 0,45}][[1]]
startneu = {NIntegrate[(r - ra) a 2 Pi x, {x, 0, xb}]/L,1/L (tc Integrate[x d a 2 Pi x, {x, 0, xb}] + tq NIntegrate[h a 2 Pi x, {x, 0, xb}]+ tl NIntegrate[a 2 Pi x, {x, 0, xb}]),  NIntegrate[lambda/vc d a 2 Pi x, {x, 0, xb}]}

Out[257]= {1000, 3000, 0.7}

During evaluation of In[256]:= NIntegrate::nlim: x = xb is not a valid limit of integration. >>
During evaluation of In[256]:= NIntegrate::nlim: x = xb is not a valid limit of integration. >>

Out[259]= 18.3864

Out[260]= {1400.11, 3438.07, 0.752977}


Now I would like to set start equal to the solution of the integrals and iterate until the result converges, ideally with FixedPointList or so, but I haven't found the right way.

• There is a typo in line 4. You need [[1]] at the end of the line. After fixing that after I copied the 5th line startneu = ... I got an error. Can you double check the code you have supplied and make corrections? Sep 17, 2015 at 14:15
• Sorry for the typo, the code should be Sep 17, 2015 at 15:28
• Thanks and sorry for the typo, I changed the code. Also, the d and r in the equations are functions. Sep 17, 2015 at 15:31

First a comment: in your code R, T and mu are not used in the function, so that it will return a constant value independently on your input.

A part from that, assuming that the formulae are fixed, the concept is this:

f[start_] :=
Module[{
xb, R, T, mu, startneu, r, ra, d, a, x, L, tq, tc, tl,
lambda, vc, h, i1, i2, i3
},
{R, T, mu} = start;
(* rest of the code *)
startneu = { i1, i2, i3 }
];

maxNumberOfIterations = 100;
result = FixedPoint[f, {1000, 3000, 0.7}, maxNumberOfIterations ]


The parameter maxNumberOfIterations avoids the function to be executed forever in case a fixed point does not exist.

Using:

result = FixedPointList[f, {1000, 3000, 0.7}, maxNumberOfIterations ]


will provide as a result the whole list of results up to the fixed point.