Vocabulary/minus

From J Wiki
Jump to navigation Jump to search

>> <<   Down to: Dyad   Back to: Vocabulary Thru to: Dictionary

- y Negate

Rank 0 -- operates on individual atoms of y, producing a result of the same shape -- WHY IS THIS IMPORTANT?


Negates value of number y

   - 0 1 2.2 3j4 4r5 _66
0 _1 _2.2 _3j_4 _0.8 66

Common Uses

Negate video

Inverting the sign of a number.

   - !55x          NB. Negate factorial 55 (extended integer)
_12696403353658275925965100847566516959580321051449436762275840000000000000
   - 1j1 3r4 2p1   NB. Negate complex, rational, two pi
_1j_1 _0.75 _6.28319

Related Primitives

Negative Sign (_)


x - y Minus

Rank 0 0 -- operates on individual atoms of x and y, producing a result of the same shape -- WHY IS THIS IMPORTANT?


Subtracts the value of y from x

   0 1 2.2 3j4 4r5 66 - 2
_2 _1 0.2 1j4 _1.2 64

The verb Minus (-) differs from the noun decorator Negative Sign (_) e.g. as in  2 3 _5 7

The following subtracts the two-element vector 5 7 from the two-element vector 2 3 , returning a pair of negative values

   2 3 -5 7
_3 _4

Common Uses

Minus video

Subtraction per the rules of arithmetic.

   _9 _1 0 1 5 10 - _4 4 99 1 2 3
_5 _5 _99 0 3 7

Example with complex numbers: XjY - ZjW is (X-Z)j(Y-W) .

   5j5 1j1 1j1 _2j3 _4j_5 - 1j1 1 0j1 0j2 _10j_10
4j4 0j1 1 _2j1 6j5