Thanks! I tried both replace and xreplace (to learn more) and they both worked for me, so I chose replace, since it looks simpler.
On Thursday, October 8, 2020 at 9:33:57 PM UTC+2 [email protected] wrote: > subs() doesn't replace s because it is a bound variable. You can use > replace or xreplace to do it. > > >>> Sum(a*exp((2*s + 1)*I*t), (s, -oo, oo)).xreplace({s: j}) > Sum(a*exp(I*t*(2*j + 1)), (j, -oo, oo)) > > Aaron Meurer > > On Thu, Oct 8, 2020 at 1:30 PM Thomas Ligon <[email protected]> wrote: > > > > Here is a code snippet (for test purposes): > > > > from sympy import symbols, I, oo, Sum, exp > > a, s, t, j = symbols('a s t j') > > ex = Sum(a*exp((2*s + 1)*I*t), (s, -oo, oo)) > > print(ex) > > ex = ex.subs(s, j) > > print(ex) > > > > The subs statement has no effect. Is there another way to do this? > > > > -- > > 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 [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/57c9522d-7e3b-42be-88cb-1834a3d49efdn%40googlegroups.com > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/85dbfb2a-fdf1-405e-9e6b-3ea75dcf24fan%40googlegroups.com.
