Bill Allombert on Fri, 08 Nov 2024 19:01:13 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: question on trying to fit an exponential decay curve to data


On Fri, Nov 08, 2024 at 08:49:21AM -0800, American Citizen wrote:
> Hello:
> 
> While working with the L-series code that I have, in trying to find the
> regulator of an elliptic curve, I've hit a problem with curve fitting.
> 
> I have a set of 15,026 points which shows a nice decay curve to
> (purportedly) the final value = regulator, but trying to fit the equation
> (1) eludes me.
> 
> (1)  y = a*exp(x*k1) + b*exp(x*k2) + c
> 
> My attempts to optimize (1)  to the data failed in both a Python3 module,
> and gnuplot curve fitting, so I am stuck at the moment. Python3 says maxfev
> > 800, so optimization attempts failed and gnuplot says bad data at data
> point 710, which makes absolutely no sense at all.
> 
> How would you use GP Pari to do a least squares fit to the equation (1) ?? I
> need to know [a, b, c, k1, k2] of course.

Pick reasonnable starting values for k1, k2. Compute a,b,c, using the linear
least square formula, compute the error and then do gradient descent to find k1
and k2 that minimize the error.

Cheers,
Bill.