FindRoot
[f, {x, $x_0$}]x=$x_0$
.FindRoot
[lhs == rhs, {x, $x_0$}]lhs == rhs
. FindRoot
by default uses Newton's method, so the function of interest should have a first derivative.
FindRoot[Cos[x], {x, 1}]
FindRoot[Sin[x] + Exp[x],{x, 0}]
FindRoot[Sin[x] + Exp[x] == Pi,{x, 0}]
FindRoot
has attribute HoldAll
and effectively uses Block
to localize x.
However, in the result x will eventually still be replaced by its value.
x = "I am the result!";
FindRoot[Tan[x] + Sin[x] == Pi, {x, 1}]
Clear[x]
FindRoot
stops after 100 iterations:
FindRoot[x^2 + x + 1, {x, 1}]
Find complex roots:
FindRoot[x ^ 2 + x + 1, {x, -I}]
The function has to return numerical values:
FindRoot[f[x] == 0, {x, 0}]
The derivative must not be 0:
FindRoot[Sin[x] == x, {x, 0}]
FindRoot[x^2 - 2, {x, 1,3}, Method->"Secant"]