]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/symbolic.py
Add a test for the lineality spaces of Z/pi-star being equal.
[sage.d.git] / mjo / symbolic.py
index ec3fc99e1e451b95b33eed22790b3dc089f617d1..992260efb9aaedadf187e06f4db6941d5055cb7e 100644 (file)
@@ -15,15 +15,15 @@ def set_simplification_domain(d):
 
     With the default 'complex' domain, we don't simplify this::
 
-        sage: (abs(x)^2).simplify()
-        abs(x)^2
+        sage: sqrt(x^2).simplify()
+        sqrt(x^2)
 
     But in the 'real' domain, we do::
 
         sage: set_simplification_domain('real')
         'real'
-        sage: (abs(x)^2).simplify()
-        x^2
+        sage: sqrt(x^2).simplify()
+        abs(x)
         sage: set_simplification_domain('complex')
         'complex'
 
@@ -44,45 +44,3 @@ def safe_simplify(expr):
     expr = expr.simplify_factorial()
     expr = expr.simplify_log()
     return expr
-
-
-def matrix_subs_expr(m, *equations):
-    """
-    Symbolic matrices have a `subs()` method, but no `subs_expr()`.
-    This makes it diffucult to substitute in a list of solutions obtained
-    with `solve()`.
-
-    INPUT:
-
-      - ``m`` -- A symbolic matrix.
-
-      - ``equations`` - One or more symbolic equations, presumably for
-        the entries of `m`.
-
-    OUTPUT:
-
-    The result of substituting each equation into `m`, one after another.
-
-    EXAMPLES::
-
-    sage: w,x,y,z = SR.var('w,x,y,z')
-    sage: A = matrix(SR, [[w,x],[y,z]])
-    sage: matrix_subs_expr(A, w == 1, x == 2, y == 3, z == 4)
-    [1 2]
-    [3 4]
-
-    """
-    from sage.symbolic.expression import is_SymbolicEquation
-
-    if not m.base_ring() == SR:
-        raise TypeError, 'the matrix "m" must be symbolic'
-
-    if isinstance(equations[0], dict):
-        eq_dict = equations[0]
-        equations = [ x == eq_dict[x] for x in eq_dict.keys() ]
-
-    if not all([is_SymbolicEquation(eq) for eq in equations]):
-            raise TypeError, "each expression must be an equation"
-
-    d = dict([(eq.lhs(), eq.rhs()) for eq in equations])
-    return m.subs(d)