New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a test for complex integral from wikipedia #4231

Open
certik opened this Issue Oct 3, 2008 · 14 comments

Comments

Projects
None yet
8 participants
@certik
Copy link
Member

certik commented Oct 3, 2008

In [4]: d = (1+2_x+sqrt(x+log(x))_(1+3_x) +
x__2)/(x_(x+sqrt(x+log(x)))*sqrt(x+log(x)))

In [5]: d
Out[5]:
            ⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽              2
1 + 2⋅x + ╲╱ x + log(x) ⋅(1 + 3⋅x) + x
───────────────────────────────────────
   ⎛      ⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎞   ⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽
 x⋅⎝x + ╲╱ x + log(x) ⎠⋅╲╱ x + log(x)

In [6]: integrate(d, x)
Out[6]:
     ⎛      ⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎞       ⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽
2⋅log⎝x + ╲╱ x + log(x) ⎠ + 2⋅╲╱ x + log(x)

more info here: http://groups.google.com/group/sympy/browse_thread/thread/9a61d681e6f967e8

Original issue for #4231: http://code.google.com/p/sympy/issues/detail?id=1132

Original author: https://code.google.com/u/104039945248245758823/

@vks

This comment has been minimized.

Copy link
Contributor

vks commented Oct 3, 2008

BTW: integrate(d) <=> integrate(d, x) but diff(d) raises TypeError.

Original comment: http://code.google.com/p/sympy/issues/detail?id=1132#c1

Original author: https://code.google.com/u/Vinzent.Steinberg@gmail.com/

@certik

This comment has been minimized.

Copy link
Member

certik commented Oct 3, 2008

Please create a new issue for that.

Original comment: http://code.google.com/p/sympy/issues/detail?id=1132#c2

Original author: https://code.google.com/u/104039945248245758823/

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented Jan 7, 2011

Unfortunately, it takes a long time to compute.  

For comment 1, see issue 3626 .

**Labels:** Integration  

Referenced issues: #3626
Original comment: http://code.google.com/p/sympy/issues/detail?id=1132#c3
Original author: https://code.google.com/u/asmeurer@gmail.com/

@sherjilozair

This comment has been minimized.

Copy link
Contributor

sherjilozair commented Mar 17, 2011

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented Mar 17, 2011

Good question.  I think that we cannot add a test for it unless we can make the integral engine *much* faster.  So I'll mark this one as WontFix.

**Status:** WontFix  

Original comment: http://code.google.com/p/sympy/issues/detail?id=1132#c5
Original author: https://code.google.com/u/asmeurer@gmail.com/

@mattpap

This comment has been minimized.

Copy link
Member

mattpap commented Mar 17, 2011

How long does it take to compute? We have, so called, "slow tests" so this may be added there (it would be also nice to have bin/test --slow).

Original comment: http://code.google.com/p/sympy/issues/detail?id=1132#c6
Original author: https://code.google.com/u/101069955704897915480/

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented Mar 17, 2011

About a minute on my machine:

In [7]: %time integrate(d, x)
CPU times: user 53.84 s, sys: 0.47 s, total: 54.32 s
Wall time: 70.38 s
Out[8]: 
     ⎛      ⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎞       ⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽
2⋅log⎝x + ╲╱ x + log(x) ⎠ + 2⋅╲╱ x + log(x) 

Almost all the skipped tests are skipped because they are too slow, so maybe we should just skip these slow tests and let ./bin/test --slow unskip them.  We might need to add an option to skip() in case we want to skip a test for some other reason.

Original comment: http://code.google.com/p/sympy/issues/detail?id=1132#c7
Original author: https://code.google.com/u/asmeurer@gmail.com/

@mattpap

This comment has been minimized.

Copy link
Member

mattpap commented Mar 17, 2011

This is precisely what I had in mind.

Original comment: http://code.google.com/p/sympy/issues/detail?id=1132#c8
Original author: https://code.google.com/u/101069955704897915480/

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented Mar 17, 2011

