The requirement of the fit having specific values at x=0
, x=1
, implies that the parameters a
, b
, c
, d
are constrained according to the set of two equations:
funclog(0, a, b, c, d) = 0
, funclog(1, a, b, c, d) = 1
For the form of funclog
you are considering, you can solve this system of equations with respect to a
and d
resulting in the (unique) solution
a = 1/(-log(c) + log(b + c))
and d=log(c)/(log(c) - log(b + c))
(assuming that b
and c
are such that the denominators are not equal to zero).
Replacing these expressions for a
and d
in funclog
results in a new fitting function, namely,
(log(c) - log(b*x + c))/(log(c) - log(b + c))
,
which by default satisfies the constraints. The values of b
and c
can be found by curve_fit
.