But the point is that diff will take derivatives with respect to functions just fine (or at least it's supposed to, that bug notwithstanding). And then the sum will never evaluate, because it can't be evaluated.
Aaron Meurer On Tue, Jun 4, 2013 at 10:32 PM, Jeremy <lafl...@gmail.com> wrote: > Thanks! and yes z_i and q_i would depend on i, but for the purposes of the > derivation they can just be symbols. > > > On Tuesday, June 4, 2013 11:23:49 PM UTC-4, Aaron Meurer wrote: >> >> I'd consider this to be a bug. I'm sure a call to doit() was added in >> there to make Integral(x, x).diff(x) return just x, but it's clearly >> annoying. >> >> I'm assuming you mean for q_i and z_i to mean that these things depend >> on i. One way would be to actually use a function. Unfortunately, >> there seem to be another bug: >> >> In [5]: z_i = Function('z')(i) >> >> In [6]: q_i = Function('q')(i) >> >> In [7]: a_k = Sum(-q_i*z_i/k,(i,1,m)) >> >> In [8]: print a_k.diff(z_i) >> 0 >> >> I opened https://code.google.com/p/sympy/issues/detail?id=3867 and >> https://code.google.com/p/sympy/issues/detail?id=3868 for these. >> >> Aaron Meurer >> >> On Tue, Jun 4, 2013 at 10:11 PM, Jeremy <laf...@gmail.com> wrote: >> > Hello, >> > >> > I am a new sympy user and am trying to work out a derivation using >> > IPython3 >> > in a notebook. >> > >> > >> > I have an expression: >> > a_k = Sum(-q_i*z_i/k,(i,1,m)). >> > >> > I want a_k.diff(z_i), however the Sum gets evaluated and I get >> > m*(otherwise >> > correct stuff), and of course the sum goes away. >> > >> > I thought that using Sum() instead of summation(), the expression would >> > not >> > evaluate. I guess .diff() causes the expression to evaluate? Is there a >> > way >> > around this problem? >> > >> > If it was this one expression I would just make temp = stuff_inside_sum >> > and >> > .diff() that, but it is nested in yet another Sum(). Eg. phi = >> > Sum(a_k/x,(k,1,oo)). >> > >> > Any help would be appreciated, >> > Thanks! >> > >> > >> > -- >> > 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+un...@googlegroups.com. >> > To post to this group, send email to sy...@googlegroups.com. >> > Visit this group at http://groups.google.com/group/sympy?hl=en-US. >> > 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?hl=en-US. > 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?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.