Opened 2 years ago

Last modified 17 months ago

#22467 needs_work defect

simplify_hypergeometric bug

Reported by: rws Owned by:
Priority: major Milestone: sage-7.6
Component: calculus Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by chapoton)

The result of expansion of a 2F1 expression using simplify_hypergeometric differs from computing the numeric directly:

sage: hypergeometric((1/5, 4/5), (6/5,), 1/10*sqrt(5)*(sqrt(5) - 1))
hypergeometric((1/5, 4/5), (6/5,), 1/10*sqrt(5)*(sqrt(5) - 1))
sage: _.n()
1.04296605906833
sage: hypergeometric((1/5, 4/5), (6/5,), 1/10*sqrt(5)*(sqrt(5) - 1))
hypergeometric((1/5, 4/5), (6/5,), 1/10*sqrt(5)*(sqrt(5) - 1))
sage: _.simplify_hypergeometric()
0

Inside maxima:

maxima: hgfred([1/5, 4/5], [6/5], 1/10*sqrt(5)*(sqrt(5) - 1));
((1-(sqrt(5)-1)/(2*sqrt(5)))^(1/10)*assoc_legendre_p(-4/5,-1/5,1-(sqrt(5)-1)/sqrt(5))*gamma(1/5))/(5*((sqrt(5)-1)/(2*sqrt(5)))^(1/10))

Change History (11)

comment:1 Changed 2 years ago by rws

  • Milestone changed from sage-7.6 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

User error. Assumptions given earlier interferred with simplify_hypergemetric.

comment:2 Changed 2 years ago by rws

  • Status changed from needs_review to positive_review

comment:3 Changed 2 years ago by rws

  • Description modified (diff)
  • Milestone changed from sage-duplicate/invalid/wontfix to sage-7.6
  • Status changed from positive_review to needs_work
  • Summary changed from hypergeometric 2F1 bug to simplify_hypergeometric bug

Hijacking ticket to prevent waste. Quite a similar error, this time for real.

comment:4 Changed 2 years ago by rws

  • Description modified (diff)

comment:5 Changed 17 months ago by chapoton

  • Description modified (diff)

comment:6 Changed 17 months ago by chapoton

This is an issue in conversion from maxima:

sage: maxima('((1-(sqrt(5)-1)/(2*sqrt(5)))^(1/10)*assoc_legendre_p(-4/5,-1/5,1-(
....: sqrt(5)-1)/sqrt(5))*gamma(1/5))/(5*((sqrt(5)-1)/(2*sqrt(5)))^(1/10))')
((1-(sqrt(5)-1)/(2*sqrt(5)))^(1/10)*assoc_legendre_p(-4/5,-1/5,1-(sqrt(5)-1)/sqrt(5))*gamma(1/5))/(5*((sqrt(5)-1)/(2*sqrt(5)))^(1/10))
sage: bla=_
sage: bla.sage()
0

comment:7 Changed 17 months ago by chapoton

Probably boils down to

sage: maxima('assoc_legendre_p(-4/5,-1/5,1)')
assoc_legendre_p(-4/5,-1/5,1)
sage: _.sage()
0

which in turn comes from

sage: gen_legendre_P(-4/5,-1/5,x)
0
Last edited 17 months ago by chapoton (previous) (diff)

comment:8 Changed 17 months ago by rws

mpmath returns 0.000000000000000 with

        import mpmath
        from sage.libs.mpmath.all import call as mpcall
        mpcall(mpmath.legenp, -0.8, -0.2, 1)

and Wolfram Alpha agrees with it but also agrees with the nonzero value for the 2F1 expression so the simplification by Maxima seems wrong.

On another note there is this in Func_assoc_legendre_P._eval_special_values(self,n,m,x):

        if m > n:
            return ZZ(0)

However in Wikipedia that if |m|>l then Plm=0, so the code seems wrong (missing the abs).

comment:9 Changed 17 months ago by rws

Confirmation from arb:

sage: CBF(1/10*sqrt(5)*(sqrt(5) - 1)).hypergeometric([1/5,4/5],[6/5])
[1.0429660590683 +/- 5.27e-14]
sage: CBF(1).legendre_P(-4/5,-1/5)
0

comment:10 Changed 17 months ago by chapoton

Maybe because Legendre polynomials can be extended to rational parameters either by 0 or by hypergeometric functions. What we see looks like a clash of extensions, no ?

comment:11 Changed 17 months ago by rws

No, the relevant extension is http://dlmf.nist.gov/14.3.E6 and it holds for x > 1 but the 2F1 argument here is 0.276 which makes x around 0.447, i.e. < 1. Agree?

Note: See TracTickets for help on using tickets.