#22326 closed enhancement (fixed)
Jacobi P polynomials without pexpectmaxima
Reported by:  rws  Owned by:  

Priority:  major  Milestone:  sage7.6 
Component:  symbolics  Keywords:  
Cc:  Merged in:  
Authors:  Ralf Stephan  Reviewers:  Travis Scrimshaw 
Report Upstream:  N/A  Work issues:  
Branch:  1c7b67e (Commits)  Commit:  
Dependencies:  #22174  Stopgaps: 
Description (last modified by )
At the moment, only a direct evaluation via pexpectmaxima exists, which should be replaced as to #17753. The replacement could simply be usage of maximalib, or a new implementation.
https://en.wikipedia.org/wiki/Jacobi_polynomials
src/sage/libs/arb/acb_hypgeom.pxd: void acb_hypgeom_jacobi_p(acb_t res, const acb_t n, const acb_t a, const acb_t b, const acb_t z, long prec)
Change History (13)
comment:1 Changed 3 years ago by
 Description modified (diff)
 Summary changed from Symbolic Jacobi P polynomials to Jacobi P polynomials without pexpectmaxima
comment:2 Changed 3 years ago by
 Description modified (diff)
comment:3 Changed 3 years ago by
 Branch set to u/rws/jacobi_p_polynomials_without_pexpect_maxima
comment:4 Changed 3 years ago by
 Commit set to 445931a097c01e0527b1c026bc8ed9a4b3e0762f
 Dependencies set to #22174
 Status changed from new to needs_review
comment:5 Changed 3 years ago by
 Commit changed from 445931a097c01e0527b1c026bc8ed9a4b3e0762f to 164d709301015fe2cc5e7711caa3b2dbfc5a2069
Branch pushed to git repo; I updated commit sha1. New commits:
164d709  22326: fixes

comment:6 Changed 3 years ago by
 Reviewers set to Travis Scrimshaw
Trivial PEP8 point:
conversions={'maxima':'jacobi_p', 'mathematica':'JacobiP',  'maple':'JacobiP', 'sympy':'jacobi'}) + 'maple':'JacobiP', 'sympy':'jacobi'})
Once changed, then you can set a positive review on my behalf.
comment:7 Changed 3 years ago by
 Commit changed from 164d709301015fe2cc5e7711caa3b2dbfc5a2069 to 1c7b67e763c036550504eb89ba078cc9cb4b727e
Branch pushed to git repo; I updated commit sha1. New commits:
1c7b67e  22326: cosmetics

comment:8 Changed 3 years ago by
 Status changed from needs_review to positive_review
comment:9 Changed 3 years ago by
 Branch changed from u/rws/jacobi_p_polynomials_without_pexpect_maxima to 1c7b67e763c036550504eb89ba078cc9cb4b727e
 Resolution set to fixed
 Status changed from positive_review to closed
comment:10 followup: ↓ 12 Changed 3 years ago by
 Commit 1c7b67e763c036550504eb89ba078cc9cb4b727e deleted
FWIW a test that was added in this ticket is failing on Cygwin:
sage: var('n a b x') (n, a, b, x) sage: jacobi_P(2,n,n,n) error: nonimmediate integer expected canonicalform.cc:53: In function `void CanonicalForm::mpzval(__mpz_struct*) const': failed assertion `!is_imm (value) && value>levelcoeff() == IntegerDomain' *** SIG 6 *** inside sig_on do_raise_exception(sig=6) PyErr_Occurred() = 0x0 Raising Python exception 0 ms after signals...  RuntimeError Traceback (most recent call last) <ipythoninput38e1c4485b87e> in <module>() > 1 jacobi_P(Integer(2),n,n,n) /home/embray/src/sagemath/sagecygwin/local/lib/python2.7/sitepackages/sage/functions/orthogonal_polys.pyc in __call__(self, *args, **kwds) 423 return maxima(self._eval_(*args, **kwds))._sage_() 424 > 425 return super(OrthogonalFunction,self).__call__(*args, **kwds) 426 427 /home/embray/src/sagemath/sagecygwin/src/sage/symbolic/function.pyx in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:11444)() 994 res = self._evalf_try_(*args) 995 if res is None: > 996 res = super(BuiltinFunction, self).__call__( 997 *args, coerce=coerce, hold=hold) 998 /home/embray/src/sagemath/sagecygwin/src/sage/symbolic/function.pyx in sage.symbolic.function.Function.__call__ (build/cythonized/sage/symbolic/function.cpp:6487)() 484 for i from 0 <= i < len(args): 485 vec.push_back((<Expression>args[i])._gobj) > 486 res = g_function_evalv(self._serial, vec, hold) 487 elif self._nargs == 1: 488 res = g_function_eval1(self._serial, /home/embray/src/sagemath/sagecygwin/src/sage/symbolic/function.pyx in sage.symbolic.function.BuiltinFunction._evalf_or_eval_ (build/cythonized/sage/symbolic/function.cpp:12804)() 1083 res = self._evalf_try_(*args) 1084 if res is None: > 1085 return self._eval0_(*args) 1086 else: 1087 return res /home/embray/src/sagemath/sagecygwin/local/lib/python2.7/sitepackages/sage/functions/orthogonal_polys.pyc in _eval_(self, n, a, b, x) 1923 s = sum(binomial(n,m) * gamma(a+b+n+m+1) / gamma(a+m+1) * ((x1)/2)**m for m in range(n+1)) 1924 r = gamma(a+n+1) / factorial(n) / gamma(n+a+b+1) * s > 1925 return r.to_gamma().gamma_normalize().normalize() 1926 1927 def _evalf_(self, n, a, b, x, **kwds): /home/embray/src/sagemath/sagecygwin/src/sage/symbolic/expression.pyx in sage.symbolic.expression.Expression.gamma_normalize (build/cythonized/sage/symbolic/expression.cpp:52668)() 9697 """ 9698 cdef GEx x > 9699 sig_on() 9700 try: 9701 x = gamma_normalize(self._gobj) src/cysignals/signals.pyx in cysignals.signals.sig_raise_exception (build/src/cysignals/signals.c:1475)() RuntimeError: Aborted
I'll open a separate ticket if/when I have a better idea what's going on. But in the meantime, any guesses?
The assertion it's failing on is in libfactory in Singular, where value>levelcoeff()
is returning RationalDomain
instead of Integer. I have no idea why.
comment:11 Changed 3 years ago by
Oh, turns out this is reproducible on Linux too. It only happens when built with SAGE_DEBUG=yes
comment:12 in reply to: ↑ 10 Changed 3 years ago by
Replying to embray:
I'll open a separate ticket if/when I have a better idea what's going on. But in the meantime, any guesses?
The assertion it's failing on is in libfactory in Singular, where
value>levelcoeff()
is returningRationalDomain
instead of Integer. I have no idea why.
Possible that Pynac is feeding nono data to Singular. Please open a Pynac issue, it's more likely it's in Pynac than it's in Sage.
comment:13 Changed 3 years ago by
That's what it looks like to me too. Specifically, somewhere in frac_cancel
it's feeding Singular some polynomial coefficients that are rationals, not integers, I think...
New commits:
22174: Interface expression conversion to gamma() and normalization
Merge branch 'u/rws/interface_expression_conversion_to_gamma___and_normalization' of git://trac.sagemath.org/sage into t/22326/jacobi_p_polynomials_without_pexpect_maxima
22326: native symbolic jacobi_P