Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [distance]

The tag has no usage guidance.

3
votes
1answer
63 views

How to compute distance between movable items in the screen?

I want to design a box in which I can move a set of items. Specifically, there should be N items (e.g. little balls with numbers inside). Items can be arranged with the mouse inside a box, and, in ...
13
votes
3answers
323 views

Is there a built-in function I can use to measure the similarity of two trees?

This is a higher level question, and I don't expect a full answer, but maybe a nudge in the right direction would help, or maybe there is a built in Mathematica function that does something very ...
5
votes
1answer
74 views

How do I plot a distance map in $R^2$ to a curve given in form $y=f(x)$?

As in the title, I'd like to display image using DensityPlot representing distance to a given curve, e.g., $y=x^2$. I find it difficult to derive distance ...
7
votes
2answers
275 views

Find distance along a path (GPS coordinates)

I have an imported version of a GPX file plotting the route of a trail. I also have a list of coordinates for waypoints along the route. I am trying to calculate how far along the route each ...
3
votes
0answers
68 views

Finding the shortest distance of two points and an area

So I have a region defined by something like MeshRegion[{{0, 0}, {1, 1}, {2, 1/2}, {2, -1/2}}, {Line[{1, 2}], Line[{2, 3}], Line[{3, 4}], Line[{4, 1}]}], and two ...
10
votes
2answers
165 views

How to return the coordinates of the respective 3 vertexes of a DelaunayMesh's face?

I have a set of points pts1 and a point redPts as below:- ...
3
votes
1answer
63 views

How to get the coordinates of the closest point along a line?

I have a plot as below (the plot is just for illustration purpose. in my real problem, I just have pts1):- ...
2
votes
0answers
106 views

How to speed up DistanceMatrix?

I need to compute a fast DistanceMatrix (euclidean distance) of a large vector. Let say x = Table[Sin[t],{t,1,10000}] But pre defined function Distancematrix[x] ...
3
votes
2answers
162 views

How to calculate the distance that from the pixel to image edges

I have such image: It is a binary image, I mean the pixel value is 0 or 1, but now, I hope to replace every pixel value with ...
1
vote
3answers
111 views

Find the value of parameter for the closest point on a curve

I can find the nearest point to {x0,y0} on a curve fast and easy by replacing the curve {x[t],y[t]} with line segments: ...
3
votes
2answers
131 views

Negative Correlation Distance

Bug introduced in 8.0 or earlier and fixed in 11.2.0 CorrelationDistance[{-53.0, 4.3}, {-23.0, 5.4}] is a negative number. It is close to zero, to be sure, but ...
2
votes
1answer
102 views

How to measure distance exactly from a graph?

Is there any way to measure a distance from a graph in centimeter or inch exactly in Mathematica? I tried to use toolbar Ruler but I can only use it to measure width horizontally and can't switch it ...
3
votes
0answers
96 views

Getting Distances from Nearest Function [closed]

I am fairly new to mathematica. I am trying to find a way to mock python's KDTree.query function in mathematica. Basically I have 9 vectors (each length two). I want to know the three closest vectors ...
0
votes
1answer
117 views

use of GeoDistance on WGS84 spheroid

The reference WGS84 describes the Earth as oblate spheroid with semi-minor axis (radius to poles) of 6356.752 km and semi-major axis (radius to equator) of 6378.137 km. I am considering the distance ...
2
votes
1answer
87 views

How can I subtract the components of these 2 solutions if the components are interpolating functions?

I have solved for solutions of the Lorentz system but for some reason Mathematica spit out InterpolatingFunction[] as components. Input 1: ...
1
vote
1answer
68 views

A measure of disconnectedness for points in the plane

I am inexperienced with Mathematica, so I apologize if I advertise my ignorance. I am trying to write a code that will assign a measure of 'disconnectedness' to a finite set $S$ of points in the ...
1
vote
2answers
104 views

Region and Infinite Line Intersection does not yield correct results with Maximize

