Ticket #8969: trac_8969_allow_neq_maxima_strings_v2.patch

File trac_8969_allow_neq_maxima_strings_v2.patch, 1.2 KB (added by dsm, 9 years ago)

revised version

  • sage/calculus/calculus.py

    # HG changeset patch
    # User D. S. McNeil <dsm054@gmail.com>
    # Date 1337989349 25200
    # Node ID 8555de83ba1dd56b4daecab6fd8b3ff1f4708929
    # Parent  5299aa8232d7acb68d37162f5bef2068c8a68d54
    Trac #8969: allow conversion of != from maxima strings
    
    diff --git a/sage/calculus/calculus.py b/sage/calculus/calculus.py
    a b  
    16711671        \overline{x}
    16721672        sage: latex(t._maxima_()._sage_())
    16731673        \overline{x}
     1674
     1675    Check that we can understand maxima's not-equals (:trac:`8969`)::
     1676   
     1677        sage: from sage.calculus.calculus import symbolic_expression_from_maxima_string as sefms
     1678        sage: sefms("x != 3") == SR(x != 3)
     1679        True
     1680        sage: sefms("x # 3") == SR(x != 3)
     1681        True
     1682        sage: solve([x != 5], x)
     1683        [[x - 5 != 0]]
     1684        sage: solve([2*x==3, x != 5], x)
     1685        [[x == (3/2), (-7/2) != 0]]
     1686   
    16741687    """
    16751688    syms = sage.symbolic.pynac.symbol_table.get('maxima', {}).copy()
    16761689
     
    17111724
    17121725    if equals_sub:
    17131726        s = s.replace('=','==')
     1727        # unfortunately, this will turn != into !==, which we correct
     1728        s = s.replace("!==", "!=")
    17141729
    17151730    #replace %union from to_poly_solve with a list
    17161731    if s[0:5]=='union':