periodictable icon indicating copy to clipboard operation
periodictable copied to clipboard

Computed decay time is incorrect

Open pkienzle opened this issue 3 years ago • 2 comments

See https://github.com/scattering/activation/issues/17

pkienzle avatar May 18 '22 21:05 pkienzle

Derivative used in https://github.com/pkienzle/periodictable/commit/e4f8ea130e6ca72f2969f8ceb7fe6673f6e867ac appears to be incorrect:

f = lambda t: sum(Ia*exp(-La*(t-To)) for Ia, La in data) - target
df = lambda t: sum(La*Ia*(To-1)*exp(-La*(t-To)) for Ia, La in data)

It is okay when To = 0, which is probably why it seems to work. This function needs a fuller review.


[correction] It is okay when t=1 since the derivative with respect to t should be:

df = lambda t: sum(-La*Ia*exp(-La*(t-To)) for Ia, La in data)

This is only used in the root-finding code. It appears to be finding the correct value despite the incorrect derivative otherwise it would be throwing a runtime error. Using the correct code should make it converge faster.

pkienzle avatar Aug 25 '23 21:08 pkienzle

Even with the corrected df/dt the resulting time does not have total activation matching the target value. Need to verify that formulas for decay time and activation are consistent.

pkienzle avatar Feb 27 '24 23:02 pkienzle