# The Levenberg-Marquardt method for nonlinear least squares curve-ﬁtting

There is a function with unknown coefficient $$a$$, $$b$$, $$c$$ $$t(k)=\frac{1}{a b}(c-arcsinh(\sinh(c \cdot e^{a\cdot k\cdot 2\pi}))$$

I have a measurements $$t_k$$ from observed data.

$$(t_1 =0.4,t_2 =0.45,t_3 =0.56,t_4 =0.7 , t_5 =0.88)$$

therefore I need to minimize following function to estimate parameters $$a$$, $$b$$, $$c$$

$$S(a,b,c)=\sum_{k=1}^{5}\bigg(t_k -\frac{1}{a b}(c-arcsinh(\sinh(c) \cdot e^{a\cdot k\cdot 2\pi})\bigg)^2$$

How can I to identify parameters $$a$$, $$b$$, $$c$$ by using Levenberg-Marquardt nonlinear least-squares estimation in Mathematica?

 t[k_] := (1/(a b))[c - ArcSinh[Sinh[c*E^(a k 2 Pi)]]]

S[a_, b_, c_] :=
Sum[(t_k - 1/(a b) (c - ArcSinh[Sinh[c E^(a k 2 Pi)]]))^2, {k, 1, 5}];

• You have some typos in your code. Sum[t_k should be Sum[t[k] or even data[[k]] if data = {0.4,0.45,0.56,0.7,0.88} and the outside square brackets in [c - ArcSinh[Sinh[c*E^(a k 2 Pi)]]] should be parentheses. And you're really needing to fit 4 parameters (a, b, c, and the error variance) with just 5 data points? (I know that measurements can be very expensive but least squares can't provide miracles.) – JimB Dec 28 '18 at 18:48
• @vito ArcSinh[Sinh[]] Is this a typo or specifically to complicate the task? – Alex Trounev Dec 28 '18 at 18:51
• @AlexTrounev sorry ArcSinh[Sinh[c]*E^(a k 2 Pi)] – vito Dec 28 '18 at 20:19
• @vito Please edit the question in order to correct the typos. – Henrik Schumacher Dec 28 '18 at 22:57

We use identity ArcSinh[Sinh[x]]=x. Consequently

model = (1/(a b)) (c - c*E^(a k 2 Pi));
data = {{1, .4}, {2, .45}, {3, .56}, {4, .7}, {5, .88}};
f = FindFit[data, model, {a, b, c}, k, Method -> "LevenbergMarquardt"]
{a -> -0.0493203, b -> 6.57117, c -> -0.33649}
Show[ListPlot[data], Plot[model /. f, {k, 1, 5}]] Edit:

Here is more simple and better model.

ClearAll["Global*"]
data = {0.4, 0.45, 0.56, 0.7, 0.88};

model[k_] := a + b ArcSinh[c E^k]

cost = Sum[(data[[k]] - model[k])^2, {k, 1, 5}];

fit = NMinimize[cost, {a, b, c}, Method -> "DifferentialEvolution"]


{0.000105769, {a -> 0.371878, b -> 0.171929, c -> 0.0633393}}

Thread[{a, b, c} = {a, b, c} /. Last@fit];
model[k] // Expand


0.371878 + 0.171929 ArcSinh[0.0633393 E^k]

Show[ListPlot[data], Plot[model[k], {k, 1, 5}]] You can even try

model[k_] := a + b k + c k^2


and get good result.

  ClearAll["Global*"]
data = {0.4, 0.45, 0.56, 0.7, 0.88};

model[k_] := 1/(a b) (c - ArcSinh[Sinh[c]*E^(a k 2 Pi)])

cost = Sum[(data[[k]] - model[k])^2, {k, 1, 5}];

fit = NMinimize[cost, {a, b, c}, Method -> "DifferentialEvolution"]


{0.0260684, {a -> -0.0492263, b -> -0.0885632, c -> 0.00453114}}

Thread[{a, b, c} = {a, b, c} /. Last@fit];
model[k]


229.377 (0.00453114 - ArcSinh[0.00453116 E^(-0.309298 k)])

Show[ListPlot[data], Plot[model[k], {k, 1, 5}]] 