Ticket #12737: sage-trac_12737-rebased.patch

File sage-trac_12737-rebased.patch, 6.3 KB (added by mjo, 6 years ago)

Rebased patch against 5.11.beta3

  • doc/en/prep/Symbolics-and-Basic-Plotting.rst

    # HG changeset patch
    # User Michael Orlitzky <michael@orlitzky.com>
    # Date 1372726760 14400
    # Node ID d4c631debaa57a25a3c5bf279b4e3094dcadb338
    # Parent  5d8c13e7b81a1e152855073f97a4d48ee97255d1
    Trac #12737: Remove Expression.simplify_radical() from Expression.simplify_full().
    
     * Remove the call to simplify_radical() in simplify_full().
    
     * Move a doctest from simplify_full() to simplify_radical().
    
     * Fix a doctest in sage/misc/functional.py by replacing
       simplify_full() with simplify() and appropriate assumptions. The
       test worked previously, with its assumptions missing, thanks to
       simplify_radical and a little bit of luck.
    
     * Update a doctest in sage/modules/vector_symbolic_dense.py. The
       result is now slightly worse, but doesn't make invalid assumptions
       about the domain either.
    
     * Update two doctests in sage/calculus/wester.py and
       sage/symbolic/integration/integral.py to call simplify_radical()
       instead of simplify_full().
    
     * Change two doctests for floor/ceil to use sin() and cos() instead
       log(). This still tests that those functions convert to SR and
       simplify, but does not make any assumptions about the domain of
       the answer.
    
     * Adjust a doctest in sage/interfaces/maxima_lib.py to use
       simplify_radical() instead of simplify_full().
    
    diff --git a/doc/en/prep/Symbolics-and-Basic-Plotting.rst b/doc/en/prep/Symbolics-and-Basic-Plotting.rst
    a b  
    183183
    184184    sage: z = ((x - 1)^(3/2) - (x + 1)*sqrt(x - 1))/sqrt((x - 1)*(x + 1))
    185185    sage: z.simplify_full()
    186     -2/sqrt(x + 1)
    187 
    188 ::
    189 
    190     sage: z.simplify_rational() # Just simplify the fraction part of the expression by combining it.
    191186    -2*sqrt(x - 1)/sqrt(x^2 - 1)
    192187
    193188This is a good place for a few reminders of basic help.
  • sage/calculus/wester.py

    diff --git a/sage/calculus/wester.py b/sage/calculus/wester.py
    a b  
    120120    (e^x - 1)/(e^(1/2*x) + 1)
    121121    sage: g
    122122    e^(1/2*x) - 1
    123     sage: f.simplify_full(),g
    124     (e^(1/2*x) - 1, e^(1/2*x) - 1)
     123    sage: f.simplify_radical()
     124    e^(1/2*x) - 1
     125    sage: g
     126    e^(1/2*x) - 1
    125127    sage: f(x=10.0).n(53), g(x=10.0).n(53)
    126128    (147.413159102577, 147.413159102577)
    127129    sage: bool(f == g)
  • sage/functions/other.py

    diff --git a/sage/functions/other.py b/sage/functions/other.py
    a b  
    331331
    332332        ::
    333333
    334             sage: ceil(log(8)/log(2))
    335             3
     334            sage: ceil(sin(8)/sin(2))
     335            2
    336336
    337337        ::
    338338
     
    431431                return lower_ceil
    432432            else:
    433433                try:
    434                     return ceil(SR(x).full_simplify())
     434                    return ceil(SR(x).full_simplify().simplify_radical())
    435435                except ValueError:
    436436                    pass
    437437                raise ValueError, "x (= %s) requires more than %s bits of precision to compute its ceiling"%(x, maximum_bits)
     
    503503
    504504        ::
    505505
    506             sage: floor(log(8)/log(2))
    507             3
     506            sage: floor(cos(8)/cos(2))
     507            0
    508508
    509509        ::
    510510
     
    592592                return lower_floor
    593593            else:
    594594                try:
    595                     return floor(SR(x).full_simplify())
     595                    return floor(SR(x).full_simplify().simplify_radical())
    596596                except ValueError:
    597597                    pass
    598598                raise ValueError, "x (= %s) requires more than %s bits of precision to compute its floor"%(x, maximum_bits)
  • sage/interfaces/maxima_lib.py

    diff --git a/sage/interfaces/maxima_lib.py b/sage/interfaces/maxima_lib.py
    a b  
    714714
    715715        ::
    716716
    717             sage: integrate(sqrt(x + sqrt(x)), x).simplify_full()
     717            sage: integrate(sqrt(x + sqrt(x)), x).simplify_radical()
    718718            1/12*((8*x - 3)*x^(1/4) + 2*x^(3/4))*sqrt(sqrt(x) + 1) + 1/8*log(sqrt(sqrt(x) + 1) + x^(1/4)) - 1/8*log(sqrt(sqrt(x) + 1) - x^(1/4))
    719719
    720720        And :trac:`11594`::
  • sage/modules/vector_symbolic_dense.py

    diff --git a/sage/modules/vector_symbolic_dense.py b/sage/modules/vector_symbolic_dense.py
    a b  
    1717    sage: type(u)
    1818    <class 'sage.modules.vector_symbolic_dense.Vector_symbolic_dense'>
    1919    sage: u.simplify_full()
    20     (1, log(6) + 2*log(y))
     20    (1, log(6*y^2))
    2121
    2222TESTS:
    2323
  • sage/symbolic/expression.pyx

    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    77747774       
    77757775        EXAMPLES::
    77767776       
    7777             sage: a = log(8)/log(2)
    7778             sage: a.simplify_full()
    7779             3
    7780        
    7781         ::
    7782        
    77837777            sage: f = sin(x)^2 + cos(x)^2
    77847778            sage: f.simplify_full()
    77857779            1
     
    77977791            sage: f = binomial(n,k)*factorial(k)*factorial(n-k)
    77987792            sage: f.simplify_full()
    77997793            factorial(n)
     7794
     7795        TESTS:
     7796
     7797        There are two square roots of `$(x + 1)^2$`, so this should
     7798        not be simplified to `$x + 1$`, :trac:`12737`::
     7799
     7800            sage: f = sqrt((x + 1)^2)
     7801            sage: f.simplify_full()
     7802            sqrt(x^2 + 2*x + 1)
     7803
    78007804        """
    78017805        x = self
    78027806        x = x.simplify_factorial()
    78037807        x = x.simplify_trig()
    78047808        x = x.simplify_rational()
    7805         x = x.simplify_radical()
    78067809        x = x.simplify_log('one')
    78077810        x = x.simplify_rational()
    78087811        return x
     
    80658068            sage: f = log(x*y)
    80668069            sage: f.simplify_radical()
    80678070            log(x) + log(y)
    8068        
     8071
     8072        ::
     8073
     8074            sage: f = log(8)/log(2)
     8075            sage: f.simplify_radical()
     8076            3
     8077
    80698078        ::
    80708079       
    80718080            sage: f = (log(x+x^2)-log(x))^a/log(1+x)^(a/2)
  • sage/symbolic/integration/integral.py

    diff --git a/sage/symbolic/integration/integral.py b/sage/symbolic/integration/integral.py
    a b  
    639639    of the gamma function; however, we get something equivalent::
    640640
    641641        sage: actual_result = integral(e^(-1/x^2), x, 0, 1)
    642         sage: actual_result.full_simplify()
     642        sage: actual_result.simplify_radical()
    643643        (sqrt(pi)*(erf(1)*e - e) + 1)*e^(-1)
    644644        sage: ideal_result = 1/2*gamma(-1/2, 1)
    645645        sage: error = actual_result - ideal_result