Miodrag Milenkovic wrote:
> What would be the conjunction c, which takes as the right
> argument the integer n, so that
> v c n x
> gives the cycle of length at most n, if the sequence of
> successive powers of v applied to x tends to such a cycle?
Assuming that v^:m x always has the same shape, for arbitrary
integer m, I think this should work for c:
c=:2 :0
({.~ }.>:@i.{.) ([EMAIL PROTECTED],}:)^:({. [EMAIL PROTECTED] }.)^:_
u^:(i.->:n) y
)
Or, spread out over several lines:
c=:2 :0
init=: u^:(i.->:n) y
fixed=: ([EMAIL PROTECTED],}:)^:({. [EMAIL PROTECTED] }.)^:_ init
({.~ }.>:@i.{.) fixed
)
Or, at least, it gives a cycle of length at most n... but note
that there are n permutations of the cycle which could satisfy
the above. So I'm uncomfortable with the idea that it gives
"THE cycle of length at most n"
If v produces results of varying shape, please replace v with
v&.> and x with <x
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm