Skip to content

Math Package

Tom Tzook edited this page Sep 1, 2017 · 2 revisions

The math package provides advanced mathematical functionalities and utilities which are not provided by the java Math class. Those include math structures and algorithms which can be extremely useful for robotics solutions.

Mathf

Mathf is the main math class provided in the math package. It contains static math functions from several fields:

  • General math algorithms:
    • Pythagoras theorem
    • Nth root algorithm
    • Rounding to multipliers
    • Rounding decimal places
    • etc
  • Complex math
    • Complex root
    • Complex division
    • Discrete Fourier transform
    • etc
  • Matrices
    • Multiplying matrices
    • Rotation matrices
    • Transformation matrices
    • etc
  • Calculus
    • Derivatives
    • Integrals
    • etc
  • Vectors
    • Polar and Cartesian conversion
    • etc

Those are examples of the mathematical functionalities available in Mathf which are extremely useful.

Complex

Other than complex math contained in Mathf, the Complex class provides a wrapper for a complex number. It allows quick complex arithemetic and is very easy to use.

Vectors

Vector3 and Vector2 provide representations of 3 and 2 dimensional vectors in Cartesian space. They contain vector arithmetic functions including dot and vector products.

Mat

Mat class represents a matrix for a dynamic size. It contains basic matrix arithemetic including matrix multiplication.

Interpolation

FlashLib provides an abstract class for mathemetical interpolations and several implementations. It uses a map to store function data. Function data can be saved and loaded into XML files. There are several implementations available:

  • LinearInterpolation
  • NewtonPolynomial
  • LangragePolynomial

PolynomialInterpolation is an abstract extension of Interpolation and is used for polynomial interpolations. NewtonPolynomial and LagrangePolynomial extend it.