This version runs fine:
T[x_] := (3/4)*(x + 1/x);
m = 1;
a0 = 1;
iterations = 5;
a = {N[a0]};
b = {};
c = {};
implicitEquation[a_, c_] := c == (m/(m + 1))*a + (1/(m + 1))*T[c]
n = 1;
converged = True;
While[n <= iterations && converged,
(*Solve for c implicitly*)
Print["Iteration: ", n];
Print["Current a[[n]]: ", a[[n]]];
csol = Quiet[FindRoot[implicitEquation[a[[n]], c], {c, a[[n]]}]];
If[NumericQ[csol[[1, 2]]],
(*Append the found csol to the list*)
c = Append[c, N[csol[[1, 2]]]];
(*Calculate b_n*)
bsol = T[c[[-1]]];
b = Append[b, N[bsol]];
(*Calculate a_(n+1)*)
asol1 = T[bsol];
a = Append[a, N[asol1]];
Print["Computed c_n: ", c[[-1]]];
Print["Computed b_n: ", bsol];
Print["Computed a_(n+1): ", asol1];,
(*Handle non-numeric c_n*)
converged = False;
MessageDialog["Error: Non-numeric value
encountered in iteration " <> ToString[n]];];
n++;]
(*Display the results in a table*)
TableForm[Transpose[{Range[0, Length[a] - 1], a}],
TableHeadings -> {None, {"Iteration", "a"}}]
(*Plot the results*)
ListLinePlot[a, PlotMarkers -> Automatic,
GridLines -> Automatic, AxesLabel -> {"Iteration", "a"},
PlotLabel -> "Implicit Iterations of Example 4"]
I personally would do the iteration using NestList
:
NestList[Function[a, T[T[1/5 (2 a + Sqrt[15 + 4 a^2])]]],
a0, 5] // N