You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For TimeType data, Periodic transform uses the _periodic function to compute the periodic function for each instant in time.
The purpose of the _periodic function is to find an "origin" in time that minimises rounding error. This is particularly important when working with dates, because the calculations are done on milliseconds, and the number of milliseconds since "year 0" is enormous.
So _periodic finds the most recent time, period_begin, such that period_begin / period is a whole number, and in turn sin(2π * period_begin / period) ≈ 0 with the highest precision.
But this consideration could just as well apply to Real numbers, albeit less often in practice. So we should accomodate Real input in _periodic or define a new equivalent method, e.g.
function _periodic(f, instant, period, phase_shift=0)
return f(2π * (mod(instant, period) - phase_shift) / period)
end
For
TimeType
data,Periodic
transform uses the_periodic
function to compute the periodic function for each instant in time.The purpose of the
_periodic
function is to find an "origin" in time that minimises rounding error. This is particularly important when working with dates, because the calculations are done on milliseconds, and the number of milliseconds since "year 0" is enormous.So
_periodic
finds the most recent time,period_begin
, such thatperiod_begin / period
is a whole number, and in turnsin(2π * period_begin / period) ≈ 0
with the highest precision.But this consideration could just as well apply to
Real
numbers, albeit less often in practice. So we should accomodateReal
input in_periodic
or define a new equivalent method, e.g.Examples:
The text was updated successfully, but these errors were encountered: