Ticket #8237: trac_8237-maxima_infinity.take3.patch

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

apply only this patch

  • sage/calculus/calculus.py

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1271061088 -7200
    # Node ID 8e4446fee52394f32e85aab8c3391a43a9081102
    # Parent  275ab5ccad4ab867c400bedc990af40c37b32716
    trac 8237: fix conversion of different infinities back from maxima
    
    diff --git a/sage/calculus/calculus.py b/sage/calculus/calculus.py
    a b  
    964964        -x/sqrt(-x^2 + 1)
    965965        sage: limit(g, x=1, dir='below')
    966966        -Infinity
     967
     968    TESTS::
     969
     970        sage: limit(1/x,x=0)
     971        Infinity
     972        sage: limit(1/x,x=0,dir='above')
     973        +Infinity
     974        sage: limit(1/x,x=0,dir='below')
     975        -Infinity
    967976    """
    968977    if not isinstance(ex, Expression):
    969978        ex = SR(ex)
     
    14071416symtable = {'%pi':'pi', '%e': 'e', '%i':'I', '%gamma':'euler_gamma',
    14081417            'li[2]':'polylog2', 'li[3]':'polylog3'}
    14091418
    1410 from sage.symbolic.pynac import register_symbol
    1411 from sage.rings.infinity import infinity, minus_infinity
    1412 register_symbol(infinity, dict(maxima='inf'))
    1413 register_symbol(minus_infinity, dict(maxima='minf'))
    1414 
    14151419from sage.misc.multireplace import multiple_replace
    14161420import re
    14171421
  • sage/calculus/functional.py

    diff --git a/sage/calculus/functional.py b/sage/calculus/functional.py
    a b  
    311311        sage: lim(exp(x), x=-oo)
    312312        0
    313313        sage: lim(1/x, x=0)
    314         +Infinity
     314        Infinity
    315315        sage: limit(sqrt(x^2+x+1)+x, taylor=True, x=-oo)
    316316        -1/2
    317317        sage: limit((tan(sin(x)) - sin(tan(x)))/x^7, taylor=True, x=0)
  • sage/symbolic/constants.py

    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: maxima('inf').sage()
     206    +Infinity
     207    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
     231sage.symbolic.pynac.register_symbol(infinity, {'maxima':'inf'})
     232sage.symbolic.pynac.register_symbol(minus_infinity, {'maxima':'minf'})
     233sage.symbolic.pynac.register_symbol(unsigned_infinity, {'maxima':'infinity'})
     234
    221235def unpickle_Constant(class_name, name, conversions, latex, mathml, domain):
    222236    """
    223237    EXAMPLES::