The most beautiful identity in all of mathematics is:

   _1 = e^0j1*pi   

( http://en.wikipedia.org/wiki/Euler%27s_identity )
which in one short equation relates the fundamental
quantities _1, e, 0j1, and pi.  It has always bothered
me that in J the answer is unavoidably:

   ^ 0j1 * 1p1
_1j1.22461e_16

Unavoidable if the computations are done using
finite precision floating point numbers, which
IEEE 64-bit floats are.  (pi can not be represented
exactly as a finite precision floating point number.)

However, in J there is the possibility of doing something
special for ^...@o., the exponential function (o.) composed
with pi times (o.), and in J7.01 that possibility has been
realized.  With special code, ^...@o. "knows" when the
argument of ^ falls exactly on the real or imaginary
axis and has magnitude the requisite fraction/multiple
of pi, and accordingly provide the exact answer.  Thus:

   0 j. 0.5 * i.3 4
  0 0j0.5 0j1 0j1.5
0j2 0j2.5 0j3 0j3.5
0j4 0j4.5 0j5 0j5.5
   ^...@o. 0 j. 0.5 * i.3 4
1 0j1 _1 0j_1
1 0j1 _1 0j_1
1 0j1 _1 0j_1

   ^...@o. 0 j. 2e9 + 0.5 * i.3 4
1 0j1 _1 0j_1
1 0j1 _1 0j_1
1 0j1 _1 0j_1

In contrast:

   ] t=: o. 0 j. 0.5 * i.3 4
        0  0j1.5708 0j3.14159 0j4.71239
0j6.28319 0j7.85398 0j9.42478 0j10.9956
0j12.5664 0j14.1372  0j15.708 0j17.2788
   ^ t
             1 6.12303e_17j1 _1j1.22461e_16 _1.83691e_16j_1
1j_2.44921e_16 3.06152e_16j1 _1j3.67382e_16 _4.28612e_16j_1
1j_4.89843e_16 5.51073e_16j1 _1j6.12303e_16 _2.44989e_15j_1

The difference here is that t is represented by
IEEE 64-bit floats, and the quantities are 
necessarily inexact.



----- Original Message -----
From: DIETER ENSSLEN <[email protected]>
Date: Tuesday, January 19, 2010 15:40
Subject: Re: [Jchat] J and CAS, and problems in CAS
To: Chat forum <[email protected]>

> Dear Roger
> 
> if this relates to J and CAS topic, could you please add an 
> enlightening word in English or mathematics to it
> 
> thanks
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to