# Recursive function called for specified accuracy

I have an implicit function

g=f[x,y,z,g]


which I want to call recursively, called initially with g=0. I have this working for a specified number of recursive calls rec.

h[x_, y_, z_, rec_] := Piecewise[{{f[x, y, z, 0],
rec == 0}}, f[x, y, z, h[x, y, z, rec-1];


Is there a neat way build a function keeps increasing rec until the change in h falls below a certain threshold?

thanks,

• Maybe FixedPoint would help. – bill s Apr 23 '18 at 2:59
• Perhaps NestWhile would be relevant – user42582 Apr 23 '18 at 6:02

h[x_, y_, z_] := Last[NestWhileList[f[x, y, z, #] &, 0, Abs[#1 - #2]/#2 > 0.01&, 2]]