# Find the value by using FindRoot command [closed]

The equation x^4-3 x^3 = cos(3x)+3 has two real solutions on the interval from -10 to 10. Lets call these two solutions r and s. Use Mathematica's FindRoot command to find r and s. Now let M equal the sum of these two solutions, M=r+s. Enter the value for M in the space provided below.

-

## closed as off-topic by bobthechemist, Mr.Wizard♦Jan 28 at 5:52

• The question does not concern the technical computing software Mathematica by Wolfram Research. Please see the help center to find out about the topics that can be asked here.
If this question can be reworded to fit the rules in the help center, please edit the question.

If this is a homework/class problem, might want to mark it as such. –  rasher Jan 28 at 2:32
This question appears to be off-topic because it is about entering "...the value of M in the space below" but no space is provided. (Or a snarky way of stating that the OP needs to provide some effort when asking others to do homework questions for them.) –  bobthechemist Jan 28 at 4:44

Using ErsekRootSearch package

Needs["ErsekRootSearch"]
f[x_] := x^4 - 3 x^3 - Cos[3 x] - 3;
soln = x /. RootSearch[f[x] == 0, {x, -10, 10}]
(*  {-0.831448, 3.06992} *)

Total[soln]
(* 2.23848 *)


You need to edit the RootSearch.m first and change $MinPrecision=-Infinity to $MinPrecision=Infinity (there are about 5-6 places) this is because the package is old and was not updated at MathSource.

-

First, let's plot both graphs to get an idea of their points of intersection

Plot[{x^4 - 3 x^3, Cos[3 x] + 3}, {x, -3, 4}, Filling -> {1 -> {2}}]


We see that the intersections are around -1 and 3. Then using FindRoot we get:

{r, s} = x /. FindRoot[x^4 - 3 x^3 == Cos[3 x] + 3, {x, #}] & /@ {-1, 3}


{-0.831447617, 3.06992283}

Total[{r, s}]


2.23847521

-
But have you entered "the value for M in the space provided below"? Sometimes I wonder if Mathematica can generate "the space below". –  bill s Jan 28 at 3:43
@bills I'm working on it :) –  RunnyKine Jan 28 at 4:24