# Solving equation with FindRoot

I have:

(tabab =
Table[{a -> aa,
First@FindRoot[
Sum[n (E^(-beta/n - aa n))/(Sum[
E^(-beta/n - aa n), {n, 3, 12}]), {n, 3, 12}] -
6, {beta, 35}]}, {aa, 0, 30, 0.15}]) // TableForm;


It gives me the error: 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.

How can I fix this?

Does this produce what you want?

res = Table[{a -> N[aa],
First@FindRoot[
Sum[n (E^(-beta/n - aa n))/
(Sum[E^(-beta/n - aa n), {n, 3, 12}]),
{n, 3, 12}] - 6,
{beta, 35}, WorkingPrecision -> 20]},
{aa, 0, 30, 15/100}] // TableForm


Changes here are converting 0.15 to 15/100 for increased precision and using WorkingPrecision option for 20 digits of precision while running FindRoot.

Plotting the result in this form is just ListLinePlot with a replacement rule for {a, beta}... but this is almost a straight line:

ListLinePlot[{a, beta} /. res]


You can perform a straight line fit on this data and subtract it from the beta part, and see that it's not entirely straight (but note the differing scale):

With[{data = {a, beta} /. res},
With[{fit = Fit[data, {a, 1}, a]},
ListLinePlot[{a, beta - fit} /. res]]]