+-×÷*⍟⌹○#

Arithmetic +-×÷#

Dyadic +-×÷ are what you expect from mathematics:

3+8
4×12
144×11
3-7
11
48
1584
¯4

0÷0 is 1 by default, but you can make all n÷0 into 0 by setting ⎕DIV←1:

0÷0
1
⎕DIV1
0÷0
⎕DIV0       ⍝ default setting
0

Reciprocal ÷A#

Question:

How can we make 0÷0 throw an error?

Multiply with the reciprocal:

0×÷0        ⍝ DOMAIN ERROR: Divide by zero 
DOMAIN ERROR: Divide by zero
      0×÷0        ⍝ DOMAIN ERROR: Divide by zero
        ∧

Monadic ÷ is the reciprocal, i.e. ÷x is 1÷x.

Direction ×A#

Monadic × is direction, i.e. a complex number which has magnitude 1 but same angle as the argument. For real numbers this means signum (sign).

÷5          ⍝ reciprocal: 1÷5
×12 ¯33 0   ⍝ signum
×32j¯24     ⍝ direction
0.2
1 ¯1 0
0.8J¯0.6

Power *#

Dyadic * is power, and the default left argument (i.e. for the monadic form) is e. So, monadic * is e-to-the-power-of.

2*10        ⍝ ⍺ to the power of ⍵
*1          ⍝ e to the power of ⍵
1024
2.718281828

Log #

The inverse of * is ; logarithm. The monadic form is the natural logarithm and the dyadic is left-arg logarithm, so 10⍟n is log(n):

1010000000   ⍝ log(10000000)
7

Matrix divide #

is matrix division. Give it a coefficients’ matrix on the right and it will invert the matrix. If you also put a vector on the left and it will solve your system of equations. If over-determined, it will give you the least squares fit.

For example, in order to solve the following set of simultaneous equations,

\(\begin{array}{lcl} 3x + 2y & = & 13 \\ x - y & = & 1 \end{array}\)

we can use like so:

13 1  2 23 2 1 ¯1
3 2

Circular #

Monadic multiplies by π:

2          ⍝ 2 times π
6.283185307

Dyadic is circular. It uses an integer left argument to select which trigonometric function to apply. The most common ones are 1, 2 and 3, which are sin, cos and tan. The negative versions ¯1, ¯2 and ¯3 are arcsin, arccos and arctan.

1○○1        ⍝ sin π
2○○1        ⍝ cos π
¯22○○1     ⍝ arccos cos π
1.224646799E¯16
¯1
3.141592654

The entire list of ’s left arguments is here.