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

error in bessel_J(0,0) #4626

Closed
zimmermann6 opened this issue Nov 26, 2008 · 9 comments
Closed

error in bessel_J(0,0) #4626

zimmermann6 opened this issue Nov 26, 2008 · 9 comments

Comments

@zimmermann6
Copy link

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

Component: basic arithmetic

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

@rlmill
Copy link
Mannequin

rlmill mannequin commented Jan 22, 2009

comment:1

The problem is somewhere between the Pari interface and Pari itself:

sage: R = RealField(53)
sage: n = R(0)
sage: z = R(0)
sage: pari(n).besselj(z, precision=53)
BOOM

@rlmill
Copy link
Mannequin

rlmill mannequin commented Jan 22, 2009

comment:2

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

@rlmill rlmill mannequin changed the title error in bessel_J(0,0) [with fix, needs patch] error in bessel_J(0,0) Jan 22, 2009
@rlmill rlmill mannequin self-assigned this Jan 22, 2009
@rlmill rlmill mannequin changed the title [with fix, needs patch] error in bessel_J(0,0) error in bessel_J(0,0) Jan 22, 2009
@rlmill rlmill mannequin added the s: needs review label Jan 22, 2009
@zimmermann6
Copy link
Author

comment:6

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

@zimmermann6 zimmermann6 changed the title error in bessel_J(0,0) [needs more work] error in bessel_J(0,0) Jan 22, 2009
@zimmermann6
Copy link
Author

comment:8

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.

@rlmill
Copy link
Mannequin

rlmill mannequin commented Jan 22, 2009

comment:9

Attachment: trac_4626-bessel_J_ints.patch.gz

Fixed.

@rlmill rlmill mannequin changed the title [needs more work] error in bessel_J(0,0) error in bessel_J(0,0) Jan 22, 2009
@zimmermann6
Copy link
Author

comment:10

The new patch is ok for me.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Jan 23, 2009

comment:11

Merged in Sage 3.3.alpha0

Cheers,

Michael

@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Jan 23, 2009
@sagetrac-mabshoff sagetrac-mabshoff mannequin modified the milestones: sage-3.4.1, sage-3.3 Jan 23, 2009
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

2 participants
@zimmermann6 and others