I have a list of points pixelvaluepos that I can use to convert to a BoundaryMeshRegion. I also happen to know the centroid <...
3
votes
0answers
94 views

Delaunay link distance

I have a Delaunay mesh region. To start with, I give a simple example here: pts = RandomReal[{-1, 1}, {50, 2}]; R = DelaunayMesh[pts]; The next step I want to do ...
1
vote
2answers
107 views

Finding points outside of a disk

Here I have a list of points on the plane: lst = RandomReal[{-5, 5}, {55, 2}]; and a disk with the radius r=1 drawn around ...
0
votes
1answer
119 views

Generating matrix of distances between points in cylindrical coordinates

I am working on an analytical model for the sound intensity generated from a vibrating cylinder. Part of this work requires me to split the cylinder up into a number of elements, with the more ...
1
vote
1answer
268 views

Shortest distance path on contour plot

I have a contour plot made of the following list: ...
6
votes
2answers
668 views

Good way to create a similarity / distance matrix for a large dataset [duplicate]

I have a large dataset with rows (100k+) for products and columns for features. Now I want to create a similarity matrix with NormalizedSquaredEuclideanDistance. ...
0
votes
1answer
55 views

min distance in a graph

How would I find the min distance between two vertices in a graph. What function should I use? For example, in the above, $d(2,4)=2$ and $d(2,3)=1$
17
votes
2answers
4k views

What is the closest star to Earth other than the sun?

How to find the Sun's nearest neighbor star using Mathematica? I tried but it didn't work
4
votes
3answers
463 views

Remove 2D points where nearest neighbor exceeds certain distance

I have the following 2D points: ...
5
votes
3answers
411 views

Mean distance beween nearest 2 coordinates

I have as an example the following 2d-coordinates: ...
16
votes
1answer
697 views

Is ColorDistance symmetric?

Is the function ColorDistance symmetric, i.e. is it always true that ColorDistance[a,b] == ColorDistance[b,a], as use of the ...
7
votes
1answer
144 views

Challenging matrix sorting request?

I have an application in mind, and I need to do the following analysis, but am having a high degree of difficulty conceptualizing it in terms of syntax. I understand what I want, but cannot seem to ...
3
votes
1answer
134 views

FindShortestTour 3D data

I would like to plot a line in 3D with the following set of (x,y,z) data points: ...
1
vote
2answers
126 views

Discrete Measure between Binary Vectors

I would like a discrete distance measure between two binary vectors (or strings). Like HammingDistance but I want the vectors to be considered closer if they have ...
4
votes
0answers
299 views

How to make distance transform invariant to scale?

I am trying to use a distance transform as a descriptor to encode silhouettes in order to do a shape recognition task. It is clear that distance transform distribution is invariant under rotation and ...
2
votes
1answer
675 views

Mahalanobis distance between two vectors

I want to calculate the Mahalanobis distance between two vectors that represent two points. For example: ...
4
votes
3answers
733 views

Find nearest distance of an interior point from perimeter

By definition, the interior point is a point inside an arbitrary region like this: In picture above, $y$ is an interior point of region. My question is how to find the distance of an interior point ...
11
votes
2answers
518 views

How to get the distance of Jupiter from the sun?

I am aware of the command AstronomicalData["Jupiter", "Distance"] from which I can get the distance between the earth and Jupiter. Is there any way to use ...
5
votes
1answer
417 views

What algorithm and tools should I use to search a data set for the point nearest to a given point?

I have about 1,000,000,000 points, which are the longitudes and latitudes of some places in a city, formatted like this: $(106.1231233,41.43234234)$. I also have about 20,000 points which are the ...
2
votes
4answers
245 views

Find time since last 0 in list

When I have a list of data (measured per day), is it possible to define a function that gives the nr of days since the data has been 0? I tried working withPosition...
12
votes
5answers
3k views

How do I find the Euclidean distance between one point and all the points in a list?

I want to find the Euclidean distance between one point (x1) and a list of points (y1), which contains a lot of coordinates x1 = killer[[2]] {6.05102, 5.87667} ...