Integral.transform changes #1246

Merged
merged 6 commits into from Apr 19, 2012

Projects

None yet

3 participants

@smichr
Member
smichr commented Apr 17, 2012

There is no inverse option any more: you either pass something like transform(x**2 - 1, u) and undo the transform with transform(u, x**2-1) -- the integration variable being changed will always be listed first. u (or f(u)) can be written in terms of x if you don't want a new variable -- a temporary u is used internally to make this work.

This should feel a lot more natural in terms of thought process (IMHO). If you have any transforms that you think should work that don't work here, please make a note.

This is an alternative to #1232 .

arpit goyal and others added some commits Apr 12, 2012
@smichr arpit goyal 2846:integral.transform now allow change to a different variable 01e69c0
@smichr smichr allow more transformations in Integral.transform 927fd4f
@smichr smichr rework error conditions
>>> I=Integral
>>> i=I(x*(x**2+5)**75)
>>> i.transform(x**2+5,u)
Integral(u**75/2, u)
>>> i=I(sqrt(x)/(1+root(x,3)),(x,0,64))
>>> i.transform(x,u**6)
Integral(6*u**5*sqrt(u**6)/((u**6)**(1/3) + 1), (u, 0, 2))
>>> I(sqrt(x)/(1+root(x,4)**3)).transform(x,u**8)
Integral(8*u**7*sqrt(u**8)/((u**8)**(3/4) + 1), u)
>>> I(x*sqrt(x+1)).transform(sqrt(x+1),u)
Integral(2*u*(u**2 - 1)*sqrt(u**2), u)
>>> I(x*exp(asin(x))).transform(exp(asin(x)),u)
Integral(exp(asin(sin(log(u))))*sin(log(u))*cos(log(u))/u, u)
>>> I(x*exp(asin(x))).transform((asin(x)),u)
Integral(exp(asin(sin(u)))*sin(u)*cos(u), u)
>>> var('u',positive=True)
u
>>> I(x*exp(asin(x))).transform((asin(x)),u)
Integral(exp(asin(sin(u)))*sin(u)*cos(u), u)
996496f
@smichr smichr allow identical limits; allow multivariable f(u)
If f(u) contains more than one variable, u must be (f(u), u)
where u identifies the free variable in f(u) that should replace
x in the integral.
935df6d
@Krastanov
Member

SymPy Bot Summary: ✳️ All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYl7wTDA

Interpreter: /usr/bin/python2.6 (2.6.7-final-0)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: 69a81b9
branch hash: 935df6d

Automatic review by SymPy Bot.

@Krastanov
Member

SymPy Bot Summary: 🔴 There were test failures.

@smichr: Please fix the test failures.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sY9pwTDA

Interpreter: /usr/bin/python2.6 (2.6.7-final-0)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: dcb2475
branch hash: 3e29e8dbea4c6e015e132542d8f05b4747f92ee7

Automatic review by SymPy Bot.

@smichr
Member
smichr commented Apr 18, 2012

filldedent error has been corrected ✳️

@asmeurer asmeurer and 1 other commented on an outdated diff Apr 18, 2012
sympy/utilities/exceptions.py
@@ -92,3 +99,12 @@ def __init__(self, value=None, feature=None, last_supported_version=None,
def __str__(self):
return "SymPyDeprecationWarning(\"%s\")" % self.fullMessage
+
+ @property
@asmeurer
asmeurer Apr 18, 2012 Member

As noted on the mailing list, this should not be a property.

@smichr
smichr Apr 19, 2012 Member

It's now a method and all uses of it have been modified accordingly.

@asmeurer asmeurer and 1 other commented on an outdated diff Apr 18, 2012
sympy/utilities/exceptions.py
@@ -92,3 +99,12 @@ def __init__(self, value=None, feature=None, last_supported_version=None,
def __str__(self):
return "SymPyDeprecationWarning(\"%s\")" % self.fullMessage
+
+ @property
+ def warn(self):
+ from sympy.utilities.misc import filldedent
+ from warnings import warn as warning
+ msg = self.fullMessage
+ see_above = '\n%s\n' % filldedent(msg)
+ # the next line is what the user will see after the error is printed
+ warning (see_above)
@asmeurer
asmeurer Apr 18, 2012 Member

This needs to be changed to use SymPyDeprecationWarning. By default, it uses UserWarning.

@smichr
smichr Apr 19, 2012 Member

On Thu, Apr 19, 2012 at 1:05 AM, Aaron Meurer
reply@reply.github.com
wrote:

@@ -92,3 +99,12 @@ def init(self, value=None, feature=None, last_supported_version=None,

     def str(self):
         return "SymPyDeprecationWarning("%s")" % self.fullMessage
+

  •    @property
  •    def warn(self):
  •        from sympy.utilities.misc import filldedent
  •        from warnings import warn as warning
  •        msg = self.fullMessage
  •        see_above = '\n%s\n' % filldedent(msg)
  •        # the next line is what the user will see after the error is printed
  •        warning (see_above)

This needs to be changed to use SymPyDeprecationWarning.  By default, it uses UserWarning.

I changed that.

@Krastanov
Member

SymPy Bot Summary: ✳️ All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYxfoTDA

Interpreter: /usr/bin/python2.6 (2.6.7-final-0)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: dcb2475
branch hash: ec70ad3a22d5670f2b6eeada0ab49e866d44edf8

Automatic review by SymPy Bot.

@Krastanov
Member

SymPy Bot Summary: ✳️ All tests have passed.

Test results html report: http://reviews.sympy.org/report/agZzeW1weTNyDAsSBFRhc2sYzaEUDA

Interpreter: /usr/bin/python2.6 (2.6.7-final-0)
Architecture: Linux (64-bit)
Cache: yes
Test command: setup.py test
master hash: dcb2475
branch hash: 1a7cb8a692453768c553c1695409a6dea21a1c3b

Automatic review by SymPy Bot.

@smichr smichr merged commit 18afbcc into sympy:master Apr 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment