User talk:Per Sundqvist

= Fit to exponential without start guess = This article describes the theoretic background to an algorithm that, without any start guess, fits numeric data points to a general exponential function of the type

where $$c_0, c_1$$ and $$\tau$$ are the parameters to be determined. It is an example of Nonlinear regression which can be solved analytically.

Background
This type of function is very common in measurements in natural science (exponential decay of capacitor voltage, temperature, biological half-life etc.). The problematic thing with this function is the constant $$c_0$$, which normally represents an offset level, either stemming from the measuring instrument or to a reference level (background temperature for example). If the data set does not extend to the saturation region, where $$y \sim c_0$$ it can be hard to predict this value from a general computer routine. Without $$c_0$$ one can use the logarithm trick: $$\ln(y)=\ln(c_1)-\frac{t}{\tau},\;z=d_1+d_2 \cdot t$$ and use linear regression. Interesting to note is though that the determination of the coefficients with this method are determined from summation/integration of the data set. Summation or averaging of random noise will tend to zero if the data set is huge.

Method of integration
We have in principle three unknown, and need three equations. This method uses the method of integrating the data and the fitting function several times over the data region until we get the desired number of equations we need. The method of integration is used, firstly because integration of huge data set of random noise will "average out". This is not really the same thing as the method of least squares but is similar in the sense that the fitted function will lye in "middle" of spread data points. Secondly, because the integral of the exponential function will be the exponential itself. We can repeatedly integrate how many times we want and the result will only be a new function with the same exponential (apart from some constants). The first integral,$$I_1$$, defined between the end of the data set $$t_1<t<t_N$$ (we will approximate it numerically later on) would simply be the function


 * $$I_1 (t) = \int_{t_1}^t y(\sigma) \cdot d \sigma$$

We could use Cauchy formula for repeated integration which says that the nth repeated integral of $$I_n$$ based at $$t_1$$,


 * $$I_n(t) = \int_{t_1}^{t} \int_{t_1}^{\sigma_1} \cdots \int_{t_1}^{\sigma_{n-1}} f(\sigma_{n}) \, \mathrm{d}\sigma_{n} \cdots \, \mathrm{d}\sigma_2 \, \mathrm{d}\sigma_1$$,

is given by the single integration


 * $$I_n(t) = \frac{1}{(n-1)!} \int_{t_1}^t\left(t-\sigma\right)^{n-1} f(\sigma)\,\mathrm{d}\sigma$$.

It is convenient to scale the equation and limits. If we have discrete data points in the time-domain $$t_1, t_2,...,t_{N-1},t_N$$ so that $$0 \leq z \leq 1 $$


 * $$z=\frac{t-t_1}{t_N-t_1}$$

where $$\Delta t=t_N-t_1$$ will be used for short. The unknown coefficients in equation ($$), could be re-normalized to simplify the transform
 * $$\delta=\frac{\tau}{\Delta t}$$
 * $$d_1=c_1 \cdot e^{-t_1/\tau}$$

Using these transforms we end up in the scaled version of equation ($$)

In the transformed domain the numeric integrals, now all evaluated at the end-point of the domain z=1, would be given by:
 * $$I_n = \frac{1}{(n-1)!} \int_{0}^1\left(1-z\right)^{n-1} f(z)\,\mathrm{d}z$$.

The equation system
As has been mentioned, the integrals $$I_n$$ would all only be functions of $$e^{-1/\delta}$$. The trick is to introduce a fourth unknown variable "h".


 * $$h=e^{-1/ \delta}$$

For that we will need an extra equation, which is just an extra integral of the 4:th order $$I_4$$. This is un conventional, since the $$\delta$$ and $$h$$ are dependent. However since a new 4:th integral are linearly independent of all the other integrals, tis will produce the right result in the case when the data points do exactly match a certain set of unknown coefficients.

The equations can be written in terms of the numerical integrals on the LHS and the expressions on the RHS in terms of the unknown coefficients as:

I_1=c_0+\delta d_1 (1-h)$$

I_2=\frac{c_0}{2}+\delta d_1 (\delta (h-1)+1) $$

I_3=\frac{1}{6} \left(c_0+3 \delta   d_1 (2 \delta  (\delta   +\delta  (-h)-1)+1)\right) $$

I_4=\frac{1}{24} \left(c_0+4  \delta  d_1 (3 \delta  (2   \delta  (\delta (h-1)+1)-1)+1)\right) $$

The solution is:
 * $$\delta = \frac{-I_2+6 I_3-12

I_4}{-I_1+6 I_2-12 I_3}$$

under construction...

equation ($$) Per Sundqvist (talk) 18:57, 17 June 2015 (UTC)

Your draft article, Draft:Fit to exponential without start guess


Hello, Per Sundqvist. It has been over six months since you last edited your Articles for Creation draft article submission, "Fit to exponential without start guess".

In accordance with our policy that Articles for Creation is not for the indefinite hosting of material deemed unsuitable for the encyclopedia mainspace, the draft has been nominated for deletion. If you plan on working on it further, or editing it to address the issues raised if it was declined, simply and remove the  or  code.

If your submission has already been deleted by the time you get there, and you wish to retrieve it, you can request its undeletion by following the instructions at this link. An administrator will, in most cases, restore the submission so you can continue to work on it.

Thanks for your submission to Wikipedia, and happy editing. Aru@baska ❯❯❯ Vanguard 17:32, 8 December 2016 (UTC)