0

I am writing a mobile application - an integrals calculator. When entering specific non-convergent integrals, SymPy gives me the notation of integral expressions. Perhaps it is not clear, here is an example with taking an indefinite integral from sin(x)/x

import sympy as sym
from sympy import *
print((integrate(sin(x)/x, x)))
-> Si(x)

In the documentation I found such a definition of this function and many other error functions like (e^x)/x. How to make it output not Si(x), Ei(x), etc., but what these functions are equal to?

The transformation of a function into a string and the usual replace cannot be implemented due to the large number of such functions

  • I'm not sure there are closed-form solutions to those functions. They may only have numerical values. – jared Jun 21 '23 at 15:35
  • Then how do I replace them with some explanation? – MilkyDwarf Jun 21 '23 at 15:39
  • What are you looking to replace it with? In this case, do you want to just return the input, since that is what `Si(x)` is? – jared Jun 21 '23 at 15:42
  • Look at the screenshot, it says what the function is equal to. It just seems to me that such a record as Si(x) is unpopular, and what is shown in the screenshot looks clearer. (Sorry if my words don't look right somehow, I'm using a translator) – MilkyDwarf Jun 21 '23 at 15:49
  • Does this answer your question? [How to check if a SymPy expression has analytical integral](https://stackoverflow.com/questions/50039222/how-to-check-if-a-sympy-expression-has-analytical-integral) – jared Jun 21 '23 at 16:01
  • Not quite, but with this I can think of something, thanks a lot – MilkyDwarf Jun 21 '23 at 16:26
  • I suspect that there is no general solution to the problem as stated. Some functions which are found as solutions for integrals can be restated in terms of more widely known functions (such as exp, log, trig functions, etc.) but many cannot. At best one could try to enable any flags which govern the application of identities and then try to resimplify whatever solution is found by `integrate`. See e.g. Abramowitz and Stegun (a web search will find it) for a catalog (printed, not programmatic) of identities. – Robert Dodier Jun 21 '23 at 17:57

0 Answers0