# Improve the accuracy of calculations of a quadratic cosine?

Posted 10 months ago
1075 Views
|
9 Replies
|
7 Total Likes
|
 There is a formula Plot[ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]] Made calculations with increased accuracy Block[{$MinPrecision = 100000000,$MaxPrecision = 100000000}, Plot[ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]], {x, N[Pi, 100000000]/2 - 0.0000001, N[Pi, 100000000]/2 + 0.0000001}]] Can someone calculate with more accuracy? I do not understand whether there is a gap there or not.Sorry my English.
9 Replies
Sort By:
Posted 10 months ago
 Is this what you're after?: Plot[ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]], {x, Pi/2 - 0.0000001, Pi/2 + 0.0000001}, WorkingPrecision -> 16] (Note: N[Pi, 100000000]/2 - 0.0000001 is just a long way to compute Pi/2 - 0.0000001, since Mathematica converts N[Pi, 100000000]/2 to machine precision when -0.0000001 is added to it.)
Posted 10 months ago
 Plot[ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]], {x, Pi/2 - 0.0000001, Pi/2 + 0.0000001}, WorkingPrecision -> 16] this does not workI do not understand this line is vertical and there is no gap or there is a slope and there is a gap?
Posted 10 months ago
 The default symbolic analysis fails to detect the discontinuity. Compare Plot[ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]], {x, Pi/2 - 0.0000001, Pi/2 + 0.0000001}, WorkingPrecision -> 16, Exclusions -> ArcCos[Abs[Sin[Abs[x]]]] == 0] with Plot[ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]], {x, Pi/2 - 0.0000001, Pi/2 + 0.0000001}, WorkingPrecision -> 16, Exclusions -> Flatten@Values@ Solve[ArcCos[Abs[Sin[Abs[x]]]] == 0 && Pi/2 - 1*^-7 < x < Pi/2 + 1*^-7]] There should be a gap.
Posted 10 months ago
 Aleksey,There is a discontinuity there: In[20]:= Limit[ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]], x -> Pi/2, Direction -> "FromAbove"] Out[20]= -1 In[21]:= Limit[ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]], x -> Pi/2, Direction -> "FromBelow"] Out[21]= 1 You can evaluate the expression with arbitrary accuracy by specifying the accuracy. Michael is correct that as soon as you add the 0.0000001 to Pi/2 you use machine precision. The syntax is this: ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]] /. x -> Pi/2 + .000000000000000000000000000000001`50 to get -1.0000000000000000000000000000000000000000000000000 (Note: in this case I specified 50 digits of precision. You can go out to whatever you want.)
Posted 10 months ago
 just about the limits and forgot. And this proves that at the point Pi / 2 - the vertical line graphic and there is no gap or not? And how to prove it?
Posted 10 months ago
 Aleksey,I am not sure exactly what you are asking. The vertical line should not really be on the plot. It is a discontinuity (gap). The function approaches -1 from the positive side and 1 from the negative side. The limit is your proof of a discontinuity -- if the limit is different from each side, the function has a gap or discontinuity at that point. Plot connects all points so it will show the discontinuity as a vertical line.If I am not understanding your question and if your native language is Russian, please post it in Russian and my daughter will translate it for me.Regards,Neil
Posted 10 months ago
 Aleksey,I was able to understand the Russian post (before it was removed -- sorry - -I forgot about the rules). Many of the issues you raised are philosophical so I am not qualified to give you an opinion. I am also an engineer and not a pure mathematician. That being said, I think that the limit calculation proves that the function is not continuous and does not connect with a vertical line. The value at Pi/2 is undefined because it depends on the direction from which you approach Pi/2. Michael's plot with the Exclusions is the correct way to handle this plot as far as I know. I believe that you should exclude that point and the plot should not be connected with a line. Again, this is my opinion and you can ask a mathematician who would know more about the issues you raise. I hope this helps. Regards,Neil
 This is Not the answer for Yours question only another forumla for Quadratic cosine: HoldForm[ArcSin[Cos[x]]/ArcCos[Abs[Sin[Abs[x]]]] == HeavisideTheta[x] + 2 Sum[(-1)^k*HeavisideTheta[\[Pi]/2 - k \[Pi] + x], {k, 1, Infinity}] == -1 + (-1)^Floor[1/2 + x/\[Pi]] + HeavisideTheta[x]] // TraditionalForm $$\frac{\sin ^{-1}(\cos (x))}{\cos ^{-1}(\left| \sin (\left| x\right| )\right| )}=\theta (x)+2 \sum _{k=1}^{\infty } (-1)^k \theta \left(\frac{\pi }{2}-k \pi +x\right)=-1+(-1)^{\left\lfloor \frac{1}{2}+\frac{x}{\pi }\right\rfloor }+\theta (x)$$Regards,Mariusz