Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This is a continuation of: Why do certain fractional values in TriangleWave not evaluate?
The analysis by R.M and rasher revealed that problem to reduce to the behavior of:

ArcSin[Sin[π / 10]]
ArcSin[1/4 (-1 + Sqrt[5])]

Every other denominator besides ten, at least up to 500,000, automatically evaluates to a simpler form:

 Position[ArcSin[Sin[π / Range[500000]]], _ArcSin]  (* slow *)
{{10}}

All other coefficient of π with a denominator of ten appear to exhibit the same problem:

ArcSin[Sin[{1, 3, 7, 9, 11} π/10]]
{ArcSin[1/4 (-1 + Sqrt[5])], ArcSin[1/4 (1 + Sqrt[5])], ArcSin[1/4 (1 + Sqrt[5])], 
 ArcSin[1/4 (-1 + Sqrt[5])], ArcSin[1/4 (1 - Sqrt[5])]}

FullSimplify reduces the expression:

 ArcSin[Sin[{1, 3, 7, 9, 11} π/10]] // FullSimplify
{π/10, (3 π)/10, (3 π)/10, π/10, -(π/10)}

Is this a bug? Is there some explanation for it?


Before someone points out the obvious: I see that Sin[π/10] evaluates to 1/4 (-1 + Sqrt[5]). But why isn't ArcSin "smart" enough to recognize this value, when it recognizes others? For example Sin[π/12] evaluates to (-1 + Sqrt[3])/(2 Sqrt[2]) but ArcSin correctly recognizes this and outputs π/12.

share|improve this question
    
Why would they give ArcSin ReadProtected if removing it does not show additional information? :( –  Jacob Akkerboom Jan 9 at 10:42
2  
@Jacob A bad sense of humor? –  Mr.Wizard Jan 9 at 10:48
1  
FWIW, while Sin[Pi/8] does not evaluate, if expanded to Sqrt[2 - Sqrt[2]]/2], by hand or with Simplify`TrigToRadicals, ArcSin[Sqrt[2 - Sqrt[2]]/2] does not evaluate back to Pi/8, unless FullSimplify is applied. This seems to have a different issue than Pi/10, in that Pi/8 is never guessed at, if we apply Trace as in Simon Wood's answer. (Of course, without replacing Sin[Pi/8], ArcSin[Sin[Pi/8]] yields Pi/8.) –  Michael E2 Jan 9 at 14:56

2 Answers 2

Looking at the Trace of one which does work:

x = Sin[Pi/5]
(* Sqrt[5/8 - Sqrt[5]/8] *)

Trace[ArcSin[x], TraceInternal -> True]

enter image description here

It appears that Mathematica computes the ArcSin numerically and then recognises the result, 0.628319 as possibly equal to Pi/5. To check it computes Sin[Pi/5], and subtracts it from the original argument to see if it gets zero. It does, and so Pi/5 is the correct result.

Note that this relies on getting zero from this:

x - x
(* 0 *)

Interestingly, with Pi/10 we get this:

x = Sin[Pi/10]
(* 1/4 (-1 + Sqrt[5]) *)

x - x
(* 1/4 (1 - Sqrt[5]) + 1/4 (-1 + Sqrt[5]) *)

It doesn't automatically simplify to zero. The Trace reveals that Mathematica correctly guesses that the numerical result 0.314159 might be equal to Pi/10 but because the result above doesn't simplify to zero it appears that the guess of Pi/10 is rejected and the result is returned unevaluated:

Trace[ArcSin[x], TraceInternal -> True]

enter image description here

share|improve this answer
1  
Very interesting. Adding a Expand or Simplify in ArcSin internals would have helped. –  Sjoerd C. de Vries Jan 9 at 11:37
2  
It seems to be this effects all x - x where x matches the FullForm Times[Rational[1, n],Plus[__]]. –  MikeLimaOscar Jan 9 at 13:50
    
@MikeLimaOscar Nice observation. It seems the minus sign is applied to the Plus factor when the numerator of Rational[p, q] is p = 1; otherwise it is applied to p. (If p == -1, the minus is taken from the Rational and moved to the Plus automatically.) –  Michael E2 Jan 9 at 14:14
    
Kind of fun, if mysterious: ClearAll[p]; SetAttributes[p, NumericFunction]; N[p[], prec_] := N[23 Pi, prec]; ArcSin@Sin[p[]/10]. Trace does not reveal how it's done. You can play with the multiple of Pi - I always get a correct, exact answer (in terms of p[]). –  Michael E2 Jan 9 at 15:02

Extended comment

There seems to be an entire class that does not get simplified

mm = 1000;
nn = 20;
nn2 = 20;
nn3 = 10;
primes = Table[Prime[kk], {kk, mm}];
Apply[Equal, 
 Head /@ Table[
   ArcSin[1/ll (ll3 Sqrt[kk] + ll2)], {kk, primes[[;; nn]]}, {ll, 
    nn2}, {ll2, -nn2, nn2}, {ll3, -nn3, nn3}]]

True

All the examples by Mr.Wizard are in this class.

I thought the issue might be that Mathematica knows that ArcSin[Sin[Pi/20]] == Pi/20 only because Sin[Pi/20] stay unevaluated, but that seems not to be the reason, which can be seen from

Internal`InheritedBlock[
 {ArcSin},
 SetAttributes[ArcSin, HoldAll];
 HoldForm@Evaluate@Column@
    {ArcSin[Sin[Pi/10]],
     ArcSin[1]}
 ]

ArcSin[Sin[Pi/10]]
Pi/2

which I suppose doing a simple ArcSin[Unevaluated[Sin[Pi/10]]] also proves.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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