<< Algebra`ReIm`;
f[x_] := x /: Im[x] = 0;
f /@ {X, r, Ro, U};
proud = (U/(I*X + r + Ro));
prkv = Re[proud]^2 + Im[proud]^2;
prikon = prkv*(r + Ro);
Solve[D[prikon, Ro] == 0, Ro];
ucinnost = Ro/(Ro + r) /. %;
hodn = {cosfi ->  0.4,  r -> 1, 
          x -> 1};
ηPmax = ((Sqrt[(r^2) + (x^2)])/((Sqrt[(r^2) + (x^2)]) + r))
res = Solve[Tan[ArcCos[cosfi]] == (x/r), 
          r][[1]]
ηPmax /. res /. hodn