I think I recall a conversation, some decades ago, with Roger about whether
specifying a modulus for system solving makes sense for J. I thought maybe
that was a use for the fit conjunction but now think that would be a poor
choice for such a numeric function. I have vague memories of J essays on
guass-jordan row reduction and extended gcds but didn't find them poking
around J help.
They could be useful for what I had in mind and modular inverses would be
part of that. Perhaps someone has those handy and could offer an addon? New
adverbs giving b m %.: a and m %.: a anyone?
Best, Cliff

On Wed, Mar 29, 2023 at 5:02 PM 'Michael Day' via Programming <
programm...@jsoftware.com> wrote:

> While this primitve works nicely in an example:
>
>     (2 3 4) (17&|@*)/ table >:i.8
> +-------+---------------------+
> |17&|@*/|1 2  3  4  5  6  7  8|
> +-------+---------------------+
> |2      |2 4  6  8 10 12 14 16|
> |3      |3 6  9 12 15  1  4  7|
> |4      |4 8 12 16  3  7 11 15|
> +-------+---------------------+
>
> I find this less satisfying:
>     (2 3 4) (17&|@%)/ table >:i.8
> +-------+-----------------------------------------------+
> |17&|@%/|1   2        3    4   5        6        7     8|
> +-------+-----------------------------------------------+
> |2      |2   1 0.666667  0.5 0.4 0.333333 0.285714  0.25|
> |3      |3 1.5        1 0.75 0.6      0.5 0.428571 0.375|
> |4      |4   2  1.33333    1 0.8 0.666667 0.571429   0.5|
> +-------+-----------------------------------------------+
>
> I have a function which does what one would expect.  I'll rename it as
> m17div here,  details unimportant for this discussion:
>     (2 3 4) m17div/ table >:i.8
> +-------+---------------------+
> |m17div/|1  2  3 4  5  6  7  8|
> +-------+---------------------+
> |2      |2  1 12 9 14  6 10 13|
> |3      |3 10  1 5  4  9 15 11|
> |4      |4  2  7 1 11 12  3  9|
> +-------+---------------------+
> ( eg 3 % 2 == 10 mod 17  because 3 = 17 | 2 * 10 )
>
> Would anyone else find this return of integer results useful or is it
> better
> to force a floating output?
>
> (Henry tells me that m&|@^ returns integer results,  working ok when m^2
> can be represented as a non-extended integer.)
>
> Thanks,
>
> Mike
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to