Opened 4 years ago

Closed 3 years ago

#19439 closed defect (fixed)

Corrections to infinities returned by mpmath

Reported by: rws Owned by:
Priority: major Milestone: sage-8.0
Component: symbolics Keywords:
Cc: paulmasson Merged in:
Authors: Ralf Stephan Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: 5d2d860 (Commits) Commit: 5d2d8604975fb8bd16159720ed3f45296ff88210
Dependencies: #22838 Stopgaps:

Description (last modified by rws)

It seems in some cases the infinities returned from mpmath need to be changed by the function's evalf() in order to be correct: Before:

sage: zeta(SR(1))
Infinity
sage: zeta(SR(1.))   <---------
+infinity
sage: type(zeta(SR(1)))
<type 'sage.symbolic.expression.Expression'>
sage: type(zeta(SR(1)).pyobject())
<class 'sage.rings.infinity.UnsignedInfinity'>
sage: type(zeta(SR(1.)))
<type 'sage.symbolic.expression.Expression'>
sage: type(zeta(SR(1.)).pyobject())
<type 'sage.rings.real_mpfr.RealNumber'>

The ticket should result in:

sage: zeta(SR(1))
Infinity
sage: zeta(SR(1.))
Infinity
sage: type(zeta(SR(1)))
<type 'sage.symbolic.expression.Expression'>
sage: type(zeta(SR(1)).pyobject())
<class 'sage.rings.infinity.UnsignedInfinity'>
sage: type(zeta(SR(1.)))
<type 'sage.symbolic.expression.Expression'>
sage: type(zeta(SR(1.)).pyobject())
<class 'sage.rings.infinity.UnsignedInfinity'>

Ideally, fix other such cases too in this ticket.

Change History (13)

comment:1 Changed 3 years ago by rws

Polylog uses zeta here, so it's mainly because of RR(1).zeta() not being converted in symbolic/function.pyx or the RR functions not using the InfinityRing elements.

comment:2 Changed 3 years ago by rws

  • Description modified (diff)
  • Milestone changed from sage-6.10 to sage-7.3

The problematic output is rather for the last lines, ie symbolic input, which should produce symbolic output. It does, by wrapping FP infinity into SR. It would be better if that would rather produce the infinity from the ring.

comment:3 Changed 3 years ago by paulmasson

  • Cc paulmasson added

comment:4 Changed 3 years ago by paulmasson

  • Description modified (diff)

comment:5 Changed 3 years ago by rws

  • Description modified (diff)
  • Milestone changed from sage-7.3 to sage-7.4
  • Summary changed from Different infinities returned by zeta/polylog to Convert FP subpackage infinities and NaNs to ring inifinities and symbolic NaN

comment:6 Changed 3 years ago by rws

  • Description modified (diff)

comment:7 Changed 3 years ago by rws

  • Priority changed from minor to major

comment:8 Changed 3 years ago by rws

  • Description modified (diff)
  • Milestone changed from sage-7.4 to sage-8.0
  • Summary changed from Convert FP subpackage infinities and NaNs to ring inifinities and symbolic NaN to Corrections to infinities returned by mpmath

comment:9 Changed 3 years ago by rws

  • Branch set to u/rws/corrections_to_infinities_returned_by_mpmath

comment:10 Changed 3 years ago by rws

  • Authors set to Ralf Stephan
  • Commit set to 5d2d8604975fb8bd16159720ed3f45296ff88210
  • Dependencies set to pynac-0.7.6

New commits:

5d2d86019439: Corrections to infinities returned by mpmath

comment:11 Changed 3 years ago by rws

  • Dependencies changed from pynac-0.7.6 to #22838
  • Status changed from new to needs_review

comment:12 Changed 3 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

LGTM.

comment:13 Changed 3 years ago by vbraun

  • Branch changed from u/rws/corrections_to_infinities_returned_by_mpmath to 5d2d8604975fb8bd16159720ed3f45296ff88210
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.