Skip to content

Commit

Permalink
trac 28913 adding yet another doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed May 17, 2020
1 parent 203f9eb commit 297033a
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/sage/symbolic/integration/integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ def __init__(self):
sage: indefinite_integral(exp(x), 2*x)
2*e^x
TESTS:
Check for :trac:`28913`::
sage: Ex = (1-2*x^(1/3))^(3/4)/x
sage: integrate(Ex, x, algorithm="giac") # long time
4*(-2*x^(1/3) + 1)^(3/4) + 6*arctan((-2*x^(1/3) + 1)^(1/4)) - 3*log((-2*x^(1/3) + 1)^(1/4) + 1) + 3*log(abs((-2*x^(1/3) + 1)^(1/4) - 1))
"""
# The automatic evaluation routine will try these integrators
# in the given order. This is an attribute of the class instead of
Expand Down Expand Up @@ -179,7 +186,7 @@ def __init__(self):

def _eval_(self, f, x, a, b):
"""
Return the results of symbolic evaluation of the integral
Return the results of symbolic evaluation of the integral.
EXAMPLES::
Expand Down Expand Up @@ -217,12 +224,13 @@ def _eval_(self, f, x, a, b):

def _evalf_(self, f, x, a, b, parent=None, algorithm=None):
"""
Return a numerical approximation of the integral
Return a numerical approximation of the integral.
EXAMPLES::
sage: from sage.symbolic.integration.integral import definite_integral
sage: h = definite_integral(sin(x)*log(x)/x^2, x, 1, 2); h
sage: f = sin(x)*log(x)/x^2
sage: h = definite_integral(f, x, 1, 2, hold=True); h
integrate(log(x)*sin(x)/x^2, x, 1, 2)
sage: h.n() # indirect doctest
0.14839875208053...
Expand All @@ -241,7 +249,7 @@ def _evalf_(self, f, x, a, b, parent=None, algorithm=None):

def _tderivative_(self, f, x, a, b, diff_param=None):
"""
Return the derivative of symbolic integration
Return the derivative of symbolic integration.
EXAMPLES::
Expand All @@ -260,8 +268,9 @@ def _tderivative_(self, f, x, a, b, diff_param=None):
ans = definite_integral(f.diff(diff_param), x, a, b)
else:
ans = SR.zero()
return (ans + f.subs(x == b) * b.diff(diff_param)
- f.subs(x == a) * a.diff(diff_param))
return (ans
+ f.subs(x == b) * b.diff(diff_param)
- f.subs(x == a) * a.diff(diff_param))

def _print_latex_(self, f, x, a, b):
r"""
Expand Down

0 comments on commit 297033a

Please sign in to comment.