Monday, November 15, 2021

[bawayqbd] binary functions

some common functions taking two arguments, sometimes expressed as infix operators:

addition subtraction multiplication division exponentiation

mod (remainder)

atan2, x^2+y^2, sqrt(x^2+y^2)

create a complex number from real and imaginary components

or, from polar components

arithmetic, geometric, harmonic means of 2 numbers

arithmetic-geometric mean (AGM)

b^2-4c (monic quadratic discriminant)

nth root

(log a)/(log b)

and or xor nand nor xnor

gcd lcm

binomial coefficient (n choose k)

Legendre symbol, Jacobi symbol

multiplicative inverse in GF(p) finite field.  this requires p to be prime.

comparison operators

minimum or maximum of two numbers

append an item to the beginning of a list.  or end.

join two binary trees.  more generally, combine two container data structures.  even more generally, a magma in abstract algebra.

symmetric encryption, decryption (without nonce or initialization vector): arguments are key and plaintext or ciphertext.

keyed hash function (message authentication code (MAC)): arguments are key and message.

distance between two points.

vectors: dot product, cross product, angle between.

any noncommutative function above with arguments flipped

motivation: when designing a programming language, it is important to support binary functions, for example, right sections.

No comments :