# single root of a cubic function

As it can be shown that the function f(x)=3x^3-9x+1 has a single root in the interval abierto (0,1). Try to solve using Newton Raphson method, but that is more than a demonstration calculation

-

f[x_] = 3 x^3 - 9 x + 1;

Solve[{f[x] == 0, 0 < x < 1}, x] // N


{{x -> 0.111574}}

Reduce[{f[x] == 0, 0 < x < 1}, x] // ToRules // N


{x -> 0.111574}

FindRoot[f[x], {x, .5}]


{x -> 0.111574}

Newton-Raphson

x -> FixedPoint[# - f[#]/f'[#] &, .5]


x -> 0.111574

-

Try the following form of FindRoot:

FindRoot[f[x], {x, 0, 1}, Method -> "Brent"]


This form with the Method -> "Brent" gives very good performance and stable results even in pathological cases (when two roots of the cubic equation are very close to each other but only one of them lies in the interval {0, 1}).

-
+1 for a vocabulary lesson :) –  mfvonh Jun 6 '14 at 5:08
@mfvonh "+1"? You forgot to actually upvote. :) –  Alexey Popkov Jun 6 '14 at 5:12
details, details –  mfvonh Jun 6 '14 at 5:19
What kind of details do you need? –  Alexey Popkov Jun 6 '14 at 5:25
Oh I was just making light of the fact that I missed the all-important "detail" (upvoting, now fixed :D) –  mfvonh Jun 6 '14 at 5:32