@elahe If you cannot solve r from z = g(r) then you could compute values of z for a number of r values. Then you could interpolate z(r) usning an appropriate interpolation function, e.g. a polynomial. You obtain interpolation:
z(r) := Σ (ai·ri)
It should be possible to solve the above for r using solve() function. Then you could use this solution in w := f(r).
Better yet you can switch the roles of z and r before interpolation so you obtain:
r(z) := Σ (bi·zi)
Then you could use this interpolation in your w := f(r). There are a number of interpolation functions available in Maple. Splines are one of the best but have limitted number of derivatives. Polynomials have N (number of data points ) derivatives but may oscillate around your data if N is too small. Try your interpolation by plotting both your points and function to se if interpolation is right. If you compute a large number of points then a spline of order 1 (straight line) may be used.