My personal cheatsheet for mathematics concepts.

- statistical significance:
  Result of a measurement is stat. sig. if the probability
  of making mistake is lower than some set value (typically 5%, but depends).

  E.g.:
  hypothesis: Men are smarter than women.
  null hypothesis: Men and women are equally smart.
  We want to prove it by measuring IQ difference between men and women.

  1. alpha := 5%      // set significance level
  2. V := measure()   // measure the IQ difference (V)
  3. p(V) := probability of measuring V if null hypothesis was true
  4. if P(V) < alpha, the result is stat. sig., otherwise not

- quaternion:
  Generalization of complex numbers to 4 (not 3) dimensions, good for 3D
  rotations. Advantages over Euler angles: avoid ambiguity (which axes represent
  yaw/pitch/roll?), no Gimbal lock, better interpolation, more efficient.
  A quaternion  is a quadruple

    a + b*j + c*k + d*l
    |   \_____________/
  scalar  vector part
   part

  where a, b, c and d are real numbers and j, k, l are units such that

    i^2 = j^2 = k^2 = i*j*k = -1

  Only unit quaternions (a^2 + b^2 + c^2 + d^2 = 1) represent rotations.

  Vector quaternions (a = 0) represent points in 3D space we're rotating.

  Quaternion negation (q^-1) is obtained by multiplaying the vector part by -1.

  Quaternion multiplication is associative but NOT COMMUTATIVE (a*b != b*a).

  Rotating a point p by quaternion q is done as:
    (q^-1) * (0,p_x,p_y,p_z) * q

  Conversions:

    axis (v) + angle (a) -> quaternion (q):
      q = cos(a/2) + sin(a/2) * (v.x * j + v.y * k + v.z * l)

    euler angles (ypr) -> quaternion (q):
      A = cos(y/2)      D = sin(p/2)                
      B = sin(y/2)      E = cos(r/2)
      C = cos(p/2)      F = sin(r/2)

      q =  E*C*A + F*D*B +
          (F*C*A - E*D*B) * j +
          (E*D*A + F*C*B) * k +
          (E*C*B - F*D*A) * l

    quaternion (q) -> rotation matrix (m):
      ...

- abstract algebra: sets with operations

  - group: captures symmetry

      (S,+) where

      S is a set where
        a) a single IDENTITY ELELEMNT (0) exists, such that: a + 0 = a
        b) any element a has a single INVERSE ELEMENT -a such that: a + -a = 0

      + is a binary operation on S which is associative, i.e.
        a + (b + c) = (a + b) + c
        
    examples:
      1. 2D rotations form a group
      2. integers with + operation form a group (0 is identity)
      3. rational numbers with * operation form a group (1 is identity)
      4. transformations of Rubik's cube form a group

    - Abelian group: group that is also commutative (a + b = b + a)
    - Lie group: A "continuous/smooth group", elements are elements described by
      real numbers (so they have infinite number of elements), e.g. a group of
      2D rotations. They are differentiable (allow to do calculus).

  - field: structure that "behaves" like rational/real numbers

      (S,+,*) where

      S is a set, + is a binary operation, * is a binary operation, and the
      following hold:

      a) + and * are associative: a +/* (b +/* c) = (a +/* b) +/* c
      b) + and * are commutative: a + b = b + a, a * b = b * a
      c) additive (0) and multiplicative (1) identity elements exist
      d) additive inverse exists for any element a: a + -a = 0
      e) multiplicative inverse exists for any element a != 0: a * a^-1 = 1
      f) * over + is distributive: a * (b + c) = a * b + a * c

