Ticket #8237: trac_8237-maxima_infinity.patch

File trac_8237-maxima_infinity.patch, 1.8 KB (added by burcin, 12 years ago)

fix conversion of different infinities back from maxima

  • sage/symbolic/constants.py

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1265925243 -3600
    # Node ID 40b6672883f53201203af0449ad3af8f6c3017dd
    # Parent  0b14f34d014f652acc036a0303b13dae380ab74e
    trac 8237: fix conversion of different infinities back from maxima
    
    diff --git a/sage/symbolic/constants.py b/sage/symbolic/constants.py
    a b  
    197197    13.271347940197249310098819199575813940871106820003074817832971189555
    198198    sage: RDF(a)
    199199    13.2713479402
     200
     201Test if #8237 is fixed::
     202
     203    sage: maxima('infinity').sage()
     204    Infinity
     205    sage: sage: maxima('inf').sage()
     206    +Infinity
     207    sage: sage: maxima('minf').sage()
     208    -Infinity
    200209"""
    201210###############################################################################
    202211#   Sage: Open Source Mathematical Software
    203212#       Copyright (C) 2008 William Stein <wstein@gmail.com>
    204 #       Copyright (C) 2008 Burcin Erocal <burcin@erocal.org>
     213#       Copyright (C) 2008-2010 Burcin Erocal <burcin@erocal.org>
    205214#                     2009 Mike Hansen <mhansen@gmail.com>
    206215#  Distributed under the terms of the GNU General Public License (GPL),
    207216#  version 2 or any later version.  The full text of the GPL is available at:
     
    218227constants_name_table[repr(unsigned_infinity)] = unsigned_infinity
    219228constants_name_table[repr(minus_infinity)] = minus_infinity
    220229
     230import sage.symbolic.pynac
     231from sage.symbolic.ring import SR
     232sage.symbolic.pynac.register_symbol(SR(infinity), {'maxima':'inf'})
     233sage.symbolic.pynac.register_symbol(SR(minus_infinity), {'maxima':'minf'})
     234sage.symbolic.pynac.register_symbol(SR(unsigned_infinity), {'maxima':'infinity'})
     235
    221236def unpickle_Constant(class_name, name, conversions, latex, mathml, domain):
    222237    """
    223238    EXAMPLES::