I've been working on the Jacobi's Method article, but have run in to a problem 
with the definition of the verb mxp.

>From the Word document:

mxp=: [: C. 0: ; <: , (,~ >:@|.)@>:@+:@i.@<:v
   mxp 6
|value error: v
|       mxp 6
mxp1=: [: C. 0: ; <: , (,~ >:@|.)@>:@+:@i.@<:
   mxp1 6
|index error: mxp1
|       mxp1 6


I suspect that the v on the end is a typo, but even then the verb gives an 
index error.

>From the description of what it is supposed to do:
==============================================
The subverb mxp (make index permutation) takes a positive even integer as 
argument and yields a list which is a permutation of the integers from 0 
through one less than the argument. The permutation is such that when applied 
repeatedly to a conforming list, none of the successive pairs in the lists are 
equal.
===============================================

... I came up with the following but I don't think it's quite right. Any ideas?

mxp2=: [: C. 0 ; (,~ <:@|.)@:>:@:+:@i...@-:
   mxp 6   
1 3 0 5 2 4

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

Reply via email to