# Finding roots of a non linear function - Working precision and accuracy goal error

Consider the following function

F[v_,a_]:=-((v (16 - 176 a + 144 E^(v/2) + 176 a E^(v/2) - 160 E^v - 16 a v -
16 E^(v/2) v + 16 a E^(v/2) v + 16 E^v v +
16 a E^(v/2) v^2))/((-4 + 4 E^(v/2) + 4 a v) (-4 + 4 E^(v/2) +
4 E^(v/2) v)));


here v is the state variable and a is a parameter.

when I change a the function changes the number of solutions (roots, i.e F[v,a]==0)

I'm attempting to construct a code in which I'll obtain all roots as a function of a. To achieve this what I attempt to do is make a table where I scan all possible initial conditions using FindRoot and then delete the duplicates.

I have a problem however using FindRoot as it gives me false roots and the following error

FindRoot::lstol: 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.


here are two examples where FindRoot:

1.finds a false root (where FindRoot finds a false root there is only a single one)

Plot[F[v, 0.4], {v, -15, 15}]
FindRoot[F[v, 0.4] == 0, {v, 10}]
FindRoot[F[v, 0.4] == 0, {v, -0.1}]


1. finds the correct root where a is varied and a new root appears
Plot[F1[v, 0.6], {v, -15, 15}]
FindRoot[F1[v, 0.6] == 0, {v, 10}]
FindRoot[F1[v, 0.6] == 0, {v, -0.1}]


What I'm asking here is how to work out the error produced by FindRoot or alternetively, a better way to make a table of all the roots of the function F[v,a] in the form of {{a1,{roots1}},{a2,{roots2}}....}

Try NSolve together with a predefined solution range for v:
sol[a_?NumericQ] := NSolve[{F[v, a] == 0, -15 < v < 15}, v]