Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jacobi P polynomials without pexpect-maxima #22326

Closed
rwst opened this issue Feb 8, 2017 · 19 comments
Closed

Jacobi P polynomials without pexpect-maxima #22326

rwst opened this issue Feb 8, 2017 · 19 comments

Comments

@rwst
Copy link

rwst commented Feb 8, 2017

At the moment, only a direct evaluation via pexpect-maxima exists, which should be replaced as to #17753. The replacement could simply be usage of maxima-lib, 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)

Depends on #22174

Component: symbolics

Author: Ralf Stephan

Branch: 1c7b67e

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/22326

@rwst rwst added this to the sage-7.6 milestone Feb 8, 2017
@rwst

This comment has been minimized.

@rwst rwst changed the title Symbolic Jacobi P polynomials Jacobi P polynomials without pexpect-maxima Feb 8, 2017
@rwst

This comment has been minimized.

@rwst
Copy link
Author

rwst commented Feb 9, 2017

@rwst
Copy link
Author

rwst commented Feb 9, 2017

Author: Ralf Stephan

@rwst
Copy link
Author

rwst commented Feb 9, 2017

New commits:

648e49822174: Interface expression conversion to gamma() and normalization
e82d2d2Merge 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
445931a22326: native symbolic jacobi_P

@rwst
Copy link
Author

rwst commented Feb 9, 2017

Dependencies: #22174

@rwst
Copy link
Author

rwst commented Feb 9, 2017

Commit: 445931a

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 9, 2017

Changed commit from 445931a to 164d709

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 9, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

164d70922326: fixes

@tscrim
Copy link
Collaborator

tscrim commented Feb 9, 2017

comment:6

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.

@tscrim
Copy link
Collaborator

tscrim commented Feb 9, 2017

Reviewer: Travis Scrimshaw

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 9, 2017

Branch pushed to git repo; I updated commit sha1. New commits:

1c7b67e22326: cosmetics

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 9, 2017

Changed commit from 164d709 to 1c7b67e

@vbraun
Copy link
Member

vbraun commented Feb 11, 2017

Changed branch from u/rws/jacobi_p_polynomials_without_pexpect_maxima to 1c7b67e

@embray
Copy link
Contributor

embray commented Apr 18, 2017

comment:10

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: non-immediate 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)
<ipython-input-3-8e1c4485b87e> in <module>()
----> 1 jacobi_P(Integer(2),n,n,n)

/home/embray/src/sagemath/sage-cygwin/local/lib/python2.7/site-packages/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/sage-cygwin/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/sage-cygwin/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/sage-cygwin/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/sage-cygwin/local/lib/python2.7/site-packages/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) * ((x-1)/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/sage-cygwin/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.

@embray
Copy link
Contributor

embray commented Apr 18, 2017

Changed commit from 1c7b67e to none

@embray
Copy link
Contributor

embray commented Apr 18, 2017

comment:11

Oh, turns out this is reproducible on Linux too. It only happens when built with SAGE_DEBUG=yes

@rwst
Copy link
Author

rwst commented Apr 18, 2017

comment:12

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 returning RationalDomain instead of Integer. I have no idea why.

Possible that Pynac is feeding no-no data to Singular. Please open a Pynac issue, it's more likely it's in Pynac than it's in Sage.

@embray
Copy link
Contributor

embray commented Apr 18, 2017

comment:13

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants