Roger Hui wrote:
> For example, what is sin 0.8 to 40 digits?

>    0j40 ": -/ (y1^i) % ! i=: 2 * i. 17x
> 0.7173560908995227616271746105813853661928
>
> In comparison, Abramowitz & Stegun says (Table 4.6,
> page 158) that sin 0.8 is
>
> 0.71735 60908 99522 76162 718
>
> I believe the last digit in the A&S figure is
> incorrect.

I agree.

(a) Direct calculation with series for sin, and a crude error bound using
(|0.8<1) and (|cos 0.8)<:1 .

x=:4r5
sin=:4 : '-/ (y ^ i) % ! i=. 1 + 2 * i. x: x'
NB. x sin y evaluates x (nonzero) terms of the Taylor series
e=:3 : '%! +:>: y'
NB. error estimate using 1>:|cos y and 1>:|x.

   e 16  NB. not enough
3.38716e_39
   e 17  NB. enough
2.68822e_42
      0j40": 17 sin 4r5
0.7173560908995227616271746105813853661928

(b) Using Maple.

> Digits:=45;
                                 Digits := 45

> sin(0.8);
                0.717356090899522761627174610581385366192785238

The value of Digits sets the internal precision.  I have set it to 45 to
allow for roundoff error, and the last few are not to be relied upon,
although I believe them to be correct.

Check:

   e 19
1.22562e_48
   0j45": 19 sin 4r5
0.717356090899522761627174610581385366192785238

John

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to