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
Since we have a discussion about visualizer ideas, I thought it could be helpful to have a similar ongoing discussion about sequences and sequence features. I will kick it off with this one:
We have a featured specimen that uses the Beatty sequence $\lfloor \sqrt2 n\rfloor$ from the OEIS. This is a nice example of one that we can compute arbitrarily many terms for by using a formula. But the first formula you might reach for is n*sqrt(2) (relying on the automatic flooring). That will eventually be wrong (how large n has to be before that happens depends on the precision with which √2 happens to be computed), so a better formula is floorSqrt(2n^2) -- that may eventually become very expensive to compute, but it will always be correct. (There is a much more efficient, certain-to-be correct, method outlined on the OEIS page which could easily be coded in JavaScript but has more "control flow" logic than can easily be captured in the mathjs formula language.) Anyhow, is it worth starting and keeping a catalog of our "best known" mathjs expressions (and/or JavaScript functions) for computing OEIS sequences? If so, where should we keep it?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Since we have a discussion about visualizer ideas, I thought it could be helpful to have a similar ongoing discussion about sequences and sequence features. I will kick it off with this one:
We have a featured specimen that uses the Beatty sequence$\lfloor \sqrt2 n\rfloor$ from the OEIS. This is a nice example of one that we can compute arbitrarily many terms for by using a formula. But the first formula you might reach for is
n*sqrt(2)
(relying on the automatic flooring). That will eventually be wrong (how largen
has to be before that happens depends on the precision with which √2 happens to be computed), so a better formula isfloorSqrt(2n^2)
-- that may eventually become very expensive to compute, but it will always be correct. (There is a much more efficient, certain-to-be correct, method outlined on the OEIS page which could easily be coded in JavaScript but has more "control flow" logic than can easily be captured in the mathjs formula language.) Anyhow, is it worth starting and keeping a catalog of our "best known" mathjs expressions (and/or JavaScript functions) for computing OEIS sequences? If so, where should we keep it?Beta Was this translation helpful? Give feedback.
All reactions