zawy12 / difficulty-algorithms

See the Issues for difficulty algorithms
MIT License
107 stars 25 forks source link

WTEMA / ASERT as an RC filter #72

Closed zawy12 closed 2 years ago

zawy12 commented 2 years ago

update: I recant this article. It doesn't seem to show a connection as I had hoped.

This is just a note to show the viewpoint that EMA / ASERT are in some sense an RC filter.

ST=solvetime T = target block time N = median lifetime of EMA / relative ASERT

RC filter: Vout = Vin * ( 1 - e^(-t/RC) ) Vout will be the filtered and scaled adjustment to the prior_target based on the error signal in solvetime. t = ST/T - 1, is the error signal, i.e. the error between the time observed and the time expected. RC = N, the filter.

The controller: target = prior_target + Vout

Substituing e^x =~ 1+x for small x gives WTEMA: target = prior_target * ( 1 - 1/N + ST/T/N )

Unlike an RC filter, the 1 - e^(-t/RC) factor with my substitutions can go negative. So the interpretation is not simple.