Comment #1 on issue 2448 by asmeurer: integrate hangs
http://code.google.com/p/sympy/issues/detail?id=2448

It doesn't hang for me. This is what I get. By the way, the problem is not the extra symbols, but that the first integral is cos(x)**2 and the second one is cos(x**2)**2 (due to the z in w).

In [1]: var('L r0 R0 z')
Out[1]: (L, r₀, R₀, z)

In [2]: Iz = (z, -L/2, L/2)

In [3]: integrate(r0**2*cos(z)**2, Iz)
Out[3]:
      ⎛         ⎛L⎞    ⎛L⎞⎞       ⎛       ⎛L⎞    ⎛L⎞⎞
      ⎜      sin⎜─⎟⋅cos⎜─⎟⎟       ⎜    sin⎜─⎟⋅cos⎜─⎟⎟
    2 ⎜  L      ⎝2⎠    ⎝2⎠⎟     2 ⎜L      ⎝2⎠    ⎝2⎠⎟
- r₀ ⋅⎜- ─ - ─────────────⎟ + r₀ ⋅⎜─ + ─────────────⎟
      ⎝  4         2      ⎠       ⎝4         2      ⎠

In [4]: w = 2*pi*z/L

In [5]: integrate(r0**2*cos(R0*z)**2, Iz)
Out[5]:
      ⎛            ⎛L⋅R₀⎞    ⎛L⋅R₀⎞⎞       ⎛          ⎛L⋅R₀⎞    ⎛L⋅R₀⎞⎞
      ⎜         sin⎜────⎟⋅cos⎜────⎟⎟       ⎜       sin⎜────⎟⋅cos⎜────⎟⎟
    2 ⎜  L⋅R₀      ⎝ 2  ⎠    ⎝ 2  ⎠⎟     2 ⎜L⋅R₀      ⎝ 2  ⎠    ⎝ 2  ⎠⎟
  r₀ ⋅⎜- ──── - ───────────────────⎟   r₀ ⋅⎜──── + ───────────────────⎟
      ⎝   4              2         ⎠       ⎝ 4              2         ⎠
- ────────────────────────────────── + ────────────────────────────────
                  R₀                                  R₀

In [6]: integrate(r0**2*cos(w*z)**2, Iz) # hangs
Out[6]:
L
─
2
⌠
⎮         2
⎮          ⎛     2⎞
⎮    2     ⎜2⋅π⋅z ⎟
⎮  r₀ ⋅cos ⎜──────⎟ dz
⎮          ⎝  L   ⎠
⌡
-L
──
2

In [7]: %timeit integrate(r0**2*cos(w*z)**2, Iz) # hangs
1 loops, best of 3: 11.3 s per loop


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to