Hi,

I just want to update this thread, that we have fixed this problem, in
my opinion, thanks to our GSoC student Subham Tibra, and his mentor
Kalevi Suominen. I am Subham's mentor too, but Kalevi has done a much
better job mentoring. ;)

In short: hypergeometric as well as the MeijerG functions are
solutions to an ODE together with some (symbolic) initial conditions
at a point like x=0, or x=1 (or any other point). Holonomic functions
are a generalization of this ODE to allow polynomials as coefficients
of the ODE. Then suddenly they are closed to almost all operations
(including multiplication, integration, differentiation) and there are
algorithms that can robustly and quickly compute those operations.
They are now implemented in SymPy.

I am using SymPy version 8d7b522e58aae883b4592e4fae3babf82d1e4db2.
Let's first show that what the meijerint._rewrite1() cannot do, can be
done easily with holonomic functions:

In [1]: from sympy.holonomic import from_sympy

In [2]: meijerint._rewrite1((cos(x)/x), x)
Out[2]: (1, 1/x, [(sqrt(pi), 0, meijerg(((), ()), ((0,), (1/2,)),
x**2/4))], True)

In [3]: meijerint._rewrite1((sin(x)/x), x)
Out[3]: (1, 1/x, [(sqrt(pi), 0, meijerg(((), ()), ((1/2,), (0,)),
x**2/4))], True)

In [4]: meijerint._rewrite1((cos(x)/x)**2, x)

In [5]: meijerint._rewrite1((sin(x)/x)**2, x)
Out[5]:
(1,
 x**(-2),
 [(sqrt(pi)/2, 0, meijerg(((0,), (1/2, 1/2, 1)), ((0, 1/2), ()), x**(-2)))],
 True)

In [6]: from_sympy((cos(x)/x))
Out[6]: HolonomicFunction((x) + (2)Dx + (x)Dx**2, x), f(1) = cos(1),
f'(1) = -sin(1) - cos(1)

In [7]: from_sympy((sin(x)/x))
Out[7]: HolonomicFunction((x) + (2)Dx + (x)Dx**2, x), f(0) = 1, f'(0) = 0

In [8]: from_sympy((cos(x)/x)**2)
Out[8]: HolonomicFunction((8*x) + (4*x**2 + 6)Dx + (6*x)Dx**2 +
(x**2)Dx**3, x), f(1) = cos(1)**2, f'(1) = -2*sin(1)*cos(1) -
2*cos(1)**2, f''(1) = 4*cos(1)**2 + 2*sin(1)**2 + 8*sin(1)*cos(1)

In [9]: from_sympy((sin(x)/x)**2)
Out[9]: HolonomicFunction((8*x) + (4*x**2 + 6)Dx + (6*x)Dx**2 +
(x**2)Dx**3, x), f(0) = 1, f'(0) = 0, f''(0) = -2/3



Here is an example how to use the holonomic functions module to
compute integrals:

https://github.com/sympy/sympy/issues/8944#issuecomment-229478358

it's around 10x faster than the SymPy's integrate() routine.

The tough part is what to do about definite integrals where the
antiderivative (a holonomic function) can be converted to elementary
functions, like here:

https://github.com/sympy/sympy/issues/11319

That's where the MeijerG approach gives better results. Also another
advantage of the MeijerG approach is that it gives convergence
conditions --- though perhaps there is a way to implement it in the
holonomic module (https://github.com/sympy/sympy/issues/11322).

Ondrej

P.S. Thanks Brandon for your email. I think the above is the solution.

On Sat, Feb 13, 2016 at 12:32 PM, brandon willard
<[email protected]> wrote:
> I've been thinking about this same topic a lot recently (partially due to a
> question about a G-function form of tanh), and it seems like the more
> generalized G-function you mentioned, Ondrej, is probably necessary at some
> point.  There doesn't seem to be a whole lot of literature on these
> bivariate G-functions, but, if you extend the scope to H-functions and
> bivariate hypergeometric functions (e.g. Horn, Appell), there are at least
> enough useful identities to consider implementing.
> Here's one interesting identity involving that generalized G-function and
> the Appell: http://functions.wolfram.com/07.34.16.0003.01.
>
> Also, there are some explicit series expansions for H-functions might help:
> http://arxiv.org/abs/math/9803163.
>
> On Monday, February 1, 2016 at 2:28:18 PM UTC-6, Ondřej Čertík wrote:
>>
>> On Mon, Feb 1, 2016 at 1:26 PM, Ondřej Čertík <[email protected]> wrote:
>> [...]
>> > right, that cos^2(x) is not a (single) hypergeometric series. Which is
>> > fine, there is problem.
>>
>> -> there is no problem.
>>
>> Ondrej
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/3e750003-cf00-4e6e-8e1c-c032fc7dc037%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CADDwiVBvFqR6FF3cdn%3Dh9r57xaJk70JM1yQ_M2E91DZ5Rh%2BK0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to