I also created a mechanism to let a test run with a timeout time in my test_failing_integrals.py file in my integration3 branch (see https://github.com/asmeurer/sympy/blob/integration3/sympy/integrals/tests/test_failing_integrals.py ).  We could modify skip to use that and let you choose an alternate timeout time with the ./bin/test --skip flag.

Original comment: http://code.google.com/p/sympy/issues/detail?id=1132#c9
Original author: https://code.google.com/u/asmeurer@gmail.com/

@rlamy

This comment has been minimized.

Copy link
Member

rlamy commented Mar 18, 2011

With py.test, it's easy to apply marks on tests and to choose which ones to run based on that. So this is one more reason to ditch bin/test.

**Status:** Accepted  
**Labels:** -EasyToFix  

Original comment: http://code.google.com/p/sympy/issues/detail?id=1132#c10
Original author: https://code.google.com/u/101272611947379421629/

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented Mar 20, 2012

@certik certik added imported labels Mar 7, 2014

skirpichev added a commit to diofant/diofant that referenced this issue Feb 23, 2016

@oldk1331

This comment has been minimized.

Copy link

oldk1331 commented May 20, 2016

This integral computes much faster now (year 2016 and sympy 1.0):

In [14]: time(integrate(d,x))
CPU times: user 12.4 s, sys: 84.5 ms, total: 12.5 s
Wall time: 12.5 s
Out[14]: 
    ____________        ⎛      ____________⎞
2⋅╲╱ x + log(x)  + 2⋅log⎝x + ╲╱ x + log(x) ⎠

That's on my slow laptop, should only take few second on a good computer.

However, I don't think this should get into test suite, because this integrand is a mixed algebraic transcendental function, sympy can compute it not by Risch algorithm, but by heuristic algorithm (Bornstein's poor man integrator) , aka "luck". A simple transform makes sympy can't solve it:

In [15]: time(integrate(expand(d),x))
CPU times: user 24 s, sys: 82.5 ms, total: 24 s
Wall time: 24.1 s
Out[15]: 
⌠                                                      
⎮  2         ____________           ____________       
⎮ x  + 3⋅x⋅╲╱ x + log(x)  + 2⋅x + ╲╱ x + log(x)  + 1   
⎮ ────────────────────────────────────────────────── dx
⎮           ⎛    ____________             ⎞            
⎮         x⋅⎝x⋅╲╱ x + log(x)  + x + log(x)⎠            
⌡

So, I think this issue should be closed.

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented May 20, 2016

Well lots of the algorithms in SymPy (and computer algebra in general) are heuristic in nature, so if they compute anything, it's by "luck".

I'm actually curious what change made this so much faster.

@asmeurer

This comment has been minimized.

Copy link
Member

asmeurer commented May 20, 2016

It seems to always run relatively fast for me (the slowest I found was SymPy 0.7.0, where it takes 15 seconds). So maybe my computer was just really slow back then.

skirpichev added a commit to skirpichev/diofant that referenced this issue Nov 2, 2016

Add regression tests & mention closed issues
    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
    close sympy/sympy#9173 (test was added in 5a510ac)
    close sympy/sympy#9808 (fixed in 09e539b)
    close sympy/sympy#9341 (fixed in af98a00)
    close sympy/sympy#9908 (fixed in cc3fa8d)
    close sympy/sympy#6171 (test added in d278031)
    close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
    close sympy/sympy#10201 (fixed in 0d0fc5f)
    close sympy/sympy#9057 (test was added in 8290a0c)
    close sympy/sympy#11159 (test was added in ffb76cb)
    close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
    close sympy/sympy#11081 (see ed01e16 and bb92329)
    close sympy/sympy#10974 (see 73fc425)
    close sympy/sympy#10806 (test in 539929a)
    close sympy/sympy#10801 (test in 2fe3da5)
    close sympy/sympy#9549 (test in 88bdefa)
    close sympy/sympy#4231 (test was added in fb411d5)
    close sympy/sympy#8634 (see 2fcbb58)
    close sympy/sympy#8481 (see 1ef20d3)
    close sympy/sympy#9956 (fixed in a34735f)
    close sympy/sympy#9747 (see e117c60)
    close sympy/sympy#7853 (see 3e4fbed)
    close sympy/sympy#9634 (see 2be03f5)
    close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
    close sympy/sympy#9192 (see 9bf622f)
    close sympy/sympy#7130 (see e068fa3)
    close sympy/sympy#8514 (see b2d543b)
    close sympy/sympy#9334 (see 90de625)
    close sympy/sympy#8229 (see 9755b89)
    close sympy/sympy#8061 (see 7054f06)
    close sympy/sympy#7872 (tested in diofant#6)
    close sympy/sympy#3496 (tested in test_log_symbolic)
    close sympy/sympy#2929 (see da7db7a)
    close sympy/sympy#8203 (oo is not a real, see diofant#36)
    close sympy/sympy#7649 (0 is imaginary since diofant#8)
    close sympy/sympy#7256 (fixed in c0a4549)
    close sympy/sympy#6783 (see cb28d63)
    close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
    close sympy/sympy#5295 (fixed with diofant#354)
    close sympy/sympy#4856 (we now have flake/pep tests)
    close sympy/sympy#4555 (flake8 enabled after diofant#214)
    close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
    close sympy/sympy#5484 (see above)

    Added regression tests:
    from https://groups.google.com/forum/#!topic/sympy/LkTMQKC_BOw
    fixes sympy/sympy#8825 (probably via diofant#209)
    fixes sympy/sympy#8635
    fixes sympy/sympy#8157
    fixes sympy/sympy#7872
    fixes sympy/sympy#7599
    fixes sympy/sympy#6179
    fixes sympy/sympy#5415
    fixes sympy/sympy#2865
    fixes sympy/sympy#5907
    fixes sympy/sympy#11722

    Closes diofant#347

