Ticket #9947: trac_9947-add_eval.patch

File trac_9947-add_eval.patch, 840 bytes (added by burcin, 12 years ago)

add doctest

  • sage/symbolic/expression.pyx

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1285325699 -7200
    # Node ID 7510f06533a00edf17b0055e2db773df7d1b8b0d
    # Parent  44e6d1dbe2cc2807ec759be476f1c1cc35f4c8f1
    trac 9947: add doctest to check that add::eval() collects all numeric terms
    
    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    119119    e^sqrt(x) + e^(-sqrt(x))
    120120    sage: t
    121121    e^sqrt(x)
     122
     123Test if #9947 is fixed::
     124
     125    sage: real_part(1+2*(sqrt(2)+1)*(sqrt(2)-1))
     126    3
     127    sage: a=(sqrt(4*(sqrt(3) - 5)*(sqrt(3) + 5) + 48) + 4*sqrt(3))/ (sqrt(3) + 5)
     128    sage: a.real_part()
     129    4*sqrt(3)/(sqrt(3) + 5)
     130    sage: a.imag_part()
     131    sqrt(abs(4*(sqrt(3) - 5)*(sqrt(3) + 5) + 48))/(sqrt(3) + 5)
    122132"""
    123133
    124134include "../ext/interrupt.pxi"