Status: Accepted
Owner: asmeurer
CC: smi...@gmail.com
Labels: Type-Defect Priority-High Integration
New issue 2571 by asmeurer: Regression in Integral.subs
http://code.google.com/p/sympy/issues/detail?id=2571
This used to work:
In [1]: Integral((exp(x*log(x))*log(x)), x).subs(exp(x*log(x)), x**x)
Out[1]:
⌠
⎮ x
⎮ x ⋅log(x) dx
⌡
But now it doesn't:
In [1]: Integral((exp(x*log(x))*log(x)), x).subs(exp(x*log(x)), x**x)
Out[1]:
⌠
⎮ x⋅log(x)
⎮ ℯ ⋅log(x) dx
⌡
I bisected it to this commit:
commit 870e7ccaf8658c36565652ed6583c99f5cc4065d
Author: Chris Smith <smi...@gmail.com>
Date: Tue Jul 20 17:06:00 2010 +0545
1992: dummy variable usage in Integral clarified
Dummy variables of integration can sometimes cause confusion
with the limits of integration so that it is recommended against
writing things like
u(t) = Integral(g(t), (t, a, t))
But if one simply thinks of the definite integral as a two-step
operator perhaps some confusion can be dispelled:
1) the integration
2) the substitution
In (1) the integrand is integrated treating only the variable
matching the variable of integration, the 1st variable in the
tuple, to obtain G(t) which is computed without reference to the
limits.
In (2) the final result is obtained by doing the following:
u(t) = G(t).subs(t, upper_limit) - G(t).subs(t, lower_limit)
So from the first example, upper_limit is t and lower_limit = a
If the upper limit is missing then we have simply
u(t) = G(t).subs(t, upper_limit)
NOW, with that behavior in mind, a request to substitute some variable
with another has to follow some rule with regard to where that
substitution
can take place. The current behavior allows such replacements to happen
anywhere unless the substitution target is a dummy variable, in which
case
no changes are allowed. This commit relaxes that constraint so that the
substitution can take place in the limits of integration since those
quantities
don't affect the expression that is obtained after step 1 above. So for
the
integral, i = Integral(x+y+z, (x, x, y), (y, a, z))
- any z could be changed
- x and y can only be changed in the first tuple's upper and lower
limit because everywhere else x and y are conceptually the dummy
variables of integration, e.g. i.subs({x:1, y:2, z:3, a:4}) would be
Integral(x+y+3, (x, 1, 2), (y, 4, 3))
A further source of ambiguity that cannot be resolved without hints or
new types of variables is the request to substitute z with x + 2 in the
preceding example since x is acting conceptually as both integration
variable and normal variable and the substitution can change the z in
the
limit but not the z in the integrand since this would introduce two
x values with conceptually different meanings: the variable of
integration x
and the symbol x which the integral wishes to have in the final answer
(given
by the first limit's lower limit).
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.