Languages
[Edit]
EN

JavaScript - Chebyshev Distance function

8 points
Created by:
Blythe-F
650

In this short article, we would like to show how to calculate Chebyshev Distance using JavaScript.

The universal distance formula is:

Where:

  • x and y are points in the space,
  • i is a number of dimensions.

The two-dimensional formula is:

The three-dimensional formula is:

    In simple words: Chebyshev Distance is the maximal positive distance between corresponding coordinates.

    Chebyshev Distance has applications in different fields, e.g. Artificial Intelligence.

     

    A practical example in 2D:

     

    More complicated examples

    Edit

    In this section, you can find Chebyshev Distance examples for 3D and 4D.

     

    See also

    Edit
    1. JavaScript - Rectilinear Distance function

    2. JavaScript - how to calculate distance between two points with Pythagorean equation?

    References

    Edit
    1. Chebyshev distance - Wikipedia

    Alternative titles

    1. JavaScript - Tchebychev distance function
    2. JavaScript - maximum metric function
    3. JavaScript - L infinity metric
    1
    Donate to Dirask
    Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
    Join to our subscribers to be up to date with content, news and offers.
    Native Advertising
    🚀
    Get your tech brand or product in front of software developers.
    For more information Contact us
    Dirask - we help you to
    solve coding problems.
    Ask question.

    ❤️💻 🙂

    Join