Post Reply 
[VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier"
04-01-2019, 03:25 PM (This post was last modified: 04-03-2019 06:01 PM by Albert Chan.)
Post: #22
RE: [VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier"
Just figured out how to improve cin(x) accuracy for large x Smile

cin(x) = arcsin(cin(sin(x))) = nest(arcsin, cin(nest(sin, x, n)), n)

Pick enough nested sin's so cin argument is small, say below 0.1 radian

cin[x0_] := Block[ {n=0, x=x0+0.0},
    While[Abs[x] ≥ 0.1, x = Sin[x]; n++];
    Nest[ArcSin, x - (1/18) x^3 - (7/1080) x^5 - (51/32285) x^7, n]
]

Above cin(x) setup give about 12 digits accuracy:

x        cin(x)                         cin(cin(cin(x))) - sin(x)
0.0     0.0                             +0.0
0.2     0.199553461081         -1.9e-16
0.4     0.396375366278         +1.8e-14
0.6     0.587446695546         -1.1e-16
0.8     0.769025184826         -9.1e-14
1.0     0.935745970819         +1.4e-13
Pi/2.   1.210368344457         +2.6e-13
-0.71 -0.688778525307         -1.6e-13
2.019  1.026923318694        +6.4e-13

Edit: changed x^7 coefficient from -0.00158 to -51/32285 to get better accuracy
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] Short & Sweet Math Challenge #24: "2019 Spring Special 5-tier" - Albert Chan - 04-01-2019 03:25 PM



User(s) browsing this thread: 1 Guest(s)