Opened 11 years ago

Closed 10 years ago

Last modified 7 years ago

#12345 closed defect (fixed)

Sympy minus infinity doesn't convert to Sage

Reported by: kcrisman Owned by: burcin
Priority: major Milestone: sage-5.1
Component: symbolics Keywords: sd40.5
Cc: certik, rws Merged in: sage-5.1.beta4
Authors: Douglas McNeil Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: u/akhi/sympy_minus_infinity_doesn_t_convert_to_sage (Commits, GitHub, GitLab) Commit: 52db42b01c1b86c752652a09533e50dd0d899ab3
Dependencies: Stopgaps:

Status badges


sage: a,b = oo, -oo
sage: a._sympy_()
sage: b._sympy_()
AttributeError                            Traceback (most recent call last)

/Users/.../sage-4.7.2/local/lib/python2.6/site-packages/sage/structure/ in sage.structure.element.Element.__getattr__ (sage/structure/element.c:2840)()

AttributeError: 'MinusInfinity' object has no attribute '_sympy_'

See this question for background.

Attachments (1)

trac_12345_minusinfinity_sympyfication.patch (1.6 KB) - added by jdemeyer 10 years ago.
add _sympy_ method to MinusInfinity?

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by dsm

  • Keywords sd40.5 added
  • Status changed from new to needs_review

Straightforward fix and test of the original case as an integral.

comment:2 Changed 10 years ago by kcrisman

  • Authors set to Douglas McNeil
  • Reviewers set to Karl-Dieter Crisman

Umm, even without this patch I get

sage: import sympy
sage: bool(SR(-oo) == -sympy.oo)
sage: bool(-oo == -sympy.oo)

Am I missing something? How is that an indirect doctest?

That said, the integral works fine now and the tests pass.

comment:3 Changed 10 years ago by dsm

Ah, those were merely mirroring the +oo cases. Really they were only testing whether the negation worked; it was the integral test which was really verifying the success. However, we can test it explicitly by adding.

    sage: bool((-oo)._sympy_() == -sympy.oo)

which fails without the patch. Modified to incorporate this.

comment:4 Changed 10 years ago by kcrisman

  • Status changed from needs_review to positive_review

Positive review.

Changed 10 years ago by jdemeyer

add _sympy_ method to MinusInfinity?

comment:5 Changed 10 years ago by jdemeyer

  • Merged in set to sage-5.1.beta4
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:6 Changed 7 years ago by akhi

  • Branch set to u/akhi/sympy_minus_infinity_doesn_t_convert_to_sage

comment:7 Changed 7 years ago by kcrisman

  • Cc rws added
  • Commit set to 52db42b01c1b86c752652a09533e50dd0d899ab3

I think this ticket is already fixed?

Note: See TracTickets for help on using tickets.