Hi, On 6 October 2011 12:04, Mateusz Paprocki <matt...@gmail.com> wrote:
> Hi, > > On 6 October 2011 11:57, Scott <scotta_2...@yahoo.com> wrote: > >> How do I coerce integrate(a/(a**2+b*a+b*c*x**2),x) to yield. >> This may be a double post. >> >> Sqrt[b] Sqrt[c] x >> Sqrt[a] ArcTan[-------------------] >> Sqrt[a] Sqrt[a + b] >> ----------------------------------- >> Sqrt[b] Sqrt[a + b] Sqrt[c] >> >> >> >> Rather than: >> var('x,a,b,c') >> integrate(a/(a**2+b*a+b*c*x**2),x) >> >> a*((-b*c/(4*a*b**3*c**2 + 4*a**2*b**2*c**2))**(1/2)*log(x + (-b*c/ >> (4*a*b**3*c**2 + 4*a**2*b**2*c**2))**(1/2)*(2*a*b + 2*a**2)) - (-b*c/ >> (4*a*b**3*c**2 + 4*a**2*b**2*c**2))**(1/2)*log(x - (-b*c/ >> (4*a*b**3*c**2 + 4*a**2*b**2*c**2))**(1/2)*(2*a*b + 2*a**2)) >> > > I would start from making x, a, b,c real, e.g.: > > In [4]: var('a:c,x', real=True) > Out[4]: (a, b, c, x) > > In [5]: integrate(a/(a**2+b*a+b*c*x**2),x) > > but this fails, see http://code.google.com/p/sympy/issues/detail?id=2718. > I fixed this issue (for now locally). The problem was with symbolic root counting algorithm. By making a, b, c positive, I was able to get the requested form of the integral: In [1]: var('a:c', positive=True) Out[1]: (a, b, c) In [2]: integrate(a/(a**2+b*a+b*c*x**2),x) Out[2]: ⎛ ⎛ ___ 3/2 ⎞ ⎞ ___ ⎜ x⋅⎝a⋅╲╱ b ⋅c + b ⋅c⎠ ⎟ ╲╱ a ⋅atan⎜──────────────────────────────────────────────⎟ ⎜ 3/2 ___ _______ ___ ___ _______⎟ ⎝a ⋅╲╱ c ⋅╲╱ a + b + ╲╱ a ⋅b⋅╲╱ c ⋅╲╱ a + b ⎠ ────────────────────────────────────────────────────────── ___ ___ _______ ╲╱ b ⋅╲╱ c ⋅╲╱ a + b In [3]: simplify(_) Out[3]: ⎛ ___ ___ ⎞ ___ ⎜ ╲╱ b ⋅╲╱ c ⋅x ⎟ ╲╱ a ⋅atan⎜───────────────⎟ ⎜ ___ _______⎟ ⎝╲╱ a ⋅╲╱ a + b ⎠ ─────────────────────────── ___ ___ _______ ╲╱ b ⋅╲╱ c ⋅╲╱ a + b > > >> >> Thanks >> >> Scott >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To post to this group, send email to sympy@googlegroups.com. >> To unsubscribe from this group, send email to >> sympy+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/sympy?hl=en. >> >> > Mateusz > Mateusz -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.