skirpichev added a commit to skirpichev/diofant that referenced this issue Nov 2, 2016

Add regression tests & mention closed issues
    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
    close sympy/sympy#9173 (test was added in 5a510ac)
    close sympy/sympy#9808 (fixed in 09e539b)
    close sympy/sympy#9341 (fixed in af98a00)
    close sympy/sympy#9908 (fixed in cc3fa8d)
    close sympy/sympy#6171 (test added in d278031)
    close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
    close sympy/sympy#10201 (fixed in 0d0fc5f)
    close sympy/sympy#9057 (test was added in 8290a0c)
    close sympy/sympy#11159 (test was added in ffb76cb)
    close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
    close sympy/sympy#11081 (see ed01e16 and bb92329)
    close sympy/sympy#10974 (see 73fc425)
    close sympy/sympy#10806 (test in 539929a)
    close sympy/sympy#10801 (test in 2fe3da5)
    close sympy/sympy#9549 (test in 88bdefa)
    close sympy/sympy#4231 (test was added in fb411d5)
    close sympy/sympy#8634 (see 2fcbb58)
    close sympy/sympy#8481 (see 1ef20d3)
    close sympy/sympy#9956 (fixed in a34735f)
    close sympy/sympy#9747 (see e117c60)
    close sympy/sympy#7853 (see 3e4fbed)
    close sympy/sympy#9634 (see 2be03f5)
    close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
    close sympy/sympy#9192 (see 9bf622f)
    close sympy/sympy#7130 (see e068fa3)
    close sympy/sympy#8514 (see b2d543b)
    close sympy/sympy#9334 (see 90de625)
    close sympy/sympy#8229 (see 9755b89)
    close sympy/sympy#8061 (see 7054f06)
    close sympy/sympy#7872 (tested in diofant#6)
    close sympy/sympy#3496 (tested in test_log_symbolic)
    close sympy/sympy#2929 (see da7db7a)
    close sympy/sympy#8203 (oo is not a real, see diofant#36)
    close sympy/sympy#7649 (0 is imaginary since diofant#8)
    close sympy/sympy#7256 (fixed in c0a4549)
    close sympy/sympy#6783 (see cb28d63)
    close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
    close sympy/sympy#5295 (fixed with diofant#354)
    close sympy/sympy#4856 (we now have flake/pep tests)
    close sympy/sympy#4555 (flake8 enabled after diofant#214)
    close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
    close sympy/sympy#5484 (see above)

    Added regression tests:
    from https://groups.google.com/forum/#!topic/sympy/LkTMQKC_BOw
    fixes sympy/sympy#8825 (probably via diofant#209)
    fixes sympy/sympy#8635
    fixes sympy/sympy#8157
    fixes sympy/sympy#7872
    fixes sympy/sympy#7599
    fixes sympy/sympy#6179
    fixes sympy/sympy#5415
    fixes sympy/sympy#2865
    fixes sympy/sympy#5907
    fixes sympy/sympy#11722

    Closes diofant#347
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment