Hi Raoul, On Tue, Sep 4, 2012 at 4:36 AM, someone <[email protected]> wrote: > Hi, > >> > Is this a supported way of constructing symbolic integrals? > > You could use the "Integral" command to construct > the noun form explicitely, avoiding computation of > the integral with symbolic parameter l. > > -------------------------------------------------------------- > from sympy import * > > var("l R alpha t") > > f = (2*l+1) / (2*t) * Integral(legendre(l, (1-R**2+t**2) / (2*t)) * > exp(-alpha*R), (R, 1-t, 1+t)) > > for _l in range(5): > #print r"\begin{equation}" > #print r"s_%d =" % _l > expr = f.subs(l, _l).doit().simplify() / exp(-alpha) > expr = expr.series(alpha, 0, 4) > pprint(expr) > #print latex(expr) > #print r"\end{equation}" > -------------------------------------------------------------- > > which then prints out the following series approximations: > > -------------------------------------------------------------- > 2 2 > α ⋅t ⎛ 4⎞ > 1 + ───── + O⎝α ⎠ > 6 > 2 3 3 3 > α ⋅t α ⋅t ⎛ 4⎞ > t + α⋅t + ───── + ───── + O⎝α ⎠ > 10 10 > ⎛ 4 2⎞ 3 4 > 2 2 2 ⎜t t ⎟ α ⋅t ⎛ 4⎞ > t + α⋅t + α ⋅⎜── + ──⎟ + ───── + O⎝α ⎠ > ⎝14 3 ⎠ 14 > ⎛ 5 3⎞ ⎛ 5 3⎞ > 3 3 2 ⎜t 2⋅t ⎟ 3 ⎜t t ⎟ ⎛ 4⎞ > t + α⋅t + α ⋅⎜── + ────⎟ + α ⋅⎜── + ──⎟ + O⎝α ⎠ > ⎝18 5 ⎠ ⎝18 15⎠ > ⎛ 6 4⎞ ⎛ 6 4⎞ > 4 4 2 ⎜t 3⋅t ⎟ 3 ⎜t 2⋅t ⎟ ⎛ 4⎞ > t + α⋅t + α ⋅⎜── + ────⎟ + α ⋅⎜── + ────⎟ + O⎝α ⎠ > ⎝22 7 ⎠ ⎝22 21 ⎠ > -------------------------------------------------------------- > > I hope this helps.
Ah, yes, that's the right solution! Thanks for this. Yes, the integral does not have a closed form in terms of some other special functions, as far as I know. Also, many thanks for all the improvements that you have made to the symbolic special functions in SymPy. This is extremely valuable. My code above was broken in a sense that it was calling integrate, but it should have been calling Integral to not require sympy to try to evaluate it symbolically. Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
