I wrote a function  d  to provide a domain that is appropriate for either
rectangular or polar plots.  Here's what it looks like.

   T=:2p1
   d=: 13 :'(0{x)-(-/x)*(i.>:y)%y'
   (0,T) d 8
0 0.785398 1.5708 2.35619 3.14159 3.92699 4.71239 5.49779 6.28319
   
   (0,T%2) d 8
0 0.392699 0.785398 1.1781 1.5708 1.9635 2.35619 2.74889 3.14159
   (0,1) d 8
0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1
   (_1,1) d 8
_1 _0.75 _0.5 _0.25 0 0.25 0.5 0.75 1
   
Here's what David Ward Lambert showed me as a shortcut if  i:  is desired:

   i: 1j8
_1 _0.75 _0.5 _0.25 0 0.25 0.5 0.75 1
  
My first version, which I rejected was based on the number of atoms in the
list rather than the number of intervals.  I thought I would  replace  y-1
by  <:y .  Intead I typed  <:1 .  The result is confounding!  Happy hunting
for an explanation.  
   
   da=: 13 :'(0{x)-(-/x)*(i.y)%y-1'
   (0,1) da 9
0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1
   da=: 13 :'(0{x)-(-/x)*(i.y)%<:1'
   (0,1) da 9
0 _ _ _ _ _ _ _ _

Just another little "wake up" exercise.

The "good d" looks like this in tacit form:

  d
(0 { [) - ([: -/ [) * 0 %~ [: i. ] 

Linda   

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

Reply via email to