[PATCH] integration patch

1 view
Skip to first unread message

Ondrej Certik

unread,
Nov 23, 2007, 10:43:44 PM11/23/07
to sympy-...@googlegroups.com
# HG changeset patch
# User Ondrej Certik <ond...@certik.cz>
# Date 1195875729 -3600
# Node ID 288ae08836c6480dc1398246728cb2ef416da46c
# Parent e664e537a4e96194e888a935ab5abf370d46567a
integration patch

diff -r e664e537a4e9 -r 288ae08836c6 sympy/integrals/integrals.py
--- a/sympy/integrals/integrals.py Sat Nov 24 03:28:42 2007 +0100
+++ b/sympy/integrals/integrals.py Sat Nov 24 04:42:09 2007 +0100
@@ -117,6 +117,9 @@ class Integral(Basic, NoRelMeths, ArithM
def _eval_integral(self, f, x):
# TODO : add table lookup for logarithmic and sine/cosine integrals
# and for some elementary special cases for speed improvement.
+ from sympy import Pow
+ if isinstance(f, Pow) and isinstance(f[0], Symbol) and f[1].is_number:
+ return f[0]**(f[1]+1)/(f[1]+1)
return risch_norman(f, x)

def integrate(*args, **kwargs):
diff -r e664e537a4e9 -r 288ae08836c6 sympy/integrals/tests/test_integrals.py
--- a/sympy/integrals/tests/test_integrals.py Sat Nov 24 03:28:42 2007 +0100
+++ b/sympy/integrals/tests/test_integrals.py Sat Nov 24 04:42:09 2007 +0100
@@ -60,3 +60,7 @@ def test_multiple_integration():

def test_issue433():
assert integrate(exp(-x), (x,0,oo)) == 1
+
+def test_issue461():
+ assert integrate(x**Rational(3,2), x) == 2*x**Rational(5,2)/5
+ assert integrate(x**Rational(1,2), x) == 2*x**Rational(3,2)/3

Ondrej Certik

unread,
Nov 23, 2007, 10:47:00 PM11/23/07
to sympy-patches
On Nov 24, 4:43 am, Ondrej Certik <ond...@certik.cz> wrote:
> # HG changeset patch
> # User Ondrej Certik <ond...@certik.cz>
> # Date 1195875729 -3600
> # Node ID 288ae08836c6480dc1398246728cb2ef416da46c
> # Parent e664e537a4e96194e888a935ab5abf370d46567a
> integration patch
>

This fixes the issue http://code.google.com/p/sympy/issues/detail?id=461

But maybe a better fix can be found. Please review it.

Ondrej
Reply all
Reply to author
Forward
0 new messages