Ticket #21667: 0001-remove-def-integral-from-functional.py.patch

File 0001-remove-def-integral-from-functional.py.patch, 5.7 KB (added by mafra, 4 years ago)

Remove redundant definition of integral from functional.py

  • build/pkgs/pynac/checksums.ini

    From fa56bad711439121aded56ae4f3dfa2989b31607 Mon Sep 17 00:00:00 2001
    From: "Carlos R. Mafra" <crmafra@gmail.com>
    Date: Sat, 8 Oct 2016 15:39:04 +0100
    Subject: [PATCH] remove def integral from functional.py
    
    Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
    ---
     build/pkgs/pynac/checksums.ini           |   6 +-
     src/sage/misc/all.py                     |   3 +-
     src/sage/misc/functional.py              | 101 -------------------------------
     src/sage/modules/free_module_element.pyx |   2 +-
     4 files changed, 6 insertions(+), 106 deletions(-)
    
    diff --git a/build/pkgs/pynac/checksums.ini b/build/pkgs/pynac/checksums.ini
    index 875bca8..5dbd58e 100644
    a b  
    11tarball=pynac-VERSION.tar.bz2
    2 sha1=ec58904c8fbf77ba6fa2c5a29d794763a465a0d8
    3 md5=5ac8e4fd9c4593f836fac12d18227b50
    4 cksum=1117908588
     2sha1=d205c18a6d5eda617e60ede242e902ce59586516
     3md5=de85031958e5a20ce68a6be4facd4ac6
     4cksum=2583453790
  • src/sage/misc/all.py

    diff --git a/src/sage/misc/all.py b/src/sage/misc/all.py
    index bdd492f..da165db 100644
    a b from .persist import save, load, dumps, loads, db, db_save 
    8686
    8787from .func_persist import func_persist
    8888
     89lazy_import("sage.symbolic.integration.integral", "integrate","integral")
     90
    8991from .functional import (additive_order,
    9092                        base_ring,
    9193                        base_field,
    from .functional import (additive_order, 
    108110                        gens,
    109111                        hecke_operator,
    110112                        image,
    111                         integral, integrate,
    112113                        integral_closure,
    113114                        interval,
    114115                        xinterval,
  • src/sage/misc/functional.py

    diff --git a/src/sage/misc/functional.py b/src/sage/misc/functional.py
    index 1ff6c75..0165aac 100644
    a b def symbolic_sum(expression, *args, **kwds): 
    567567        return SR(expression).sum(*args, **kwds)
    568568
    569569
    570 def integral(x, *args, **kwds):
    571     """
    572     Returns an indefinite or definite integral of an object x.
    573 
    574     First call x.integral() and if that fails make an object and
    575     integrate it using Maxima, maple, etc, as specified by algorithm.
    576 
    577     For symbolic expression calls
    578     :func:`sage.calculus.calculus.integral` - see this function for
    579     available options.
    580 
    581     EXAMPLES::
    582 
    583         sage: f = cyclotomic_polynomial(10)
    584         sage: integral(f)
    585         1/5*x^5 - 1/4*x^4 + 1/3*x^3 - 1/2*x^2 + x
    586 
    587     ::
    588 
    589         sage: integral(sin(x),x)
    590         -cos(x)
    591 
    592     ::
    593 
    594         sage: y = var('y')
    595         sage: integral(sin(x),y)
    596         y*sin(x)
    597 
    598     ::
    599 
    600         sage: integral(sin(x), x, 0, pi/2)
    601         1
    602         sage: sin(x).integral(x, 0,pi/2)
    603         1
    604         sage: integral(exp(-x), (x, 1, oo))
    605         e^(-1)
    606 
    607     Numerical approximation::
    608 
    609         sage: h = integral(tan(x)/x, (x, 1, pi/3)); h
    610         integrate(tan(x)/x, x, 1, 1/3*pi)
    611         sage: h.n()
    612         0.07571599101...
    613 
    614     Specific algorithm can be used for integration::
    615 
    616         sage: integral(sin(x)^2, x, algorithm='maxima')
    617         1/2*x - 1/4*sin(2*x)
    618         sage: integral(sin(x)^2, x, algorithm='sympy')
    619         -1/2*cos(x)*sin(x) + 1/2*x
    620 
    621     TESTS:
    622 
    623     A symbolic integral from :trac:`11445` that was incorrect in
    624     earlier versions of Maxima::
    625 
    626         sage: f = abs(x - 1) + abs(x + 1) - 2*abs(x)
    627         sage: integrate(f, (x, -Infinity, Infinity))
    628         2
    629 
    630     Another symbolic integral, from :trac:`11238`, that used to return
    631     zero incorrectly; with Maxima 5.26.0 one gets
    632     ``1/2*sqrt(pi)*e^(1/4)``, whereas with 5.29.1, and even more so
    633     with 5.33.0, the expression is less pleasant, but still has the
    634     same value.  Unfortunately, the computation takes a very long time
    635     with the default settings, so we temporarily use the Maxima
    636     setting ``domain: real``::
    637 
    638         sage: sage.calculus.calculus.maxima('domain: real')
    639         real
    640         sage: f = exp(-x) * sinh(sqrt(x))
    641         sage: t = integrate(f, x, 0, Infinity); t            # long time
    642         1/4*sqrt(pi)*(erf(1) - 1)*e^(1/4) - 1/4*(sqrt(pi)*(erf(1) - 1) - sqrt(pi) + 2*e^(-1) - 2)*e^(1/4) + 1/4*sqrt(pi)*e^(1/4) - 1/2*e^(1/4) + 1/2*e^(-3/4)
    643         sage: t.canonicalize_radical()  # long time
    644         1/2*sqrt(pi)*e^(1/4)
    645         sage: sage.calculus.calculus.maxima('domain: complex')
    646         complex
    647 
    648     An integral which used to return -1 before maxima 5.28. See :trac:`12842`::
    649 
    650         sage: f = e^(-2*x)/sqrt(1-e^(-2*x))
    651         sage: integrate(f, x, 0, infinity)
    652         1
    653 
    654     This integral would cause a stack overflow in earlier versions of
    655     Maxima, crashing sage. See :trac:`12377`. We don't care about the
    656     result here, just that the computation completes successfully::
    657 
    658         sage: y = (x^2)*exp(x) / (1 + exp(x))^2
    659         sage: _ = integrate(y, x, -1000, 1000)
    660 
    661     """
    662     if hasattr(x, 'integral'):
    663         return x.integral(*args, **kwds)
    664     else:
    665         from sage.symbolic.ring import SR
    666         return SR(x).integral(*args, **kwds)
    667 
    668 integrate = integral
    669 
    670 
    671570def integral_closure(x):
    672571    """
    673572    Returns the integral closure of x.
  • src/sage/modules/free_module_element.pyx

    diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx
    index 452fa0c..d7d286e 100644
    a b cdef class FreeModuleElement(Vector): # abstract base class 
    38623862            (1/2, 1/3, -cos(1) + 1)
    38633863
    38643864        """
    3865         from sage.misc.functional import integral
     3865        from sage.symbolic.integration.integral import integrate
    38663866        return self.apply_map(lambda x: integral(x,*args, **kwds))
    38673867
    38683868    integrate=integral