Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to solve this problem but FindRoot function seem unable to find the root when r equals 4.

rs = 4.015551971775909`;
e = 0.39720753208826703`;

r = {3., 3.2, 3.4, 3.6, 3.8, 4., 4.2, 4.4, 4.6, 4.8, 5., 6., 8., 10.};
Ei = {6.60253, 2.6477, 0.779688, -0.029736, -0.329679, -0.39753, -0.3717, \
-0.315756, -0.256599, -0.204246, -0.160965, -0.050085, -0.007812, \
-0.001953};
Er = Table[{r[[i]], Ei[[i]]}, {i, 1, Length[Ei]}];
pot[r_, x_] := -e (1 - (1 - Exp[-(x) (r - rs)])^2)
Do[Xi[i] = 
  FindRoot[pot[Er[[i]][[1]], x] == Er[[i]][[2]], {x, 1.6}, 
   MaxIterations -> 300], {i, 1, Length[Ei]}]
X = Table[x /. Xi[i], {i, 1, Length[Ei]}]

it reports the closest value to be 0.0000165374 and gives the below message. while the actual value should be 1.5989.

The line search decreased the step size to within tolerance specified \ by AccuracyGoal and PrecisionGoal but was unable to find a sufficient \ decrease in the merit function. You may need more than \ MachinePrecision digits of working precision to meet these tolerances.

share|improve this question

closed as off-topic by Michael E2, Öskå, acl, RunnyKine, Pickett Jul 16 at 22:50

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, Öskå, acl, RunnyKine, Pickett
If this question can be reworded to fit the rules in the help center, please edit the question.

    
The equation does not seem to have a root. (The error message sometimes arises when there is an extremum and the two sides of the equation are close to one another.) Try plotting it. –  Michael E2 Jul 15 at 19:41

1 Answer 1

up vote 1 down vote accepted

Here we can see that the two sides, for r == 4. are not equal near 1.6:

With[{i = 6},
 Plot[pot[Er[[i]][[1]], x] - Er[[i]][[2]], {x, -0.3, 1.7}, 
  PlotLabel -> Row[{"r = ", r[[i]]}]]
 ]

Mathematica graphics

Here we see it has no real solutions at all:

With[{i = 6},
 Reduce[pot[Er[[i]][[1]], x] - Er[[i]][[2]] > 0, x, Reals]
 ]

Reduce::ratnz: Reduce was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result. >>

(* True *)
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.