[Jprogramming] A Universal Domain and A Big Surprise
Linda Alvord
lindaalvord at verizon.net
Wed Mar 21 05:22:31 HKT 2012
Thanks.... It was a cute result. You seem to be doing good things in NYC for J . Tama says "hello", too.
Linda
-----Original Message-----
From: programming-bounces at jsoftware.com [mailto:programming-bounces at jsoftware.com] On Behalf Of Devon McCormick
Sent: Tuesday, March 20, 2012 10:28 AM
To: Programming forum
Subject: Re: [Jprogramming] A Universal Domain and A Big Surprise
Linda -
the "<:1" is giving you zero and you're dividing by this, hence the infinities except for the first one as "0%0" is one in J.
Regards,
Devon
On Tue, Mar 20, 2012 at 4:01 AM, Linda Alvord <lindaalvord at verizon.net> wrote:
> 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
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list