DEFDBL AZ
pi = ATN(1) * 4
incr = .0000001#
FOR y = incr / 2 TO pi / 2 STEP incr
t = t + SIN(y) * LOG(SIN(y))
NEXT
PRINT t * incr
Successively changing the increment from .0001 to .0000001 by dividing by 10 each time produces
.3068528238160199
.3068528194936749
.3068528194417146
.3068528194866375
I have the feeling that the changeover from decreasing to increasing in the last instance is the result of more terms being added, and therefore producing lower, rather than higher, accuracy. On that basis, I'd limit the quoted value accuracy to .3068528194....
UBASIC, with higher precision can be used:
10 Incr=0.0000001
15 Y=Incr/2
20 loop
30 T=T+sin(Y)*log(sin(Y))
35 Y=Y+Incr
36 if Y>#pi/2 then goto 50
40 endloop
50 print T*Incr
giving 0.306852819440061945, so I would feel safe with the accuracy of 0.30685281944.

Posted by Charlie
on 20090519 12:28:29 