On Fri, Feb 22, 2013 at 12:24 AM, Matthew Rocklin <[email protected]> wrote:
> Ah, yes, that is helpful.
>
> In general I'm looking for an automated solution for problems like this.
> I'd like to solve this problem without being smart :)
>

maybe as

```
>>> e = (-L**2+6*L+4*f(i))/4/L
>>> co, t = e.expand().as_independent(i, as_Add=True)
>>> p, ei = factor_terms(t).as_independent(i, as_Add=False)
>>> n*co+p*Sum(ei,(i,1,n))
n*(-L/4 + 3/2) + Sum(f(i), (i, 1, n))/L
```

If the expression is a Mul then we have separatevars that will try
separate out the i-term(s); we don't have a general method for trying
hard to make something an Add with terms separated out. Aaron and I
discussed this a bit and I proposed a routine for doing mv separation
at http://code.google.com/p/sympy/issues/detail?id=2032#c11. So
perhaps you could use the apart part first, followed by a separatevars
on the t-term if it was a Mul.

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to