> It looks pretty close to the right-hand side of
> http://en.wikipedia.org/wiki/Meijer_G-function#Polynomial_cases.  I'm
> afraid I'm not good enough with the notation to tell if the indices
> match up or not, though.  There are some other forumlas on that page
> with sums of G-functions on the right-hand side as well.

I tried to match against this formula. More on that approach later.

First let's see in more detail what Sympy does. Start with:

In [25]: pprint(_)
╭─╮1, 1 ⎛1  3 │  ⎞
│╶┐     ⎜     │ z⎟
╰─╯2, 2 ⎝2  0 │  ⎠

In [26]: hyperexpand(_, allow_hyper=True)
Out[26]: Piecewise((z**2/2, Abs(z) < 1), (1/2, Abs(1/z) < 1), (meijerg(((1,), 
(3,)), ((2,), (0,)), z), True))

In [27]: pprint(_)
⎧         2
⎪        z
⎪        ──          for │z│ < 1
⎪        2
⎪
⎪                        │1│
⎨       1/2          for │─│ < 1
⎪                        │z│
⎪
⎪╭─╮1, 1 ⎛1  3 │  ⎞
⎪│╶┐     ⎜     │ z⎟   otherwise
⎪╰─╯2, 2 ⎝2  0 │  ⎠
⎩

where we obtain the following conditional expression which is fine so far (I 
hope).
Now we try to substitute the actual values +1 and -1 for z:

In [28]: meijerg([1],[3],[2],[0],1)
Out[28]: meijerg(((1,), (3,)), ((2,), (0,)), 1)

In [29]: pprint(_)
╭─╮1, 1 ⎛1  3 │  ⎞
│╶┐     ⎜     │ 1⎟
╰─╯2, 2 ⎝2  0 │  ⎠

In [30]: hyperexpand(_, allow_hyper=True)
Out[30]: 1/2

Hmm, ok, but the condition on this branch is NOT fulfilled:  abs(1/1) < 1
is not true for a strict inequality.

In [31]: meijerg([1],[3],[2],[0],-1)
Out[31]: meijerg(((1,), (3,)), ((2,), (0,)), -1)
In [32]: hyperexpand(_, allow_hyper=True)
Out[32]: meijerg(((1,), (3,)), ((2,), (0,)), -1)

In [33]: pprint(_)
╭─╮1, 1 ⎛1  3 │   ⎞
│╶┐     ⎜     │ -1⎟
╰─╯2, 2 ⎝2  0 │   ⎠

In case of z=-1 we get the correct but less helpful answer.
Now, why can we simplify the case z=1 although the condition
is not matched? Is this a bug?

If we go ahead never the less we find that:

In [35]: G1 = meijerg([1],[3],[2],[0],-1)

In [36]: pprint(g1)
╭─╮1, 1 ⎛1  3 │   ⎞
│╶┐     ⎜     │ -1⎟
╰─╯2, 2 ⎝2  0 │   ⎠

In [37]: G2 = meijerg([1],[3],[2],[0],1)

In [40]: pprint(G2)
╭─╮1, 1 ⎛1  3 │  ⎞
│╶┐     ⎜     │ 1⎟
╰─╯2, 2 ⎝2  0 │  ⎠

In [41]: G3 = meijerg([3,1],[],[],[2,0],-1)

In [42]: pprint(G3)
╭─╮0, 2 ⎛3, 1       │   ⎞
│╶┐     ⎜           │ -1⎟
╰─╯2, 2 ⎝      2, 0 │   ⎠

In [43]: G4 = meijerg([3,1],[],[],[2,0],1)

In [44]: pprint(G4)
╭─╮0, 2 ⎛3, 1       │  ⎞
│╶┐     ⎜           │ 1⎟
╰─╯2, 2 ⎝      2, 0 │  ⎠

In [45]: -G1/2 + G2/2-G3/2+G4/2
Out[45]: -meijerg(((1,), (3,)), ((2,), (0,)), -1)/2 + meijerg(((1,), (3,)), 
((2,), (0,)), 1)/2 - meijerg(((3, 1), ()), ((), (2, 0)), -1)/2 + meijerg(((3, 
1), ()), ((), (2, 0)), 1)/2

In [46]: pprint(_)
  ╭─╮1, 1 ⎛1  3 │   ⎞   ╭─╮1, 1 ⎛1  3 │  ⎞   ╭─╮0, 2 ⎛3, 1       │   ⎞   ╭─╮0, 
2 ⎛3, 1       │  ⎞
  │╶┐     ⎜     │ -1⎟   │╶┐     ⎜     │ 1⎟   │╶┐     ⎜           │ -1⎟   │╶┐    
 ⎜           │ 1⎟
  ╰─╯2, 2 ⎝2  0 │   ⎠   ╰─╯2, 2 ⎝2  0 │  ⎠   ╰─╯2, 2 ⎝      2, 0 │   ⎠   ╰─╯2, 
2 ⎝      2, 0 │  ⎠
- ─────────────────── + ────────────────── - ───────────────────────── + 
────────────────────────
           2                    2                        2                      
    2

In [47]: hyperexpand(_, allow_hyper=True)
Out[47]: -meijerg(((1,), (3,)), ((2,), (0,)), -1)/2 - meijerg(((3, 1), ()), 
((), (2, 0)), -1)/2 + 1/4

In [48]: pprint(_)
  ╭─╮1, 1 ⎛1  3 │   ⎞   ╭─╮0, 2 ⎛3, 1       │   ⎞
  │╶┐     ⎜     │ -1⎟   │╶┐     ⎜           │ -1⎟
  ╰─╯2, 2 ⎝2  0 │   ⎠   ╰─╯2, 2 ⎝      2, 0 │   ⎠   1
- ─────────────────── - ───────────────────────── + ─
           2                        2               4

There is reason to believe that the two G in front should result in -1/4.
At this point the algorithm seems to be incomplete ...

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to