It doesn't seem right. But it is an inverse.

   3+inv 3+4
4
   3+3+inv 4
4

But inverse really has meaning only for monads. In order to make a dyad a
monad J bonds the left argument to the verb. Perhaps bonding the right
argument would give the answer you expected. like this:

   plus=:(+) :. (-&])
   3 plus inv 4
_1
   (3 plus 4)plus inv 4
3
   (3 plus inv 4)plus 4
3

And it works too for dyadic. But then it doesn't follow the right-to-left
processing of verbs.

   3 plus inv 3 plus 4
_4
   3 plus 3 plus inv 4
2

Which is probably why bonding to the left was chosen.

It fails for monadic.

   plus inv 3j4
_3j_4

plus could be defined as:
   plus=:(+) :. (+ : -)
to avoid that monadic problem.

Mathematics only defines inverse for monadic functions. At least as best as
I can tell. Somewhere I saw that "inverse" could also be called "undo". But
undo what? And it gets even messier if the verb/function is not commutative.

And J's inverse is not always right either.

   *: inv *:_2
2

On Fri, Jan 9, 2015 at 11:25 AM, Linda Alvord <lindaalv...@verizon.net>
wrote:

> But 1 is the wrong answer ass a mathematician in the real world for the
> answer for an inverse!
>
>   4*inv 7
> 1.75
>    4 * inv 7
> 1.75
>    4%7
> 0.571429
>    7%4
> 1.75
>
>   4 + inv 7
> 3
>    4-7
> _3
>    7-4
> 3
>
> Linda
>
> -----Original Message-----
> From: programming-boun...@forums.jsoftware.com
> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Don Guinn
> Sent: Thursday, January 8, 2015 12:06 PM
> To: Programming forum
> Subject: Re: [Jprogramming] A striggle with "inverse"
>
> Obverse/inverse applies to the monadic use of a verb. So,
>
>    + b._1 NB. Conjugate
> +
>    - b._1 NB. Negation
> -
>    * b._1 NB. Signum. Cannot undo this.
> |domain error
> |       *b._1
>    % b._1 NB. Inverse
> %
>
> When applied to a dyadic use it is interpreted as the left argument bound
> to
> the verb making a monadic verb.
>
>    3+inv 4
>
> 1
>    (3&+)b._1
> _3&+
> ----------------------------------------------------------------------
> 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

Reply via email to