Posts

Showing posts with the label ND distance

mathajax

Chebyshev distance between two points

Image
The java program finds distance between two points using chebyshev distance equation . The points can be a scalar or a vector . 1D distance metric It measures distance between two points by absolute difference between them. Each point has one element. 2-Dimensional distance metric It measures distance between two points (2D vector) by selecting maximum absolute difference on 2D vector element absolute difference. N-Dimensional distance metric It measures distance between two N-Dimensional vector by selecting maximum absolute difference on the two N-D vector element. Example Calculation on 2D vectors This is an example calculation shown below explain how to find the distance between two vectors using Chebyshev distance formula. A vector,array of elements declared and initialized in Java using one dimensional array. int A[] = { 2 ,6 }; // 2D vector A int B[] = { 4,1 }; // 2D vector B max - operators finds greatest val...

Metric - Minkowski distance between two points

Image
The java program finds distance between two points using minkowski distance equation . when power is set P=1, minkowski metric results as same as manhattan distance equation and when set P=2, minkowski metric results as same as euclidean distance equation. 1-Dimensional distance It measures the distance between two points . Each point lies on a line and has one element. 2-Dimensional distance It measures the distance between two points. Each point lies on 2D cartesian plane and has 2 elements. N-Dimensional distance It measures the distance between two points and each point has N elements. Example Calculation This is an example calculation shown below explain how to find the distance between two vectors using Minkowski distance formula . A vector,array of elements declared and initialized in java using one dimensional array. int A[] = { 5 ,3 }; // 2D vector A int B[] = { 2,1 }; // 2D vector B int P =3; P th ...

Metric - Manhattan Distance between two points

Image
The java program finds distance between two points using manhattan distance equation.  The points can be a scalar or vector and the passed to function as arguments can be integer or double datatype. 1D distance between two points It measures distance between two points on a line (1D) by absolute difference between them and the points are scalar value. Two points on 2D cartesian space It measures distance between two points on a plane. The points are vectors and each has two elements. The resulting distance equals sum of the difference of each element on the vectors . Two points on N-Dimensional cartesian space It measures d istance between two points or vectors on N-dimensional space . The points are vectors and each has N elements.The resulting distance equals sum of the difference of each element on the vectors. This is an example calculation shown below explain how to find the distance between two vectors using Manhat...