# Math.Matthey 2.3.1

A collection of mathematical function and data structures written in C#.
Numerical comparison, vector geometry, polynomial, root solver, statistics, GPS and clustering, and abstract bitmap and draw functions.

Install-Package Math.Matthey -Version 2.3.1
dotnet add package Math.Matthey --version 2.3.1

## Math

A collection of mathematical function and data structures written in C#.

(c) 2016-2019 T. Matthey - MIT license

#### Base

• Floating point comparison and epsilon
• Conversion radian-degree, date time to seconds

#### Solver

• Analytical solution of linear, quadratic, cubic and quartic polynomial equations
• Numerical general polynomial equation root solver
• General root solver with either bisection or secant method
• First and second order regression with optional weight

#### Functions

• Qudratic root
• Cubic root
• Quartic root
• Fast sin evaluation [-PI/2, -PI/2]
• Normalize angle
• Nomerical stable sin-cos evaluation
• Factorial; ulong (n <= 20) and double
• Fibonacci; ulong (n <= 93), double and Binet
• Greatest common divisor (GDC)
• IsPrime; no cache; ~3s for max long / 10

#### Statistics

• Arithmetic mean and variance, optional weighted
• Averageing / mean of angles
• Centered moving averageing, optional weighted

#### Geometry

• Convex hull 2D (Jarvis march & Andrew's monotone chain; point reduction algorithm)
• Minimal bounding circle 2D
• Minimal bounding circle on sphere 3D
• Perpendicular (segment / line ) distance (2D & 3D)
• Trajectory Hausdorff Distance (2D & 3D)
• Filter of significant points based on Minimum Description Length Principle (2D & 3D)
• k-d tree search for vector & segment (2D & 3D)

#### Data structures

• BoundingBox
• BoundingRect
• Circle2D
• Circle3D
• CubicBezier2D
• CubicBezier3D
• Color
• Polar3D
• Polynomial
• Division by real roots (linear root), and imaginary and conjugated (quadratic root)
• Evaluation of polynomial and its derivative and integral
• Segment2D
• Segment3D
• Sparse array
• Vector2D
• Vector3D

#### GPS

• GpsPoint
• GpsTrack
• Flatten to local 2D; single object and collection
• Smoothing of holes (missing GPS signal, same position) by reducing variance
• Geodesy
• Haversine distance
• GridLookup / NeighbourDistanceCalculator : Finding neighbors of two GPS tracks in O(N)
• Intersection / overlapping (overestimating) of two GPS tracks
• grid / lookup table based - fastest and pretty precise depending on given resolution
• minimal rectangular bounding box
• minimal circle on sphere - slow on 1st call to calculate min circle

#### Clustering

• DBScan vector / segment for 2D / 3D
• TraClus (Trajectory Clustering: A Partition-and-Group Framework) for 2D and 3D
• Finding trajectory neighborhoods for 2D and 3D
• GPS segment clustering; finding common segments for locally collocated GPS tracks or globally

#### Gfx

• PNG, PPM and PGM bitmap writer
• Simple bitmap
• RGB color bitmap
• Line draw - Bresenham and anti-aliasing (Xiaolin Wu's line algorithm)
• Point plot (anti-aliasing)
• Heatmap for arbitrary set of GPS tracks with color schemes

## Math

A collection of mathematical function and data structures written in C#.

(c) 2016-2019 T. Matthey - MIT license

#### Base

• Floating point comparison and epsilon
• Conversion radian-degree, date time to seconds

#### Solver

• Analytical solution of linear, quadratic, cubic and quartic polynomial equations
• Numerical general polynomial equation root solver
• General root solver with either bisection or secant method
• First and second order regression with optional weight

#### Functions

• Qudratic root
• Cubic root
• Quartic root
• Fast sin evaluation [-PI/2, -PI/2]
• Normalize angle
• Nomerical stable sin-cos evaluation
• Factorial; ulong (n <= 20) and double
• Fibonacci; ulong (n <= 93), double and Binet
• Greatest common divisor (GDC)
• IsPrime; no cache; ~3s for max long / 10

#### Statistics

• Arithmetic mean and variance, optional weighted
• Averageing / mean of angles
• Centered moving averageing, optional weighted

#### Geometry

• Convex hull 2D (Jarvis march & Andrew's monotone chain; point reduction algorithm)
• Minimal bounding circle 2D
• Minimal bounding circle on sphere 3D
• Perpendicular (segment / line ) distance (2D & 3D)
• Trajectory Hausdorff Distance (2D & 3D)
• Filter of significant points based on Minimum Description Length Principle (2D & 3D)
• k-d tree search for vector & segment (2D & 3D)

#### Data structures

• BoundingBox
• BoundingRect
• Circle2D
• Circle3D
• CubicBezier2D
• CubicBezier3D
• Color
• Polar3D
• Polynomial
• Division by real roots (linear root), and imaginary and conjugated (quadratic root)
• Evaluation of polynomial and its derivative and integral
• Segment2D
• Segment3D
• Sparse array
• Vector2D
• Vector3D

#### GPS

• GpsPoint
• GpsTrack
• Flatten to local 2D; single object and collection
• Smoothing of holes (missing GPS signal, same position) by reducing variance
• Geodesy
• Haversine distance
• GridLookup / NeighbourDistanceCalculator : Finding neighbors of two GPS tracks in O(N)
• Intersection / overlapping (overestimating) of two GPS tracks
• grid / lookup table based - fastest and pretty precise depending on given resolution
• minimal rectangular bounding box
• minimal circle on sphere - slow on 1st call to calculate min circle

#### Clustering

• DBScan vector / segment for 2D / 3D
• TraClus (Trajectory Clustering: A Partition-and-Group Framework) for 2D and 3D
• Finding trajectory neighborhoods for 2D and 3D
• GPS segment clustering; finding common segments for locally collocated GPS tracks or globally

#### Gfx

• PNG, PPM and PGM bitmap writer
• Simple bitmap
• RGB color bitmap
• Line draw - Bresenham and anti-aliasing (Xiaolin Wu's line algorithm)
• Point plot (anti-aliasing)
• Heatmap for arbitrary set of GPS tracks with color schemes

## Release Notes

Fixed Bezier Curve length

## Version History

2.3.1 48 3/31/2019
2.3.0 35 3/30/2019
2.2.2 190 9/24/2018
2.2.1 98 9/24/2018
2.2.0 158 7/22/2018
2.1.0 305 12/29/2017
2.0.0 328 8/5/2017
1.0.6 379 11/30/2016