Re: question 1
- To: mathgroup at smc.vnet.net
- Subject: [mg75870] Re: [mg75810] question 1
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sat, 12 May 2007 03:09:41 -0400 (EDT)
- References: <200705110924.FAA05900@smc.vnet.net>
On 11 May 2007, at 18:24, dimitris wrote: > I have > > In[5]:= > f = (o - 8)^4 - (e + 4)^8 > > Out[5]= > -(4 + e)^8 + (-8 + o)^4 > > In[6]:= > ff = Expand[f] > > Out[6]= > -61440 - 131072*e - 114688*e^2 - 57344*e^3 - 17920*e^4 - 3584*e^5 - > 448*e^6 - 32*e^7 - e^8 - 2048*o + 384*o^2 - 32*o^3 + o^4 > > Is it possible to simplify ff to f again? > > Thanks! > > I don't think Mathematica can do it automatically, because the most obvious way of carrying out this simplification relies on transformations of the kind that that Simplify or FullSimplify never use (such as adding and simultaneously subtracting some number, then rearranging the whole expression and factoring parts of it). These kind of transformations could be implemented but they would work in only a few cases, and would considerably increase the time complexity of simplifying. Here is an example of another transformation that will work in this and some similar cases: transf[f_, {e_, o_}] := With[{a = Integrate[D[f, e], e], b = Integrate[D[f, o], o]}, Simplify[a] + Simplify[b] + Simplify[(f - (a + b))]] (one can easily implment a version with more than two variables). This works in your case: ff = Expand[(o - 8)^4 - (e + 4)^8]; transf[ff, {e, o}] (o - 8)^4 - (e + 4)^8 and in quite many cases like yours : gg = Expand[(a + 3)^5 + (x - 7)^6]; transf[gg, {a, x}] (x - 7)^6 + (a + 3)^5 but not in all hh = Expand[(x - 5)^4 + (y - 3)^3]; transf[hh, {x, y}] (x - 5)^4 + y*((y - 9)*y + 27) - 27 Even this, however, is better than the answer FullSimplify gives: FullSimplify[hh] (x - 10)*x*((x - 10)*x + 50) + y*((y - 9)*y + 27) + 598 Unfortunately transf also has very high complexity (it uses Integrate) and is unlikely to be useful in cases other than sums of polynomials in different variables (without "cross terms") so I doubt that it would be worth implementing some version of it in FullSimplify. Andrzej Kozlowski
- References:
- question 1
- From: dimitris <dimmechan@yahoo.com>
- question 1