• The Miracles of Simplification

    From Peter Luschny@21:1/5 to All on Wed Oct 4 03:14:18 2017
    restart;
    a := n -> n!*(1+hypergeom([-n+1],[-n],-1))-(n!-GAMMA(n+1,-1)/exp(1)): simplify(expand(a(n)));
    seq(simplify(expand(a(n))),n=1..9);

    1, 2, 5, 20, 97, 574, 3973, 31520, 281825

    # OK, so let's take the simplification proposed by Maple!

    a1 := n -> exp(-1)*(GAMMA(n+2)+GAMMA(n+1, -1)*n)/n; seq(simplify(expand(a1(n))),n=1..9);

    2*exp(-1), 3*exp(-1)+1, 8*exp(-1)+2, 30*exp(-1)+9, 144*exp(-1)+44, 840*exp(-1)+265, 5760*exp(-1)+1854, 45360*exp(-1)+14833, 403200*exp(-1)+133496

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From acer@21:1/5 to Peter Luschny on Wed Oct 4 12:57:42 2017
    On Wednesday, October 4, 2017 at 6:14:18 AM UTC-4, Peter Luschny wrote:
    restart;
    a := n -> n!*(1+hypergeom([-n+1],[-n],-1))-(n!-GAMMA(n+1,-1)/exp(1)): simplify(expand(a(n)));
    seq(simplify(expand(a(n))),n=1..9);

    1, 2, 5, 20, 97, 574, 3973, 31520, 281825

    # OK, so let's take the simplification proposed by Maple!

    a1 := n -> exp(-1)*(GAMMA(n+2)+GAMMA(n+1, -1)*n)/n; seq(simplify(expand(a1(n))),n=1..9);

    2*exp(-1), 3*exp(-1)+1, 8*exp(-1)+2, 30*exp(-1)+9, 144*exp(-1)+44, 840*exp(-1)+265, 5760*exp(-1)+1854, 45360*exp(-1)+14833, 403200*exp(-1)+133496


    The simplification of that hypergeom expression seems to blame. But one could work around it by simplifying under the assumption that n is of type `posint`.

    restart;

    b:=hypergeom([-n+1],[-n],-1);

    b := hypergeom([-n + 1], [-n], -1)

    s:=simplify(b); # hrmm

    exp(-1) (n + 1)
    s := ---------------
    n

    q:=simplify(b) assuming n::posint;

    GAMMA(2 + n, -1) exp(-1)
    q := ------------------------
    n GAMMA(n + 1)

    [seq(b, n=1..5)];

    [1, hypergeom([-1], [-2], -1), hypergeom([-2], [-3], -1),
    hypergeom([-3], [-4], -1), hypergeom([-4], [-5], -1)]

    simplify(%);

    11 53
    [1, 1/2, 1/2, --, ---]
    24 120

    [seq(s, n=1..5)]; # sigh

    [2 exp(-1), 3/2 exp(-1), 4/3 exp(-1), 5/4 exp(-1), 6/5 exp(-1)]

    [seq(q, n=1..5)];

    [exp(-1) exp(1), 1/2 exp(-1) exp(1), 1/2 exp(-1) exp(1),

    11 53
    -- exp(-1) exp(1), --- exp(-1) exp(1)]
    24 120

    simplify(%);

    11 53
    [1, 1/2, 1/2, --, ---]
    24 120


    One way to do your original could then be, say,

    restart;

    a := n -> n!*(1+hypergeom([-n+1],[-n],-1))-(n!-GAMMA(n+1,-1)/exp(1)):

    seq(simplify(expand(a(n))),n=1..9);

    1, 2, 5, 20, 97, 574, 3973, 31520, 281825

    a1 := unapply(evalindets(a(n),specfunc(anything,hypergeom),
    simplify),n) assuming n::posint;

    / GAMMA(n + 2, -1) exp(-1)\ GAMMA(n + 1, -1)
    a1 := n -> n! |1 + ------------------------| - n! + ----------------
    \ n GAMMA(n + 1) / exp(1)

    seq(simplify(expand(a1(n))),n=1..9);

    1, 2, 5, 20, 97, 574, 3973, 31520, 281825


    I will submit a bug report.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Peter Luschny@21:1/5 to All on Thu Oct 5 13:21:46 2017
    Am Mittwoch, 4. Oktober 2017 21:57:43 UTC+2 schrieb acer:
    I will submit a bug report.

    Great!

    But do not think this is an isolated error.
    Maple is not able to compute even the most elementary
    hypergeometrics correctly. Just another one of many,
    many I have encountered in the recent years:

    T := (n,k) -> n!*hypergeom([k - n], [-n], -1);
    for n from 0 to 6 do seq(simplify(T(n,k)),k=0..n) od;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From acer@21:1/5 to Peter Luschny on Fri Oct 6 09:26:05 2017
    On Thursday, October 5, 2017 at 4:21:47 PM UTC-4, Peter Luschny wrote:
    Am Mittwoch, 4. Oktober 2017 21:57:43 UTC+2 schrieb acer:
    I will submit a bug report.

    Great!

    But do not think this is an isolated error.
    Maple is not able to compute even the most elementary
    hypergeometrics correctly. Just another one of many,
    many I have encountered in the recent years:

    T := (n,k) -> n!*hypergeom([k - n], [-n], -1);
    for n from 0 to 6 do seq(simplify(T(n,k)),k=0..n) od;


    Using any of Maple 2017.0, 2017.1, or 2017.2 I get,

    T := (n,k) -> n!*hypergeom([k - n], [-n], -1);

    T := (n, k) -> n! hypergeom([k - n], [-n], -1)

    for n from 0 to 6 do seq(simplify(T(n,k)),k=0..n) od;

    1
    0, 1
    1, 1, 2
    2, 3, 4, 6
    9, 11, 14, 18, 24
    44, 53, 64, 78, 96, 120
    265, 309, 362, 426, 504, 600, 720

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)