Ticket #13011: trac_13011.patch

File trac_13011.patch, 1.8 KB (added by was, 10 years ago)
  • sage/interfaces/mathematica.py

    # HG changeset patch
    # User William Stein <wstein@gmail.com>
    # Date 1337968618 25200
    # Node ID f3b4868661208951a7c2e2d3bf58c371a7c2335d
    # Parent  19ab641989626403bb4ee4ae4efdb93de31892d2
    Trac #13011: several optional tests fail in the sage/mathematica interface with mathematica 8.0
    
    diff --git a/sage/interfaces/mathematica.py b/sage/interfaces/mathematica.py
    a b  
    126126               2
    127127             {x  - 3 y == 3, 2 x - y == 1}
    128128    sage: sys.Solve('{x, y}')               # optional - mathematica
    129     {{y -> -1, x -> 0}, {y -> 11, x -> 6}}
     129    {{x -> 0, y -> -1}, {x -> 6, y -> 11}}
    130130
    131131Assignments and definitions
    132132~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    150150    sage: v = m([eq1, eq2]); v              # optional - mathematica
    151151    {x^2 - 3*y == 3, 2*x - y == 1}
    152152    sage: v.Solve(['x', 'y'])               # optional - mathematica
    153     {{y -> -1, x -> 0}, {y -> 11, x -> 6}}
     153    {{x -> 0, y -> -1}, {x -> 6, y -> 11}}
    154154
    155155Function definitions
    156156~~~~~~~~~~~~~~~~~~~~
     
    863863            return -1  # everything is supposed to be comparable in Python, so we define
    864864                       # the comparison thus when no comparable in interfaced system.
    865865
     866    def N(self, *args):
     867        """
     868        EXAMPLES::
     869
     870            sage: mathematica('Pi').N(10)
     871            3.1415926536
     872            sage: mathematica('Pi').N(50)
     873            3.14159265358979323846264338327950288419716939937511           
     874        """
     875        # The base class way up the hierarchy defines an "N" (modeled
     876        # after Mathematica's!)  which overwrites the Mathematica one,
     877        # and doesn't work at all. We restore it here.
     878        return self.parent().N(self, *args)
     879       
     880
    866881class MathematicaFunction(ExpectFunction):
    867882    def _sage_doc_(self):
    868883        M = self._parent