The above formula can be found in the Ampleforth Redbook, which gives detailed information about the protocol rules.
Rebase takes place at a certain time every day, 02:00 AM UTC, and it is applied across all wallets that hold Ampleforth tokens.
Ampleforth Rebase Formula
Using the formula provided on this page, you can quickly calculate the % value of rebase that will be applied to Ampleforth supply on a given day. The calculated Rebase % value will also show you how much AMPL tokens will be added to or subtracted from your AMPL holdings, depending on whether it is a positive or a negative value.
You can either use the above formula and do your AMPL rebase calculations manually, or use the AMPL Rebase Percent Calculator tool to quickly calculate the rebase value.