How often should I compound my Algorand (or other proof of stake crypto assets)? Note to editors/mods: Please help me tag this appropriately! I'm not really a math wiz... is it multivariable calculus?
See this note from the Algorand FAQ about how collecting rewards on staked assets works with compounding.

The participation rewards are calculated automatically, however the compounding effect is not automatic. This is because the rewards are calculated from the last recorded balance on the blockchain, the easiest way to force rewards compounding is to send a zero Algo payment transaction to the target address on a frequent, recurring basis. This transaction will trigger the commit of all accrued rewards and record them to the on-chain balance of the account.

As of this question, the network fee of a 0.00 ALGO transaction to myself is .001 ALGO, and the APR for rewards is ~5.827% (converted from ~6% APY). Let's say I have some amount of ALGO principal, P, and I decide to claim my rewards every d days.
It stands to reason then that every time I claim my rewards, the resulting interest, I is:
I = P * ( d * .05827 /365)-.001
Every d days, P goes to P+I.
How do we find, for a given value P, which value d is the optimal compound interval such that we maximize the rate that P increases?
My suspicion is that as P increases sufficiently high, it will make sense to compound much more frequently. It's been 11 years since I took Calculus 1 and 2, and this seems like an interesting problem. It seems like there's some recursive nature to this that makes it challenging.
Instead of writing d for the number of days between collecting interest, let's write n for the number of times a year you do it.  Also write r for the annualized interest rate and f for the fee per transaction.  At subsequent collections the balance is

$P$,
$P(1 + r / n) - f$,
$(P(1 + r / n) - f)(1 + r / n) - f
= P(1 + r / n)^2 - f[(1 + r/ n) + 1]$,
$P(1 + r / n)^3 - f[(1 + r/ n)^2 + (1+r/n) + 1]$,
and so on.

At the end of the year, then, we have
$$P_{new} = P\left(1 + \frac{r}{n}\right)^n - f\left[\left(1 + \frac{r}{n}\right)^{n-1} + \ldots + \left(1+\frac{r}{n}\right) + 1\right]$$
and of course we want to maximize this quantity.
Summing the geometric series on the right, we can write this as
$$P_{new} = P\left(1 + \frac{r}{n}\right)^n - \frac{1 - (1 + r/ n)^n }{1 - (1+r/n)} f$$
which we can simplify to
$$P_{new} = P\left(1 + \frac{r}{n}\right)^n - \left[\left(1 + \frac{r}{n}\right)^n - 1\right]\frac{f}{r} n$$
or, equivalently, to
$$P_{new} = \left(P - \frac{f}{r} n\right)\left(1 + \frac{r}{n}\right)^n + \frac{f}{r} n$$
It's tedious but not difficult to write out an expression for the derivative with respect to n, but unfortunately the roots of the derivative are not given by an elementary function of $P$, $r$, and $f$.

However, let's take a look at what would happen for some of the values you've given.  You say that $f$ is 0.001 and $r$ is 5.827%.  Let's say you have the equivalent of \$1 million, which is apparently around 2.95 million of these.
Calculating by brute force, the optimal number of compounding periods per year is 33, which corresponds to something like once every eleven days.  This will result in a balance of ALGO 3,126,343 or roughly \$1,061,875 assuming a constant exchange rate.
On the other hand, let's say that instead of 33 times a year you do it six times a year.  This will result in a final balance of ALGO 3,126,124, or roughly \$1,061,631, which is \$244 less than you made compounding 33 times per year.
In fact, let's say you just do it three times a year.  Then you'll end up with a final balance of ALGO 3,125,256.92 or roughly $1,061,337.25, about \$538 less than you would have made with 33 compounding periods.  That represents less than a 1% difference in your total profit, or about 5 basis points of your initial investment.  In other words, these are amounts that would be swamped by small fluctuations in exchange rates.
Of course nobody said that these need to be equally spaced throughout the year like we've been assuming.  But that's even more work for what I hope is clear is a fairly paltry reward.

By the way, they could do away with all this nonsense if they simply accounted for compounding when they added in the interest.  All they'd have to do is give you an interest payment of $P(e^{r \Delta t} - 1)$ rather than an interest payment of $P r \Delta t$.  I guess this way they collect more 0.001 ALGO fees, though...
Thinking in terms of the number of days between claims makes sense when the principal is much larger than the daily interest accrued.
In such a scenario, you want to claim at the point that you would make more from the interest in the days between claims on the claimed coin than you you lose in fees by claiming it.
For a low fee coin like Algorand, that works out to claiming quite often. With a principal of 1000, it's &quot;best&quot; to claim roughly once a week. With a principal over 400,000 it's optimal to claim every day. But as others mentioned, the difference here is small, claiming daily vs claiming yearly works out to the equivalent of an extra 0.1-0.2% interest. It's probably not worth it if you have only \$1,000 staked as claiming weekly vs yearly will net you an extra \$1-2.
Another thing to consider is that certain coins and staking methods do actually automatically compound the interest but the coins are not added to your wallet (as that would require an extra transaction that would incur a fee). For instance, I believe cardano does this as part of their protocol. The only reason to claim the staking rewards there is if you intend to remove all your coins from the staking pool.