Opened 6 years ago

Closed 8 months ago

#15334 closed defect (fixed)

Evaluation of Jacobi elliptic functions for non-real arguments depends on previously computed values

Reported by: davidamadore Owned by:
Priority: major Milestone: sage-8.9
Component: numerical Keywords: special function elliptic integral jacobi
Cc: jakobkroeker, vklein Merged in:
Authors: Frédéric Chapoton Reviewers: Vincent Klein
Report Upstream: N/A Work issues:
Branch: 4dd9669 (Commits) Commit: 4dd9669aff58380d98e88b6ba06ced9ece823684
Dependencies: Stopgaps:


The following example shows that numerically evaluating sn(I,1/2) first fails ("cannot evaluate symbolic expression numerically") and then succeeds once the value sc(1,1/2) has been computed:

sage: N(jacobi("sn", I, 1/2))
TypeError                                 Traceback (most recent call last)
<ipython-input-1-e0000742d9d6> in <module>()
----> 1 N(jacobi("sn", I, Integer(1)/Integer(2)))

/usr/src/local/sage-5.12/local/lib/python2.7/site-packages/sage/misc/functional.pyc in numerical_approx(x, prec, digits)
   1395             prec = int((digits+1) * LOG_TEN_TWO_PLUS_EPSILON) + 1
   1396     try:
-> 1397         return x._numerical_approx(prec)
   1398     except AttributeError:
   1399         from sage.rings.complex_double import is_ComplexDoubleElement

/usr/src/local/sage-5.12/local/lib/python2.7/site-packages/sage/symbolic/ in sage.symbolic.expression.Expression._numerical_approx (sage/symbolic/expression.cpp:22615)()

TypeError: cannot evaluate symbolic expression numerically
sage: N(jacobi("sc", 1, 1/2))
sage: N(jacobi("sn", I, 1/2))

(in fact, evaluating sc with any arguments whatsoever seems to make the sn function work afterward).

Change History (10)

comment:1 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:2 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:3 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:4 Changed 3 years ago by jakobkroeker

  • Cc jakobkroeker added

seems fixed meanwhile, needs a test?

comment:5 Changed 8 months ago by chapoton

  • Branch set to u/chapoton/15334
  • Commit set to 4dd9669aff58380d98e88b6ba06ced9ece823684
  • Milestone changed from sage-6.4 to sage-8.9
  • Status changed from new to needs_review

here is a doctest

New commits:

4dd9669trac 15334 adding one doctest for Jacobi function

comment:6 Changed 8 months ago by chapoton

  • Cc vklein tscim added

green bot, please review, easy one

comment:7 Changed 8 months ago by chapoton

  • Authors set to Frédéric Chapoton

comment:8 Changed 8 months ago by vklein

  • Reviewers set to Vincent Klein
  • Status changed from needs_review to positive_review

Looks good to me.

comment:9 Changed 8 months ago by chapoton

  • Cc tscim removed

merci Vincent

comment:10 Changed 8 months ago by vbraun

  • Branch changed from u/chapoton/15334 to 4dd9669aff58380d98e88b6ba06ced9ece823684
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.