Changeset 7438:7f85c3293717


Ignore:
Timestamp:
11/26/07 13:59:39 (5 years ago)
Author:
Mike Hansen <mhansen@…>
Branch:
default
Message:

Fixed #1111.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/calculus/equations.py

    r7259 r7438  
    584584            return X 
    585585         
     586 
     587    def expand(self, side=None): 
     588        """ 
     589        Expands one or both sides of the equation. 
     590 
     591        If side is not specified, then both sides of the equation 
     592        are expanded by calling expand() on the corresponding 
     593        SymbolicExpression. 
     594 
     595        If side is 'left' (or 'right'), then only the left (or right) 
     596        side of the equation is expanded. 
     597 
     598        EXAMPLES: 
     599            sage: a = (16*x-13)/6 == (3*x+5)/2 - (4-x)/3 
     600            sage: a.expand() 
     601            8*x/3 - 13/6 == 11*x/6 + 7/6 
     602            sage: a.expand('left') 
     603            8*x/3 - 13/6 == (3*x + 5)/2 - (4 - x)/3 
     604            sage: a.expand('right') 
     605            (16*x - 13)/6 == 11*x/6 + 7/6 
     606        """ 
     607        if side is None: 
     608            return SymbolicEquation(self._left.expand(), self._right.expand(), self._op) 
     609        elif side == 'left': 
     610            return SymbolicEquation(self._left.expand(), self._right, self._op) 
     611        elif side == 'right': 
     612            return SymbolicEquation(self._left, self._right.expand(), self._op) 
     613        else: 
     614            raise ValueError, "side must be 'left', 'right', or None" 
    586615         
    587616 
Note: See TracChangeset for help on using the changeset viewer.