Ticket #8237: trac_8237-maxima_infinity.take2.patch

File trac_8237-maxima_infinity.take2.patch, 3.2 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 1266675559 -3600
    # Node ID 8a4c49d44fa35e2cfa1ecaf6d02d821451205115
    # Parent  493c4a6065bf92d13501a36a9bd9affc705d2cdb
    trac 8237: fix conversion of different infinities back from maxima
    
    diff --git a/sage/calculus/calculus.py b/sage/calculus/calculus.py
    a b  
    986986        -x/sqrt(-x^2 + 1)
    987987        sage: limit(g, x=1, dir='below')
    988988        -Infinity
     989
     990    TESTS::
     991
     992        sage: limit(1/x,x=0)
     993        Infinity
     994        sage: limit(1/x,x=0,dir='above')
     995        +Infinity
     996        sage: limit(1/x,x=0,dir='below')
     997        -Infinity
    989998    """
    990999    if not isinstance(ex, Expression):
    9911000        ex = SR(ex)
     
    14281437symtable = {'%pi':'pi', '%e': 'e', '%i':'I', '%gamma':'euler_gamma',
    14291438            'li[2]':'polylog2', 'li[3]':'polylog3'}
    14301439
    1431 from sage.symbolic.pynac import register_symbol
    1432 from sage.rings.infinity import infinity, minus_infinity
    1433 register_symbol(infinity, dict(maxima='inf'))
    1434 register_symbol(minus_infinity, dict(maxima='minf'))
    1435 
    14361440from sage.misc.multireplace import multiple_replace
    14371441
    14381442import re
     
    14761480        sage: a.sage()
    14771481        x != 0
    14781482    """
     1483    global _syms
     1484    _syms = sage.symbolic.pynac.symbol_table.get('maxima', {})
    14791485    syms = dict(_syms)
    14801486
    14811487    if len(x) == 0:
  • 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::