On Fri, Aug 9, 2013 at 12:03 PM, Manoj Kumar <manojkumarsivaraj...@gmail.com> wrote: > Hi, I came across this while working on the lie group methods, Is this a bug > or am I missing something quite obvious? > > r, x = Symbols("r x") > eq = Integral(1/sqrt(a0 + a1*x + a2*x**2 + a3*x**3 + a4*x**4), x) > eq = eq.subs(x, r) > print(eq.doit()) > x/sqrt(a0 + a1*r + a2*r**2 + a3*r**3 + a4*r**4) > > > This is because subs does not substitute for the variable with respect to > which I am integrating. I would want eq = Integral(1/sqrt(a0 + a1*r + > a2*r**2 + a3*r**3 + a4*r**4), r) rather than eq = Integral(1/sqrt(a0 + a1*r > + a2*r**2 + a3*r**3 + a4*r**4), x) . > > Is there a possible workaround?
Integral.transform() is what you want. Here is how to use it: In [10]: var("a0:5") Out[10]: (a₀, a₁, a₂, a₃, a₄) In [11]: eq = Integral(1/sqrt(a0 + a1*x + a2*x**2 + a3*x**3 + a4*x**4), x) In [12]: eq Out[12]: ⌠ ⎮ 1 ⎮ ────────────────────────────────────── dx ⎮ ___________________________________ ⎮ ╱ 2 3 4 ⎮ ╲╱ a₀ + a₁⋅x + a₂⋅x + a₃⋅x + a₄⋅x ⌡ In [13]: eq.transform(x, r) Out[13]: ⌠ ⎮ 1 ⎮ ────────────────────────────────────── dr ⎮ ___________________________________ ⎮ ╱ 2 3 4 ⎮ ╲╱ a₀ + a₁⋅r + a₂⋅r + a₃⋅r + a₄⋅r ⌡ Ondrej > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.