# How to find a logarithmic function as a fit to my data?

My data is:

d = {{0, 3.889}, {0.04, 3.941}, {0.06, 5.036}, {0.08, 12.589}, {0.1, 16.972}, {0.2, 13.200}, {0.4, 12.063}};


I need to fit a function as: $$\log_b a + \log_b [x (1 - x)]$$ and obtain the appropriate $$a$$ and $$b$$. Also, $$0 < x < 1$$.

So, I have:

FindFit[d, Log[b, a] + Log[b, x (1 - x)], {a, b}, x]


But I get several errors, such as: "Indeterminate expression 0. ComplexInfinity encountered."

How to overcome these errors?

• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Nov 9, 2021 at 11:37
• Your data dshould include the x-values! Nov 9, 2021 at 11:49

I changed your model a little bit. First data point cann't be used because of Log[0]
mod = NonlinearModelFit[Rest[d] , {a + b Log[ x (1 - x)], a > 0 }, {a, b }, x,Method -> "NMinimize"] //Quiet

• @UlrichNeumann shouldn't you impose restrictions like $b\neq 1$ and $b>0$? Nov 9, 2021 at 13:39