Extending Sympy integration functionalities

38 views
Skip to first unread message

Oldřich Klimánek

unread,
Sep 10, 2025, 1:06:01 PM (7 days ago) Sep 10
to sympy

Hi everyone,

I'd like to follow up on my previous email. I understand the subject line might have discouraged some people—not everyone knows what that means. :) Simply put, my package can solve integrals that Sympy itself cannot handle. It probably doesn't matter what they're called, but on the Sympy Github issues, you can find a lot of reports that Sympy can't solve, for example, the seemingly simple integral of x/(exp(x)-1) from 0 to infinity, or the famous integral in a similar form: x**3/(exp(x)-1).

In [1]: from sympy import symbols, Integral, exp, oo
   ...: x = symbols('x')
   ...: I = Integral(x**3 / (exp(x) - 1), (x, 0, oo))
   ...: I.doit()
Out[1]: Integral(x**3/(exp(x) - 1), (x, 0, oo))

When my package is used, the value of the integral is ready in 1 ms:
In [2]: from bosefermi import bose_fermi_integral
   ...: bose_fermi_integral(I)
Out[2]: pi**4/15

I would be happy if someone would join me and help with the integration of this package directly into Sympy.

https://github.com/klimanek/Bose-Fermi

Aaron Meurer

unread,
Sep 10, 2025, 1:11:21 PM (7 days ago) Sep 10
to sy...@googlegroups.com
The easiest way to extend the SymPy integration system with specific
patterns is using the manualintegrate module.
https://github.com/sympy/sympy/blob/master/sympy/integrals/manualintegrate.py

Although unfortunately it presently doesn't support definite integrals
so either support for that would need to be added, or you'd need to
find an indefinite form for your integrand using special functions.
The definite form would then ideally be computed automatically using
FTC and the limit() function.

The more complex way, but which might ultimately be a better match for
your integral, is extending the Meijer G-function algorithm. See
https://docs.sympy.org/latest/modules/integrals/g-functions.html

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/sympy/0fb0af17-2f5b-4e3b-9a31-111947b28fe8n%40googlegroups.com.

Oldřich Klimánek

unread,
Sep 10, 2025, 1:15:07 PM (7 days ago) Sep 10
to sympy
Aaron, thanks for your msg. I have done some work on evaluation of Bose-Fermi Integrals using G-functions but my closed-form approach seemed more sound. OK, we shall see. 
Cheers,
O.K.

Dne středa 10. září 2025 v 19:11:21 UTC+2 uživatel asme...@gmail.com napsal:
Reply all
Reply to author
Forward
0 new messages