Opened 11 years ago
Closed 11 years ago
#4626 closed defect (fixed)
[with patch, positive review] error in bessel_J(0,0)
Reported by: | zimmerma | Owned by: | rlm |
---|---|---|---|
Priority: | major | Milestone: | sage-3.3 |
Component: | basic arithmetic | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage: bessel_J(0,0) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (284, 0)) --------------------------------------------------------------------------- PariError Traceback (most recent call last) /users/cacao/zimmerma/.sage/temp/achille.loria.fr/2662/_users_cacao_zimmerma__sage_init_sage_0.py in <module>() ----> 1 2 3 4 5 /usr/local/sage-3.1.4/sage/local/lib/python2.5/site-packages/sage/functions/special.pyc in bessel_J(nu, z, algorithm, prec) 522 K = C 523 K = z.parent() --> 524 return K(pari(nu).besselj(z, precision=prec)) 525 elif algorithm=="scipy": 526 if prec != 53: /usr/local/sage-3.1.4/sage/local/lib/python2.5/site-packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:34447)() 7864 7865 -> 7866 7867 7868 PariError: (8)
The other non-default algorithms (maxima and scipy) return the correct answer 1.0000...
Attachments (1)
Change History (12)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
- Summary changed from error in bessel_J(0,0) to [with fix, needs patch] error in bessel_J(0,0)
Aha!:
sage: pari('besselj(0,0)') 1.00000000000000 sage: pari('besselj(0.0,0.0)') --------------------------------------------------------------------------- PariError Traceback (most recent call last) /Users/rlmill/<ipython console> in <module>() /Users/rlmill/sage-3.2.2/local/lib/python2.5/site-packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:38645)() PariError: (8) sage: pari('besselj(0,0.0)') 1.00000000000000
The problem is that Pari is expecting an integer:
sage: R = RealField(53) sage: n = Integer(0) sage: z = R(0) sage: pari(n).besselj(z, precision=53) 1.00000000000000
I'll post a patch once my 3.3.alpha0 builds...
comment:3 Changed 11 years ago by
- Owner changed from somebody to rlm
- Status changed from new to assigned
comment:4 Changed 11 years ago by
- Summary changed from [with fix, needs patch] error in bessel_J(0,0) to [with patch, needs review] error in bessel_J(0,0)
comment:5 Changed 11 years ago by
- Summary changed from [with patch, needs review] error in bessel_J(0,0) to [with patch, positive review] error in bessel_J(0,0)
Positive review here. It applies cleanly to my 3.3.alpha0 tree and bessel_J(0, 0) works now.
comment:6 follow-up: ↓ 7 Changed 11 years ago by
- Summary changed from [with patch, positive review] error in bessel_J(0,0) to [with patch, needs more work] error in bessel_J(0,0)
I've reported the problem upstream to Pari.
The patch needs more work since non-integer arguments are no longer allowed:
sage: bessel_J(0.1,0) ... TypeError: Attempt to coerce non-integral RealNumber to Integer
This used to work before the patch:
sage: bessel_J(0.1,0.1) 0.777264368097005
comment:7 in reply to: ↑ 6 Changed 11 years ago by
Replying to zimmerma:
Good catch -- thanks for undoing my positive review. Anyone working on this should probably be aware of #3426, which involves other Pari/Bessel? problems.
comment:8 Changed 11 years ago by
Also, if the doctest did pass with the initial patch, the new one should add a test for say bessel_J(0.1,0.1), and make clear in the documentation which argument types are allowed.
Changed 11 years ago by
comment:9 Changed 11 years ago by
- Summary changed from [with patch, needs more work] error in bessel_J(0,0) to [with patch, needs review] error in bessel_J(0,0)
Fixed.
comment:10 Changed 11 years ago by
- Summary changed from [with patch, needs review] error in bessel_J(0,0) to [with patch, positive review] error in bessel_J(0,0)
The new patch is ok for me.
comment:11 Changed 11 years ago by
- Milestone changed from sage-3.4.1 to sage-3.3
- Resolution set to fixed
- Status changed from assigned to closed
Merged in Sage 3.3.alpha0
Cheers,
Michael
The problem is somewhere between the Pari interface and Pari itself: