I have a set of data $y_i (z_i)$ with errors $\Delta y_i$
data = {{0.015, 34.1114},{0.0277, 35.705},{0.048948, 36.7316},{0.0651, 37.3067},{0.100915, 38.4567},{0.159, 39.4164},{0.248508, 40.2722},{0.455, 42.3239},{0.655, 42.3151},{0.75, 43.243},{0.84, 43.5143},{0.961, 44.2642},{1.188, 44.6076},{1.34, 45.0675},{1.414, 44.8038}}
sigmadata={0.215239,0.118114,0.175773,0.242628,0.121087,0.21481,0.152213,0.306006,0.188809,0.198402,0.471047,}
that I want o fit with a complicated formula
$$ Y(z) = 5\log \Bigl((1+z)\int_0^z \frac{dz'}{a+bz'+cz'^2}\Bigr)+25; $$
I used a NonLinearFit
in the following way
model[a_?NumericQ, b_?NumericQ, c_?NumericQ, z_] := 5*Log[10, (1 + z)*
NIntegrate[1/(a + b*x + c*x^2), {x, 0, z}, PrecisionGoal -> 7,
AccuracyGoal -> 7]] + 25
fit1 = NonlinearModelFit[data, model[a,b,c,z], {a, b, c}, z,
Weights -> 1/(sigmadata)^2];
Mathematica was not able to make the fit, and the problem seems to be that the coefficients becomes complex. I decide then to use the analytical form of the Integral and then make the fit (to avoid the integration),
model2=5Log[10,(1+z)*(2ArcTan[(b+2*c*z)/(Sqrt[4*a*c-b^2])])/(Sqrt[\4*a*c-b^2])]+25;
but the same problem appears. There is any way to fix somehow the conditions over $\{a,b,c\}$ ??. The full set of data is about 580 points, its a Cosmological fot for Supernovae. I appreciate your help.
Assumptions
over the $\{a,b,c\}$ to be Reals, but it! doesn't work $\endgroup$(1/a + b x ..)
should be1/(a + b x .. )
. also is thez^2
in the formula supposed to be(z_prime)^2
? $\endgroup$