I am almost close to finishing an initial version. But, I don't know how to
write a verb P(ij) = (phase(i) - phase(j))/lineReactance(ij) where
*lineReactance*
0 0.005 0.00625 0 0 0 0
0 0 0 0
0.005 0 0.04 0.00333333 0.01 0 0
0 0 0 0
0.00625 0.04 0 0 0 0 0 0.01
0.025 0 0
0 0.00333333 0 0 0.005 0.005 0.00333333
0 0 0 0
0 0.01 0 0.005 0 0 0.005
0 0 0 0
0 0 0 0.005 0 0 0.005
0 0 0 0.00666667
0 0 0 0.00333333 0.005 0.005 0
0 0 0 0.00833333
0 0 0.01 0 0 0 0 0
0.01 0.00625 0
0 0 0.025 0 0 0 0
0.01 0 0.02 0
0 0 0 0 0 0 0 0.00625
0.02 0 0.02
0 0 0 0 0 0.00666667 0.00833333
0 0 0.02 0
*phase *
9.49428 5.92433 7.70672 4.02707 4.03065 2.58708 3.0874 5.96236 6.03134
4.82902 0
I can compute one by one like
((0{phase)-phase)% 0{lineReactance
0 713.99 286.01 _ _ _ _ _ _ _ _
((1{phase)-phase)% 1{lineReactance
_713.99 0 _44.5596 569.181 189.368 _ _ __ __ _ _
But, how do I write this so that it computes for all items in the matrix?
Thanks,
PT
How do I write a verb that computes
On Tue, May 21, 2013 at 8:40 AM, Linda Alvord <[email protected]>wrote:
>
> odd=:2 & |
> halve=:-:
> veco =: 3 : '(c*1+3*y) + (halve y) * (1-c =. odd y)'
> data =: 1 + i. 10000
> veco3=:'((odd y)*1+3*y) + (halve y) * (1-odd y)'(13 : )
> (veco3 data) -: (veco data)
> 1
>
> veco3
> (odd * 1 + 3 * ]) + halve * 1 - odd
>
> Linda
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Linda
> Alvord
> Sent: Tuesday, May 21, 2013 9:21 AM
> To: [email protected]
> Subject: Re: [Jprogramming] newbie help: how to avoid division by zero
>
> '(c*1+3*y) + (halve y) * (1-c =: odd y)'(13 : )
> 3 : '(c*1+3*y) + (halve y) * (1-c =: odd y)'
> '(c*1+3*y) + (halve y) * (1-c =. odd y)'(13 : ) halve (* + [ * 1 - ])
> odd
>
> Linda
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Linda
> Alvord
> Sent: Tuesday, May 21, 2013 7:13 AM
> To: [email protected]
> Subject: Re: [Jprogramming] newbie help: how to avoid division by zero
>
> I didn't realize that this definition for veco2 did not work.
>
> data =: 1 + i. 10000
> veco =: 3 : '(c*1+3*y) + (halve y) * (1-c =. odd y)'
> '(c*1+3*y) + (halve y) * (1-c =. odd y)'(13 : ) halve (* + [ * 1 - ])
> odd
> veco2=:halve (* + [ * 1 - ]) odd
> (veco2 data) -: (veco data)
> 0
>
> So, although your substitution works, it doesn't help.
>
> veco3=:halve (* -.) odd
> (veco3 data) -: (veco data)
>
> I'll be more careful about testing the results of: ' '(13 : )
>
> Linda
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of David Ward
> Lambert
> Sent: Monday, May 20, 2013 12:24 PM
> To: programming
> Subject: Re: [Jprogramming] newbie help: how to avoid division by zero
>
> I'd replace ([ * 1 - ]) with (* -.) .
> As previously observed, 13 :'quoted expression' won't write hooks.
>
> (([ * 1 - ]) -: (* -.)) -:i:8 NB. monad
> 1
> (([ * 1 - ])/ -: (* -.)/)~ -:i:8 NB. dyad
> 1
>
> >Date: Sun, 19 May 2013 11:43:52 -0400
> >From: "Linda Alvord" <[email protected]>
> >To: <[email protected]>
> >Subject: Re: [Jprogramming] newbie help: how to avoid division by zero
> >Message-ID: <000101ce54a7$aa2d4c10$fe87e430$@net>
> >Content-Type: text/plain; charset=US-ASCII
> >
> > It is worth noting further simplification by J:
> >
> > veco=: 13 :'(c*1+3*y) + (halve y) * (1-c =. odd y)'
> > veco
> >halve (* + [ * 1 - ]) odd
> >
> >Linda
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm