OK - I should have said/read "don't know - don't care ..."

Thanks for the lengthy explanation. As you know from
past experiences, I am often bone headed...

I admit/see that I was indeed wrong to say j405 was
more accurate than subsequent versions - but, being
defensive, I was aware of the implications of 1p1
being true to a slightly incorrect value of pi since
when I was 13 years old, with too much time on my
hands, I committed 50 digits of pi to memory. This
is insignificant compared to some people who can
recite it to thousands of digits - but it did
serve to spark my interest in power series several
years later when I encountered them in college.

Even after saying all that, and accepting your rebuke
and corrections, I continue to find it interesting
that j601 (actually starting with j504) is indeed
more accurate than j405 since in that version -

   0j40 ": 1 o. 1p1
0.0000000000000000000000000000000000000000

and that is indeed further from the accurate result
(based on the inaccurate machine value of 1p1) than
is the current system, 2.38462e_16 versus 1.16002e_16

Still, I believe some numerical earthquake took place
in the shift in C sin() results. Even such an improvement
in accuracy surely surprised many people and seems likely
to have caused other shifts in results too. I suppose it
is best, like most California earthquakes, to ignore them.

In any case, I'm happy to sit back and wait for arbitrary
precision/accuracy facilities to be introduced in J.

- joey


At 09:37  -0800 2006/12/05, Roger Hui wrote:
No, you should have read it as "I don't care".
And you are incorrect that the non-zero result
of sin 1p1 means that there is reduced accuracy
in a newer release of J.

I had already pointed out that
   1p1 - 3.141592653589793
0
Since only a true 0 can display as 0, that means
1p1 is represented exactly as 3.141592653589793.
The latter is not transcendental, not irrational
even.  The sine of a non-zero rational number can
never be zero.  So what is sin 1p1, to 40-digits,
say?

Discussions subsequent to our interchange indicated
how one can compute sin to any finite number of
digits.  In any case, the power series for sin and
cos are topics treated in a first-year calculus
course.  x=: 3.141592653589793 is slightly less than
true pi, that is, x=pi-c where c is a number with
small magnitude.  By the sum formula
   (sin a+b)=((sin a)*cos b)+(sin b)*cos a
and so (sin pi-c)=((sin pi)*cos -c)+(sin -c)*cos pi.
The first term simplifies to 0 since sin pi is 0. The second term simplifies to sin c since sin -c is
- sin c and cos pi is _1 .  Thus:

   x=: 3141592653589793x % 10^15x
   pi=: ((10^40x) %~ <[EMAIL PROTECTED] 10^40x)
   c=: pi - x
   0j_8 ": c
2.38462643e_16

With c being so small the power series converges
rapidly:
   0j_8 ": (c^5) % !5x
6.42570115e_81

That is, three terms suffice.  Thus:
   0j40 ": -/ (c^i) % ! i=: 1 + 2 * i.3x
0.0000000000000002384626433832795028841971

In contrast, in J6.01:
   0j40 ": sin 1p1
0.0000000000000001224606353822377300000000

Now as to the "I don't care":  If you did not
already know, the J interpreter is implemented in
C and there is a sin() function in the C library
routine.  As far as I know sin(x) gives good results
for most x.  The question is, do I want to do
anything about the cases which are slightly off,
such as sin 1p1 giving a zero result in the version
of C used in J4.05d in May 2001, or that in J6.01
sin 1p1 is 1.22e_16 instead of the more correct
value of 2.38e_16?  I do not.

I did not say all these things because I had
assumed a certain amount of knowledge and
intelligence on the part of my interlocutor
(more than that of the average interlocutor).
My expectations were apparently too high.



----- Original Message -----
From: Joey K Tuttle <[EMAIL PROTECTED]>
Date: Tuesday, December 5, 2006 8:39 am
Subject: Re: [Jgeneral] Bug? Sin of pi.

 When I got Roger's reply - I read it as "I don't know..."
 Quite an unusual response about changes in J results!
 >
 Actually, I ruled out the Phase of the moon, since both
 experiments were performed quite close in time - and vagaries
 in the CPU for the reason that both results were from same
 machine, only seconds apart (and were reproducible). That ony
 left "Changes in the C library".

 I am a bit surprised that results from C library routines would
 lead to reduced accuracy in a newer release of J... I thought
 perhaps a "special check" had been removed, but surely Roger
 would have said that. Just to be clear - my expectations are
 not that "numerical results should conform ..." --- merely
 surprise that the result of 1 o. 1p1 changed between releases
 of J.

 Other than Roger's rather flip/dismissive remarks, no one else
 seems to wonder about that... That also surprises me.

 - joey


 At 10:48  -0400 2006/12/05, ramacd wrote:
 >Folks;
 >
 >Although I concur with the assessment of the level of
 helpfulness, the issue
 >seems to be how one responds to an impossibly high expectation,
 namely that
 >machine-based numerical results should conform to mathematical
 identities>( 0 = sin k * pi, in this case).
 >
 >Perhaps the response was too obvious, like "the fact that the
 perpetual>motion machine stopped is not a bug," would be.
 >
 >----- Original Message -----
 >From: "Richard Donovan" <[EMAIL PROTECTED]>
 >To: <[email protected]>
 >Sent: Tuesday, December 05, 2006 6:59 AM
 >Subject: Re: [Jgeneral] Bug? Sin of pi.
 >
 >
 >>  I nominate this reply, and a previous one-liner by the same author
 >>  ( " This is not a bug " ) as two of the most uninformative and
 unhelpful>>  messages I have ever seen posted to this normally
 informative and
 >>  very helpful forum!
 >>
 >>
 >>
 >>  >From: Roger Hui <[EMAIL PROTECTED]>
 >>  >Reply-To: General forum <[email protected]>
 >>  >To: General forum <[email protected]>
 >>  >Subject: Re: [Jgeneral] Bug?  Sin of pi.
 >>  >Date: Fri, 01 Dec 2006 11:06:26 -0800
 >>  >
 >>  >Changes in the C library?  Vagaries in the CPU?
 >>  >Phase of the moon?
 >>  >
 >>  >
 >>  >
 >>  >----- Original Message -----
 >>  >From: Joey K Tuttle <[EMAIL PROTECTED]>
 >>  >Date: Friday, December 1, 2006 10:55 am
 >>  >Subject: Re: [Jgeneral] Bug?  Sin of pi.
 >>  >
 >>  > > At 10:32  -0800 2006/12/01, Roger Hui wrote:
 >>  > > >Because
 >>  > > >
 >>  > > >    1p1 - 3.141592653589793
 >>  > > >0
 >>  > > >
 >>  > > But, as was pointed out -
 >>  > >
 >>  > >    9!:14 ''
 >>  > > 4.05/2001-05-16/11:30
 >>  > >    1 o. 1p1
 >>  > > 0
 >>  > >    1p1 - 3.141592653589793
 >>  > > 0
 >>  > >
 >>  > > I think the question is, what has caused the shift?
 >>  > >
 >>  > >    9!:14 ''
 >>  > > j504/2005-03-16/15:30
 >>  > >    1 o. 1p1
 >>  > > 1.22461e_16
 >>  > >    1p1 - 3.141592653589793
 > >>  > > 0

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

Reply via email to