Re: [math-fun] FullSimplify embarrassment contest
JBuddenhagen>Don't know mathematica. Perhaps of interest, wolframalpha also fails to simplify to 0, see http://www.wolframalpha.com/input/?i=arccos%28-%287%2F9%29%29+-+2*arcsec%283... However my old maple 7 outputs 0 for simplify(arccos(-(7/9)) - 2*arcsec(3)); <JB GACK! Instead Malpha expresses the 0 in terms inverse Jacobi elliptic functions! And then asks me to pay for additional computation time. My Macsyma hasn't yet adapted to Mavericks, but I can pretty much predict the outcome. Macsyma's closest (not very) equivalents to the FullSimplify shotgun are rat, ratsimp, and radcan, which are for canonicalizing certain classes of expressions, e.g. rational and algebraic functions, logs, powers, etc. They wouldn't apply here, at least directly. Likewise trigsimp, which isn't for arctrigs. As with Mathematica, trigexpand(cos(%)), or ratsimp thereof, would surely work. But to get 0 directly, I would try radcan(logarc(%)), converting the arctrigs to complex logs. In fact, Mathematica's equivalent is In[99]:= TrigToExp[%97] Out[99]= -(\[Pi]/2) + I Log[-((7 I)/9) + (4 Sqrt[2])/9] - 2 I Log[I/3 + (2 Sqrt[2])/3] In[100]:= FullSimplify[%] Out[100]= 0 So it's pretty much a bug that FullSimplify forgot to try TrigToExp, or got scared by the intermediate swell. I'll bet I have somewhere some more egregious cases. Anyone else? --rwg On Sun, Sep 28, 2014 at 6:13 PM, Bill Gosper <billgosper@gmail.com> wrote: What is the "simplest" 0 FullSimplify can't see? Extra credit if FunctionExpand fails too. I'll start the bidding with In[97]:= FullSimplify[FunctionExpand[Subtract @@ %]] Out[97]= ArcCos[-(7/9)] - 2 ArcSec[3] In[98]:= TrigExpand[Cos[%]] Out[98]= 1 --rwg ________________________________
Starting with Mike Hirschhorn's gosper.org/paper166.pdf, JBuddenhagen & I reduced this to the apparently minimal case In[224]:= FullSimplify[2 ArcCos[2/3] - ArcSec[-9]] Out[224]= 2 ArcCos[2/3] - ArcSec[-9] In[225]:= FullSimplify[TrigToExp[%]] Out[225]= 0 So any smaller example will probably use something besides arctrigs. Giving it a "hint" by logifying only half the expression suffices! In[227]:= FullSimplify[2 ArcCos[2/3] - TrigToExp[ArcSec[-9]]] Out[227]= 0 In[228]:= FullSimplify[TrigToExp[2 ArcCos[2/3]] - ArcSec[-9]] Out[228]= 0 I would have bet rather heavily against this. I'm also a bit surprised no one else has contributed a nonFullSimplification. --rwg On Sun, Sep 28, 2014 at 7:07 PM, Bill Gosper <billgosper@gmail.com> wrote:
JBuddenhagen>Don't know mathematica. Perhaps of interest, wolframalpha also fails to simplify to 0, see
http://www.wolframalpha.com/input/?i=arccos%28-%287%2F9%29%29+-+2*arcsec%283... However my old maple 7 outputs 0 for simplify(arccos(-(7/9)) - 2*arcsec(3)); <JB
GACK! Instead Malpha expresses the 0 in terms inverse Jacobi elliptic functions! And then asks me to pay for additional computation time. My Macsyma hasn't yet adapted to Mavericks, but I can pretty much predict the outcome. Macsyma's closest (not very) equivalents to the FullSimplify shotgun are rat, ratsimp, and radcan, which are for canonicalizing certain classes of expressions, e.g. rational and algebraic functions, logs, powers, etc. They wouldn't apply here, at least directly. Likewise trigsimp, which isn't for arctrigs. As with Mathematica, trigexpand(cos(%)), or ratsimp thereof, would surely work. But to get 0 directly, I would try radcan(logarc(%)), converting the arctrigs to complex logs. In fact, Mathematica's equivalent is In[99]:= TrigToExp[%97]
Out[99]= -(\[Pi]/2) + I Log[-((7 I)/9) + (4 Sqrt[2])/9] - 2 I Log[I/3 + (2 Sqrt[2])/3]
In[100]:= FullSimplify[%]
Out[100]= 0
So it's pretty much a bug that FullSimplify forgot to try TrigToExp, or got scared by the intermediate swell.
I'll bet I have somewhere some more egregious cases. Anyone else? --rwg
On Sun, Sep 28, 2014 at 6:13 PM, Bill Gosper <billgosper@gmail.com> wrote:
What is the "simplest" 0 FullSimplify can't see? Extra credit if FunctionExpand fails too. I'll start the bidding with In[97]:= FullSimplify[FunctionExpand[Subtract @@ %]] Out[97]= ArcCos[-(7/9)] - 2 ArcSec[3] In[98]:= TrigExpand[Cos[%]] Out[98]= 1 --rwg ________________________________
Hardly minimal, but perplexing: The last step in deriving Heron's formula: In[521]:= FullSimplify[%497] Out[521]= 1/4 Sqrt[-(a - b - c) (a + b - c) (a - b + c) (a + b + c)] Why won't it distribute that minus sign? Contorting, In[498]:= MapAt[-Hold @@ {-#} &, %, {2, 1, 2}] Out[498]= 1/4 Sqrt[(a + b - c) (a - b + c) (a + b + c) Hold[-a + b + c]] In[499]:= ReleaseHold[%] Out[499]= 1/4 Sqrt[(a + b - c) (a - b + c) (-a + b + c) (a + b + c)] In[519]:= LeafCount /@ {%496, %499} Out[519]= {34, 31} FullSimplify basically tries to minimize LeafCount by trying every plausible transformation. Looks like "plausible" needs loosening. At least it's smart enough to leave well enough alone: In[520]:= FullSimplify[%499] Out[520]= 1/4 Sqrt[(a + b - c) (a - b + c) (-a + b + c) (a + b + c)] --rwg Side issue (Attention eavesdropping kids!): Given %520, how do you define Heron[a_,b_,c_], short of copying and pasting (which may not always be possible)? I'm guessing your solution doesn't create a value Heron[a_,b_,c_]:=1/4 ... , so you won't be able to reexecute the definition when you reload the notebook. How do you get an executable definition? No wonder everybody just copies and pastes! On Tue, Sep 30, 2014 at 12:04 PM, Bill Gosper <billgosper@gmail.com> wrote:
Starting with Mike Hirschhorn's gosper.org/paper166.pdf, JBuddenhagen & I reduced this to the apparently minimal case In[224]:= FullSimplify[2 ArcCos[2/3] - ArcSec[-9]]
Out[224]= 2 ArcCos[2/3] - ArcSec[-9]
In[225]:= FullSimplify[TrigToExp[%]]
Out[225]= 0
So any smaller example will probably use something besides arctrigs. Giving it a "hint" by logifying only half the expression suffices! In[227]:= FullSimplify[2 ArcCos[2/3] - TrigToExp[ArcSec[-9]]]
Out[227]= 0
In[228]:= FullSimplify[TrigToExp[2 ArcCos[2/3]] - ArcSec[-9]]
Out[228]= 0 I would have bet rather heavily against this.
I'm also a bit surprised no one else has contributed a nonFullSimplification. --rwg
On Sun, Sep 28, 2014 at 7:07 PM, Bill Gosper <billgosper@gmail.com> wrote:
JBuddenhagen>Don't know mathematica. Perhaps of interest, wolframalpha also fails to simplify to 0, see
http://www.wolframalpha.com/input/?i=arccos%28-%287%2F9%29%29+-+2*arcsec%283... However my old maple 7 outputs 0 for simplify(arccos(-(7/9)) - 2*arcsec(3)); <JB
GACK! Instead Malpha expresses the 0 in terms inverse Jacobi elliptic functions! And then asks me to pay for additional computation time. My Macsyma hasn't yet adapted to Mavericks, but I can pretty much predict the outcome. Macsyma's closest (not very) equivalents to the FullSimplify shotgun are rat, ratsimp, and radcan, which are for canonicalizing certain classes of expressions, e.g. rational and algebraic functions, logs, powers, etc. They wouldn't apply here, at least directly. Likewise trigsimp, which isn't for arctrigs. As with Mathematica, trigexpand(cos(%)), or ratsimp thereof, would surely work. But to get 0 directly, I would try radcan(logarc(%)), converting the arctrigs to complex logs. In fact, Mathematica's equivalent is In[99]:= TrigToExp[%97]
Out[99]= -(\[Pi]/2) + I Log[-((7 I)/9) + (4 Sqrt[2])/9] - 2 I Log[I/3 + (2 Sqrt[2])/3]
In[100]:= FullSimplify[%]
Out[100]= 0
So it's pretty much a bug that FullSimplify forgot to try TrigToExp, or got scared by the intermediate swell.
I'll bet I have somewhere some more egregious cases. Anyone else? --rwg
On Sun, Sep 28, 2014 at 6:13 PM, Bill Gosper <billgosper@gmail.com> wrote:
What is the "simplest" 0 FullSimplify can't see? Extra credit if FunctionExpand fails too. I'll start the bidding with In[97]:= FullSimplify[FunctionExpand[Subtract @@ %]] Out[97]= ArcCos[-(7/9)] - 2 ArcSec[3] In[98]:= TrigExpand[Cos[%]] Out[98]= 1 --rwg ________________________________
On Tue, Oct 7, 2014 at 1:14 AM, Bill Gosper <billgosper@gmail.com> wrote:
Out[520]= 1/4 Sqrt[(a + b - c) (a - b + c) (-a + b + c) (a + b + c)] --rwg Side issue (Attention eavesdropping kids!): Given %520, how do you define Heron[a_,b_,c_], short of copying and pasting (which may not always be possible)? I'm guessing your solution doesn't create a value Heron[a_,b_,c_]:=1/4 ... , so you won't be able to reexecute the definition when you reload the notebook. How do you get an executable definition? No wonder everybody just copies and pastes!
Heron[A_,B_,C_] := %520 /. {a->A,b->B,c->C} --Michael -- Forewarned is worth an octopus in the bush.
participants (2)
-
Bill Gosper -
Michael Kleber