1
$\begingroup$

In many cases involved compute the aera or volume, Mathematica always gives the result contains sum of inverse trigonometric functions. In fact, the result can be simplified contains only one inverse trigonometric functions, FullSimplify not working well.

For example:

res1 = FullSimplify@Area@ImplicitRegion[x^2 + y^2 < 1 && (x + 1)^2 + (y - 1)^2 > 4, {x, y}]

expectRes1 = Sqrt[7]/2 - Pi/2 + ArcSin[67/(64 Sqrt[2])];

N[res1 - expectRes1]


res2 = FullSimplify@Volume@RegionIntersection[Ball[{0,0,0},2], Cuboid[{1,1,1}, √2{1,1,1}]]

expectRes2 = Sqrt[2] - 1 + (97 Pi)/12 - 27 ArcTan[Sqrt[2]];

N[res2 - expectRes2]
$\endgroup$
  • $\begingroup$ A related question. $\endgroup$ – J. M. will be back soon Nov 9 '17 at 6:54
  • $\begingroup$ As note by @J.M., by using the rules posted here, it is posible to get a result expressed in only one inverse trigonometric result. Not exactly as in the expected result, but numerically equivalent... $\endgroup$ – José Antonio Díaz Navas Dec 9 '17 at 12:10
2
+100
$\begingroup$

You can use ComplexityFunction -> LeafCount:

FullSimplify[res1, ComplexityFunction -> LeafCount, TimeConstraint -> 60]
(* 1/2 (Sqrt[7] - ArcTan[(1541 Sqrt[7])/393]) *)

FullSimplify[res2, ComplexityFunction -> LeafCount, TimeConstraint -> 60]
(* -1 + Sqrt[2] - \[Pi]/8 - 1/24 ArcTan[(4123651245286456362954203689325408073387734315097911925141171267613495287237626892084130940619316379538231060438740741988164466432224520238678407487026760 Sqrt[2])/38219844008518705060277247743675197372239901243352879627648626900184834230994760766671631647201755355168349320672368858391586410913535339715516617545787119] *)

In both cases you get expressions with only one trig function. If you increase the TimeConstraint, you will find a more compact expression for the second case. I leave this to you.

$\endgroup$
  • $\begingroup$ Perhaps better: FullSimplify[res1, ComplexityFunction -> ((LeafCount[#] + 100 Count[#, (_ArcSin | _ArcCos | _ArcTan), {0, Infinity}] + 250 Count[#, _Log, {0, Infinity}]) &)]. $\endgroup$ – AccidentalFourierTransform Mar 26 '18 at 23:10
0
$\begingroup$

It is interesting that FullSimplify quits early. You can get farther with

res1 = Area@
   ImplicitRegion[
    x^2 + y^2 < 1 && (x + 1)^2 + (y - 1)^2 > 4, {x, y}] // 
  FullSimplify

(*1/2 (Sqrt[7] + \[Pi] - ArcSin[1/4 (1 - Sqrt[7])] + 
   4 ArcSin[1/8 (5 - Sqrt[7])] - ArcSin[1/4 (1 + Sqrt[7])] - 
   4 ArcSin[1/8 (5 + Sqrt[7])])*)

Then FullSimplify individual pieces

    1/2 (Sqrt[7] + \[Pi] - 
   FullSimplify[
    ArcSin[1/4 (1 - Sqrt[7])] + ArcSin[1/4 (1 + Sqrt[7])]] + 
   FullSimplify[
    4 ArcSin[1/8 (5 - Sqrt[7])] - 4 ArcSin[1/8 (5 + Sqrt[7])]])  

 (*1/2 (Sqrt[7]+\[Pi]-4 ArcTan[(5 Sqrt[7])/9]-ArcCsc[4/Sqrt[7]])*)

Almost gets there

$\endgroup$
0
$\begingroup$

For your first example:

res1 = FullSimplify@Area@ImplicitRegion[
    x^2 + y^2 < 1 && (x + 1)^2 + (y - 1)^2 > 4, {x, y}]

(* (1/2)*(Sqrt[7] + Pi - ArcSin[(1/4)*(1 - Sqrt[7])] + 
      4*ArcSin[5/8 - Sqrt[7]/8] - ArcSin[(1/4)*(1 + Sqrt[7])] - 
      4*ArcSin[(1/8)*(5 + Sqrt[7])]) *)

A simpler form can be obtained using ComplexExpand

res1r1 = FullSimplify@ComplexExpand@res1

(* (1/2)*(Sqrt[7] + Pi - ArcCot[3/Sqrt[7]] - 4*ArcTan[(5*Sqrt[7])/9]) *)

Further, by using a custom ComplexityFunction

res1r2 = res1r1 // FullSimplify[#, 
     ComplexityFunction -> (LeafCount[#] + 
         100 Count[#, _ArcCot, {0, Infinity}] &)] & // ComplexExpand

(* Sqrt[7]/2 - Pi/4 + (1/4)*ArcTan[(605613*Sqrt[7])/8234159] *)

Although not the same form as expectRes1, res1r2 has a single inverse trig function and is equivalent.

Verifying equivalence with expectRes1

expectRes1 = Sqrt[7]/2 - Pi/2 + ArcSin[67/(64 Sqrt[2])];

res1 == expectRes1 // ComplexExpand // FullSimplify

(* True *)

res1r1 == expectRes1 // FullSimplify

(* True *)

res1r2 == expectRes1 // FullSimplify

(* True *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.