Skip to content

Instantly share code, notes, and snippets.

@thhagelmayer
Last active August 23, 2021 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thhagelmayer/4ca31eae7abd5889f5822d3d70cf5c69 to your computer and use it in GitHub Desktop.
Save thhagelmayer/4ca31eae7abd5889f5822d3d70cf5c69 to your computer and use it in GitHub Desktop.

Add support for error terms with explicit constants to AsymptoticRing in SageMath for GSoC 2021

Project overview

The goal of this project was to extend SageMath with support for error terms with explicit constants to AsymptoticRing. We called these terms B-terms. Adding support was done in a modular fashion. Every ticket on the Trac-Server of SageMath represents a functional part of this project. These modules contain the initial support and different growth groups supported by AsymptoticRing.

At the end of the project we got a working product which enables SageMath users to do calculations like:

sage: A.<n> = AsymptoticRing('n^QQ', QQ)
sage: n^2 + A.B(n, valid_from=1) + 41
n^2 + B(42*n, n>=1)

List of contributions

  • Trac #31933: Implemented B-terms as a part of term_monoid
  • Trac #32153: Refactored the representation string of exact and TermWithCoefficient terms for the usage in B-terms
  • Trac #31933: Monomial growth group is supported
  • Trac #32229: Reviewed the fix for the conversion of B-terms, which failed after the inital support
  • Trac #32778: Implemented support for B-terms in Asymptotic Ring

Roadblocks encountered

The implementation was harder than expected, because:

  • the Trac-Server is not very intuitive to use
  • I also found it hard to get used to the formatting of the docstrings and doctests, which made the inital support ticket longer than it should have been
  • understanding code that already exists takes time
  • quite a few refactors were needed to be able to support B-terms

TODO

  • Implement logarithms for monomial growth group
  • Implement other growth groups:
    • exponential growth group
    • Implement support for multivariate expansions

Get the Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment