# FindRoot outputs a lot of nlum and ReplaceAll errors before outputting (close) root

I'm trying to find the root of the root function when some other variable is subtracted. I.e. FindRoot[root[theta, r, h]-H, theta]

Whenever I do this, FindRoot outputs a lot of error messages and then continues on to output a very close approximation to the root of the function. Can anyone shed any light onto why this is for me?

Error messages look like so:

• Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 May 28 '16 at 16:35
• People here generally like users to post code as Mathematica code instead of images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. – user9660 May 28 '16 at 16:36

f[θ_, r_, x_, h_] =
1/2 x (r^2 ArcCos[(r - x Cot[θ])/r] + (x Cot[θ] - r) Sqrt[
x Cot[θ] (2 r - x Cot[θ])]) - π r^2 h;


Functions which use numeric techniques should have their arguments restricted to numeric values.

root[θ_?NumericQ, r_?NumericQ, h_?NumericQ] :=
x /. FindRoot[f[θ, r, x, h], {x, 2}]

FindRoot[root[θ, 3.7, 2.6] - 10.7, {θ, 1}]

(*  {θ -> 1.24469}  *)

root[θ /. %, 3.7, 2.6] - 10.7

(*  3.55271*10^-15  *)

FindRoot[root[θ, 4, 2.2] - 10.7, {θ, 1}]

(*  {θ -> 1.25971}  *)

root[θ /. %, 4, 2.2] - 10.7

(*  -3.55271*10^-15  *)