Re: Simplification with subscripted variables and anonymous functions

*To*: mathgroup at smc.vnet.net*Subject*: [mg81620] Re: [mg81580] Simplification with subscripted variables and anonymous functions*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Sat, 29 Sep 2007 02:33:43 -0400 (EDT)*References*: <200709280612.CAA27109@smc.vnet.net>

On 28 Sep 2007, at 15:12, Rick Warfield wrote: > Hi, > > This is probably a very basic question but I wasn't able to find an > answer in the archives. I am trying to use Mathematica to combine and > simplify some sums, for example: > > FullSimplify[ (Sum[Subscript[r, j], {j, 1, n}] - Sum[Subscript[r, k], > {k, 1, d}])^2, Element[d | n, Integers] && d < n ] > > Is equivalent to > > Sum[Subscript[r, m], {m, k+1, d}] > > But Mathematica doesn't make the simplification. This has nothing to do with subscripts. FullSimplify does not use any rules for simplifying symbolic sums (unless they can be explicitly evaluated) so there is nothing to be done but to write such rules oneself. I think it would be an excellent exercise to do so; I am pretty sure you would soon understand why there are no such rules. > > A related problem I have is with expressions that use a variable as an > anonymous function, such as g in the following expression: > > FullSimplify[g[p]*g[q], ForAll[{p, q}, g[p]*g[q] == 0]] This is not really related. You just can't use ForAll in Assumptions. Of course: FullSimplify[g[p]*g[q], g[p]*g[q] == 0] 0 If you want something that looks like "logic" you might use: Resolve[Implies[ ForAll[{p, q}, Element[p | q, Complexes], p*q == 0] && Element[a | b, Complexes], a*b == 0]] True However, it won't work with g[p]*g[q] because quantifier elimination works only for algebraic expressions. Andrzej Kozlowski > > Should simplify to 0, but does not (of course I could also have > written this with subscripts, but that also doesn't work) > > Thanks for your help! > >

**References**:**Simplification with subscripted variables and anonymous functions***From:*Rick Warfield <walrus2049@gmail.com>