Changeset 7820:3af2c144d35a


Ignore:
Timestamp:
12/20/07 12:15:58 (5 years ago)
Author:
William Stein <wstein@…>
Branch:
default
Tags:
2.9.1.alpha2
Message:

Trac #1569 -- fix solve bug that Brandon Barker reported

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/calculus/equations.py

    r7730 r7820  
    727727 
    728728def solve(f, *args, **kwds): 
    729     """ 
     729    r""" 
    730730    Algebraically solve an equation of system of equations for given variables. 
    731731 
     
    734734        *args -- variables to solve for. 
    735735        solution_dict = True -- return a list of dictionaries containing the solutions. 
     736 
    736737    EXAMPLES: 
    737738        sage: x, y = var('x, y') 
     
    760761        0.000 , 1.00 
    761762 
     763    If True appears in the list of equations it is ignored, and if 
     764    False appears in the list then no solutions are returned.  E.g., 
     765    note that the first \code{3==3} evaluates to True, not to a symbolic 
     766    equation.   
     767     
     768        sage: solve([3==3, 1.00000000000000*x^3 == 0], x) 
     769        [x == 0] 
     770        sage: solve([1.00000000000000*x^3 == 0], x) 
     771        [x == 0] 
     772 
     773    Here, the first evaluates to False, so there are no solutions: 
     774        sage: solve([1==3, 1.00000000000000*x^3 == 0], x) 
     775        [] 
    762776 
    763777    """ 
    764778    if isinstance(f, (list, tuple)): 
     779        f = [s for s in f if s is not True] 
     780        for s in f: 
     781            if s is False: 
     782                return [] 
     783             
    765784        m = maxima(list(f)) 
    766785        try: 
Note: See TracChangeset for help on using the changeset viewer.