Comment #35 on issue 3128 by [email protected]: Sum and Product manipulations
http://code.google.com/p/sympy/issues/detail?id=3128

Improving on point two is probably not so easy.

For example if we had two Sums S1, S2, with overlaping summation ranges,
there are situations where one could rewrite the expression S1 + S2 as
S3 + S4 where S3 goes over the common part of the range and S4 is the
remainder.

For example:

E0 = Sum(i, (i, 0, k)) + Sum(i, (i, k, m))
E0.doit()
k + m**2/2 + m/2

E1 = Sum(i, (i, 0, k)) + Sum(i, (i, k+1, m)) + k
E1.doit()
k + m**2/2 + m/2

E2 = simplify(E1)
E2
k + Sum(i, (i, 0, m))

E2.doit()
k + m**2/2 + m/2

Simplify could be extended to be able to get from E0 to E2. This is especially important in case the remainder S4 (here S4=k) contains only a single or a few
element(s).

E0 = Sum(i, (i, 0, k)) + Sum(i, (i, 0, k+2))
E0.doit()
k**2 + 3*k + 3

simplify(E0)
Sum(i, (i, 0, k)) + Sum(i, (i, 0, k + 2))

E1 = Sum(i, (i, 0, k)) + Sum(i, (i, 0, k)) + (k+1) + (k+2)
E1.doit()
k**2 + 3*k + 3

E2 = simplify(E1)
E2
2*k + Sum(2*i, (i, 0, k)) + 3

E2.doit()
k**2 + 3*k + 3

This is another example where we would wish that simplify(E0) yields E2
without human interaction.

One would need a clever heuristic to determined when to do such transformations. In the first example, the intersection of both ranges was small while in the second the symmetric difference was. Probably one usually wants to do such transformations
when "one of both is small compared to the other".


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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-issues.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to