Re: weird behavior of simplify

*To*: mathgroup at smc.vnet.net*Subject*: [mg21240] Re: [mg21186] weird behavior of simplify*From*: Andrzej Kozlowski <andrzej at tuins.ac.jp>*Date*: Mon, 20 Dec 1999 02:28:00 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

I am not sure if one should call it a bug (I feel I have used this word too often on this list anyway). As is often the case it depends on one's perspective. If Simplify did not give the answer you expect in any of these cases you wouldn't probably call it a bug! In fact I was surprised to see that Simplify works in some of them. The reason is that the mechanism of Assumptions in Simplify is based on a very general ability to solve algebraic equations and inequalities (Groebner basis and CylindricalAlgebraicDecomposition) and is then extended to other types of functions in a rather ad hoc way (I think that is true, anyway, although I may be oversimplifying things a bit). As far as I know there is no more general approach. So, however much one improves Simplify it will be probably always possible to manufacture examples where it will fail. Of course, given any such example one can then modify Simplify to deal with it, so perhaps in the future it will not be so easy to come up with one as simple as these. For example, to deal with the ones you give one could do something like this: Unprotect[Simplify]; Simplify[b_. + a_.*E^(x_ + y_), Element[n_, Integers]] := Simplify[b, Element[n, Integers]] + Simplify[a, Element[n, Integers]]*Simplify[E^x, Element[n, Integers]]* Simplify[E^y, Element[n, Integers]]; Protect[Simplify]; By using Simplify and ExpandAll one can than get the answer you want in all your cases: In[7]:= Simplify[ExpandAll[E^((2*I*(1 - n^2 + 4*n)*2*Pi)/n)], Element[n , Integers]] Out[7]= (4 I Pi)/n E In[8]:= Simplify[ExpandAll[E^((2*I*(1 - n^2 + 4*n)*2*Pi)/n) + x], Element[n , Integers]] Out[8]= (4 I Pi)/n E + x In[9]:= Simplify[ExpandAll[ E^((2*I*(1 - n^2 + 4*n)*2*Pi)/n) + 3/E^((4*I*(3 + n^2)*2*Pi)/n)], Element[n , Integers]] Out[9]= (4 I Pi)/n 3 E + ------------ (24 I Pi)/n E One could actually incorporate ExpandAll into Simplify for such cases. But as I wrote above, one can always easily manufacture a somewhat different simple example for which this won't work, e.g. In[11]:= Simplify[2^(E^((24*I*Pi)/n + 8*I*n*Pi)),Element[n,Integers]] Out[11]= 2 (8 I (3 + n ) Pi)/n E 2 This is a limitation of trying to extend Simplify by using pattern matching rather than general mathematical algorithms; there will always be fairly simple patterns that do not match any rules. Having said all this, I still would like to to know why exactly the example below which has x as a summand works but one without it does not. It looks to me that some pattern is not being matched. Perhaps Adam Strzebonski will enlighten us? > From: b320 <b320 at fyma.ucl.ac.be> To: mathgroup at smc.vnet.net > Organization: FYMA > Date: Fri, 17 Dec 1999 01:23:44 -0500 (EST) > To: mathgroup at smc.vnet.net > Subject: [mg21240] [mg21186] weird behavior of simplify > > I tried the following simplification: > > Simplify[E^((2*I*(1 - n^2 + 4*n)*2*Pi)/n), {n OE Integers}] > > and nothing happened > > E^(-((4*I*(-1 - 4*n + n^2)*Pi)/n)) > > But this time it worked out the way it should > > Simplify[E^((2*I*(1 - n^2 + 4*n)*2*Pi)/n) + x, {n OE Integers}] > > E^((4*I*Pi)/n) + x > > But again > > Simplify[E^((2*I*(1 - n^2 + 4*n)*2*Pi)/n) + 3/E^((4*I*(3 + > n^2)*2*Pi)/n), {n OE Integers}] > > Does not simplify the way I would expect: > > E^((4*I*Pi)/n) + 3/E^((8*I*(3 + n^2)*Pi)/n) > > So is this a bug or is there a more subtel explanation ? > > Thank you for comments >

**Re: newtons method, notation**

**Re: Help tracking down a Bug**

**weird behavior of simplify**

**serie of random number**