Re: RE: FullSimplify and HypergeometricPFQ

*To*: mathgroup at smc.vnet.net*Subject*: [mg72086] Re: [mg72050] RE: [mg72035] FullSimplify and HypergeometricPFQ*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Mon, 11 Dec 2006 04:55:16 -0500 (EST)*References*: <NDBBJGNHKLMPLILOIPPOKEKOFEAA.djmp@earthlink.net>

On 11 Dec 2006, at 03:29, David Park wrote: > Hello Andrzej, > > I wonder if the description Simplify and FullSimplify is such that > a user > could relatively easily control what he is going to get on the > simplification? Or whether it would be worthwhile mastering the > description? Well, it depends. First, what do you exactly mean by "control"? As I wrote, Simplify is not meant just to transform one expression into another. A typical situation in which it is genuinely useful is this. You get a huge unmanageable expression as a result of some Mathematica computation, or even as a result of computation you have done by hand. The expression is too complex to understand and even numerical computations performed with it are slow and perhaps numerically unstable (complicated expressions are often ill conditioned as well). So you would like to change it into something simpler, hopefully more understandable and more manageable numerically. In such a situation Simplify can save you a huge amount of labour. Since you do not know what exactly you want it to give you there is no point of speaking of "controlling" it in this sense. But you might want to know what kind of expressions you wish to avoid, because of numerical instability etc. Skilled choice of TransformationFunctions and of ComplexityFunction can help you with that. Of course it is only partly mathematics and partly experimental science; you can rarely be sure of the specific output you get. But it is quite likely that the result will be at least better then the one you started with and easier to handle, if not by you, than by your computer. Which is why I think it is worth knowing what these functions do. However, one must not forget that essentially Simplify and FullSimplify just apply various compositions of Mathematica functions, enormously faster than you could do yourself by hand by much less intelligently. So to really understand what they do you have to understand the transformation functions themselves; particularly PolynomialReduce for polynomial expressions and FunctionalExpand for special functions etc. > > I also question if Simplify or FullSimplify will reliably tell if two > symbolic expressions are equal. And, in fact, if that was the > principal > purpose why are there two commands that sometimes give different > results? I would say that most serious problems in computational mathematics can be reduced to deciding if two expressions are equal or equivalently to deciding if an expression is 0 or not. For symbolic expressions FullSimplify and Simplify are the only functions that will do this. So, since in my opinion, deciding if an expression is 0 or not is the most important task in computational mathematics, it is not surprising that, also in my opinion, it is the most important task of FullSimplify or Simplify. I am not sure what you mean "they give different results"? Of course FullSimplify[expr] and Simplify[expr] will often give different results, in fact Simplify with two different choices for the ComplexityFunction option will usually give two different results. But that is because showing if something is 0 or not is not their only task, as I explained above. But if you pose the question in the form FullSimplify[expr]==0 or Simplify[exp]==0 then they will either both return True, both return False or one or both return your input unevaluated. > > Here are two expressions that I believe are equal over the given > domain. > > Plot[Evaluate[{ArcTan[((1 + e)*Tan[\[Phi]/2])/ > Sqrt[1 - e^2]], \[Phi]/2 + > ArcTan[(e*Sin[\[Phi]])/(1 + Sqrt[1 - e^2] - > e*Cos[\[Phi]])]} /. e -> 0.8], > {\[Phi], -Pi, Pi}, PlotStyle -> > {{AbsoluteThickness[5], Gray}, Red}, > Frame -> True]; > > Yet FullSimplify can't tell that they are equal. > > ArcTan[((1 + e)*Tan[\[Phi]/2])/Sqrt[1 - e^2]] == > \[Phi]/2 + ArcTan[(e*Sin[\[Phi]])/(1 + Sqrt[1 - e^2] - > e*Cos[\[Phi]])] > FullSimplify[%, 0 < e < 1 && -Pi < \[Phi] < Pi] > > So perhaps your statement applies only to a restricted class of > expressions? Of course it is restricted. I think it is very important for users of symbolic algebra programs to realize how limited is the number of things that can be done algorithmically. Basically, only for purely algebraic expressions rational functions) there are complete algorithms that make it possible to settle all such questions on a computer, subject, of course, to computational complexity of the algorithms used. Expressions involving semi-algebraic functions (polynomials with radicals) already suffer from branching problems, which make them often impossible do deal with in practice. Once you have transcendental functions including special functions all bets are off; FunctionExpand knows a few identities and in lucky cases one of them can be applied; but you can't expect this to happen very often. Still, even in such cases FullSimplify can be very useful. Yours is a good example. Rather than use Plot, which is very unreliable for such purposes and requires you to choose a particular value for e I would try: a = Normal[Ï?/2 + ArcTan[(e*Sin[Ï?])/((-e)*Cos[Ï?] + Sqrt[1 - e^2] + 1)] + O[Ï?]^10]; b = Normal[ArcTan[((e + 1)*Tan[Ï?/2])/Sqrt[1 - e^2]] + O[Ï?]^10]; FullSimplify[a-b,0<e<1&&-Pi<Ï?<Pi] 0 That looks to me like much more convincing evidence that the expressions are in fact equal, under the given assumptions. Of course it does not prove it. But actually, even when FullSimplify returned 0 to your original inout that would not, in my opinion, constitute a proof that the expressions are really equal. I don't think any present day CAS is reliable enough for that. So, in my opinion, this kind of verification is almost as good as what you would have if FullSimplify were able to handle your transcendental expression. Andrzej Kozlowski > > David Park > djmp at earthlink.net > http://home.earthlink.net/~djmp/ > > > > From: Andrzej Kozlowski [mailto:akoz at mimuw.edu.pl] >> I doubt if you will ever get a full description of how Simplify and >> FullSimplify work. > > I can't agree with the above. If you search through the archives for > posts by Adam Strzebonski with the word Simplify with them you wil > find that he has provided almost complete information about them. In > particular, he has posted the default ComplexityFucntion, the > complete lists of default transformation functions used by Simplify > and FullSimplify and other information, which means that in fact we > already have a more complete description of how these functions work > than is the case with almost any other Mathematica functions. > (Actually, in the particular case the original poster referred to, > the key work is done by FunctionExpand, about which we, or at least > I, do not know all that much, but it does not change the fact that > Simplify and FullSimplify themselves have been described very fully). >> >> I consider Simplify and FullSimplify as 'gifts from heaven'. When >> they do >> what I want, which they often do, great. When they don't, then I >> don't try >> to mess around with ComplexityFunction because that isn't very >> precise but >> only tends to push the result one way or the other. Rather, I >> resort to >> 'microsurgery' on the expression, using rules, replacements of >> specific >> parts and things like that. > > Of course you are right, but the point is that Simplify and > FullSimplify were never intended to get you from expression A to some > user specified expression B (although many users try to use or rather > misuse, them, to do just that.) There are other functions for this > purpose. Simplify and FullSimplify have two main purposes. in my > opinion, by far the most important one is showing that two different > symbolic expressions are equal. In this respect these functions are > unique; there is nothing in Mathematica that can replace them at this > task and this is also the most subtle aspect of what they do (and it > also has been described by Adam Strzebonski). The other important use > is to try to find a simpler form of a complicated expression in > situations when it is too hard to do this by hand. As there obviously > is no objective definition of "the simplest form" the user has a lot > of control of the direction he can "push the result in", but of > course this cannot be "precise" because in such situations there is > no "precise target". > >> >> My experience is, that with a little practice, it is possible to >> manipulate >> expressions and simplify them in a way that a reader could >> understand and >> follow. Sometimes one does have to directly employ specific >> mathematical >> theorems or identities to carry out a derivation. But it still can >> be done >> within Mathematica. > > Of course you are right. But the point of it all is simply that > Simplify and FullSimplify are not intended as tools for "manipulating > expressions". They can sometimes be used for this, but it usually > difficult to do precisely (as you have pointed out) and moreover, > even when it works it is almost always the most inefficient way of > achieving the result. > > Andrzej Kozlowski > > >> >> David Park >> djmp at earthlink.net >> http://home.earthlink.net/~djmp/ >> >> From: guy.verhofstadt at gmail.com [mailto:guy.verhofstadt at gmail.com] >> >> Hi, >> I have a question regarding something that Mathematica can do via the >> command FullSimplify. >> I use it to prove an identity between HypergeometricPFQ's. However it >> would be helpful to me to see how Mathematica proves it. How can I >> get >> access to the intermediate expressions and the transformations >> applied? >> Also, is there a definite list of all the things FullSimplify will >> try >> in Automatic setting? >> Thank you very much >> >> > >