# How to compile the function with FindRoot? [duplicate]

f[x_?NumberQ] := FindRoot[x == Sin[t] - t, {t, 1}][[1, -1]];

• FindRoot is not compilable: CompileCompilerFunctions[] // Sort – Ulrich Neumann Jun 13 '18 at 8:47
• Also, when you call it like this, FindRoot is probably/hopefully sufficiently optimized that you won't gain anything by Compileing. – Marius Ladegård Meyer Jun 13 '18 at 20:19
• I closed this as a duplicate of our "list of compilable functions" post. There is really not much more to say except that in basically all cases, you should not try to put FindRoot` in a compiled function. There might be some rare exceptions but usually, it is a bad idea. In general, you should be concerned about the speed of the function you want to find the roots for. If you have a very complex expression that can be compiled, then this might be worth a shot. – halirutan Jun 16 '18 at 1:35