meijerint_doc.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. """ This module cooks up a docstring when imported. Its only purpose is to
  2. be displayed in the sphinx documentation. """
  3. from typing import Any, Dict as tDict, List, Tuple as tTuple, Type
  4. from sympy.integrals.meijerint import _create_lookup_table
  5. from sympy.core.add import Add
  6. from sympy.core.relational import Eq
  7. from sympy.core.symbol import Symbol
  8. from sympy.printing.latex import latex
  9. t = {} # type: tDict[tTuple[Type, ...], List[Any]]
  10. _create_lookup_table(t)
  11. doc = ""
  12. for about, category in sorted(t.items()):
  13. if about == ():
  14. doc += 'Elementary functions:\n\n'
  15. else:
  16. doc += 'Functions involving ' + ', '.join('`%s`' % latex(
  17. list(category[0][0].atoms(func))[0]) for func in about) + ':\n\n'
  18. for formula, gs, cond, hint in category:
  19. if not isinstance(gs, list):
  20. g = Symbol('\\text{generated}')
  21. else:
  22. g = Add(*[fac*f for (fac, f) in gs])
  23. obj = Eq(formula, g)
  24. if cond is True:
  25. cond = ""
  26. else:
  27. cond = ',\\text{ if } %s' % latex(cond)
  28. doc += ".. math::\n %s%s\n\n" % (latex(obj), cond)
  29. __doc__ = doc