Ticket #12845: sage-trac_12845.patch

File sage-trac_12845.patch, 941 bytes (added by mjo, 10 years ago)

Add assumptions and use simplify() instead of simplify_full().

  • sage/misc/functional.py

    # HG changeset patch
    # User Michael Orlitzky <michael@orlitzky.com>
    # Date 1334514620 14400
    # Node ID 53e8202bcec0b22df251ba3f3cfb7ac7f6bdb709
    # Parent  7d8ac0ee679de0e5eeba4966fe280f5f65295472
    Trac #12845: supply appropriate assumptions to fix an incorrect doctest.
    
    diff --git a/sage/misc/functional.py b/sage/misc/functional.py
    a b  
    11601160    The complex norm of symbolic expressions::
    11611161
    11621162        sage: a, b, c = var("a, b, c")
     1163        sage: assume((a, 'real'), (b, 'real'), (c, 'real'))
    11631164        sage: z = a + b*I
    11641165        sage: bool(norm(z).simplify() == a^2 + b^2)
    11651166        True
    11661167        sage: norm(a + b).simplify()
    11671168        a^2 + 2*a*b + b^2
    11681169        sage: v = vector([a, b, c])
    1169         sage: bool(norm(v).simplify_full() == sqrt(a^2 + b^2 + c^2))
     1170        sage: bool(norm(v).simplify() == sqrt(a^2 + b^2 + c^2))
    11701171        True
    11711172    """
    11721173    return x.norm()