Comment #2 on issue 4031 by [email protected]: Definite integral returns
an answer with indefinite integrals
http://code.google.com/p/sympy/issues/detail?id=4031
I think this has something to do with substitution in integrals. In
https://github.com/sympy/sympy/pull/2198, the answer is
In [1]: var("i L a b")
Out[1]: (i, L, a, b)
In [2]: integrand = cos(pi*i*x/L)**2/(a + b*x)
In [3]: integrand = integrand.rewrite(exp)
In [4]: integrate(integrand, (x, 0, L))
Out[4]:
0 L
⌠ ⌠
⎮ -2⋅ⅈ⋅π⋅i⋅x -4⋅ⅈ⋅π⋅i⋅x ⎮ -2⋅ⅈ⋅π⋅i⋅x
-4⋅ⅈ⋅π⋅i⋅x
⎮ ─────────── ─────────── ⎮ ───────────
───────────
⎮ L L ⎮
L L
⎮ 1 + 2⋅ℯ + ℯ ⎮ 1 + 2⋅ℯ + ℯ
- ⎮ ───────────────────────────────────── dx + ⎮
───────────────────────────────────── dx
⎮ -2⋅ⅈ⋅π⋅i⋅x -2⋅ⅈ⋅π⋅i⋅x ⎮ -2⋅ⅈ⋅π⋅i⋅x
-2⋅ⅈ⋅π⋅i⋅x
⎮ ─────────── ─────────── ⎮ ───────────
───────────
⎮ L L ⎮
L L
⎮ 4⋅a⋅ℯ + 4⋅b⋅x⋅ℯ ⎮ 4⋅a⋅ℯ + 4⋅b⋅x⋅ℯ
⌡ ⌡
In [5]: integrate(integrand, (x, 0, L)).doit()
Out[5]:
0 L
⌠ ⌠
⎮ -2⋅ⅈ⋅π⋅i⋅x -4⋅ⅈ⋅π⋅i⋅x ⎮ -2⋅ⅈ⋅π⋅i⋅x
-4⋅ⅈ⋅π⋅i⋅x
⎮ ─────────── ─────────── ⎮ ───────────
───────────
⎮ L L ⎮
L L
⎮ 1 + 2⋅ℯ + ℯ ⎮ 1 + 2⋅ℯ + ℯ
- ⎮ ───────────────────────────────────── dx + ⎮
───────────────────────────────────── dx
⎮ -2⋅ⅈ⋅π⋅i⋅x -2⋅ⅈ⋅π⋅i⋅x ⎮ -2⋅ⅈ⋅π⋅i⋅x
-2⋅ⅈ⋅π⋅i⋅x
⎮ ─────────── ─────────── ⎮ ───────────
───────────
⎮ L L ⎮
L L
⎮ 4⋅a⋅ℯ + 4⋅b⋅x⋅ℯ ⎮ 4⋅a⋅ℯ + 4⋅b⋅x⋅ℯ
⌡ ⌡
which is no longer incorect (though not helpful; it should just return the
original integral unchanged).
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.