Skip to main content

Questions tagged [distance]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
95 views

How can I find distance from a point to a straight line by using projection of the point to the line?

I have a point A(1,2,3) and a line having parametric equation x = 1 + 2t, y = 3t, z = -4+6t. I want to find distance from ...
minhthien_2016's user avatar
5 votes
2 answers
82 views

Finding the closest interpreted point in GeoDistance

I'd like to know how far away I am standing from the path of totality for the 2024 solar eclipse. ...
bobthechemist's user avatar
1 vote
0 answers
54 views

SameTest for arrays of points

I need to gather arrays of points by some intuitive SameTest, so for some tolerance the next arrays will be treated as the same: Next code looks like suitable for ...
lesobrod's user avatar
  • 1,699
1 vote
0 answers
76 views

Finding how far an image has moved a very small x distance

I am trying to process 200+ images (10 datasets, each set contains ~20 images) and see how much each image changes or moves compared to a starting position for a dataset. The problem is, I expect a ...
atomic-muclei's user avatar
0 votes
0 answers
148 views

How to find the distance from this point to a straight line?

Clear["Global`*"] reg = ImplicitRegion[ x + k y == 0, {x, y}] pt = {-((a^2 k)/Sqrt[b^2 + a^2 k^2]), b^2/Sqrt[b^2 + a^2 k^2]} RegionDistance[reg, pt] Why ...
csn899's user avatar
  • 4,315
2 votes
2 answers
243 views

How to approximate the distance from {x,y} to a hyperbola?

I can get a good approximation, but making this into a MMA algorithm is getting complicated. Consider this example: ...
Ted Ersek's user avatar
  • 929
9 votes
5 answers
932 views

Find the farthest pairs of two points in 2-dim

I wonder if Mathematica can find the pairs of two points that are the farthest in a given list. Let's say a list, XYlist, of points with (x,y) coordinates. ...
Taiki Bessho's user avatar
1 vote
0 answers
44 views

Finding an optimal orientation and the oriented diameter of a given graph

I am wanting to specify a graph (a collection of vertices and edges) and find the optimal orientation of that graph. An orientation of an undirected graph is an assignment of a direction to its every ...
Emily's user avatar
  • 11
1 vote
2 answers
77 views

How to find the minimal and maximal polar angles covered by the following domain?

Consider some region in 3D space. Example is reg = Cylinder[{{0, 24, 14}, {0, 42.7, 14}}, 9] I want to find the minimal and maximal polar angle $\theta = \arccos\...
John Taylor's user avatar
  • 5,827
7 votes
4 answers
302 views

Numerically determining the minimum/maximum distance between two ellipses

The smaller ellipse is contained within the larger one. By 'minimum distance', I mean the distance that minimises; Sqrt[(y1 - y2)^2 + (x1 - x2)^2] By maximum, I ...
Joe.S's user avatar
  • 71
3 votes
2 answers
215 views

Intersection of a line and a circle and distance between them

i'm trying to plot the intersection point between a line and a circle but it's not working. How can I do that using the following command? ...
Sara's user avatar
  • 65
1 vote
0 answers
67 views

How to get the closest point from the known point to a fractal tree?

Given a known point, how to analytically find the nearest point from the point to the fractal tree? The fractal tree code: ...
kathy's user avatar
  • 11
4 votes
1 answer
288 views

Image distance between noisy and clean images

This is what I am trying to do: Download MNIST images: ...
sra's user avatar
  • 717
1 vote
0 answers
56 views

Clustering related entities using the data from Wikidata

This question starts from Creating a Graph of related entities with the data from Wikidata Compared to the previous question, I have defined a larger starting set, which I am going to enrich with ...
Revious's user avatar
  • 540
1 vote
1 answer
85 views

Find binary vector within fixed distance to reference vector that maximizes the number of distances to a set of vector that are below a threshold

Input: A binary reference vector $r$, a multi-set of binary vectors $S$, and a distance function d between binary vectors of equal length. Assume that $r$ and all vectors in $S$ have the same length. ...
B A's user avatar
  • 35
2 votes
1 answer
146 views

Minimize Sum of Hamming Distances

Problem: Given an $n \times m$ matrix with binary values $(0,1)$, find a binary vector that minimizes the sum of Hamming Distances to the rows. Example: If the matrix is {{$1,1,1$},{$0,0,0$},{$1,0,1$}}...
B A's user avatar
  • 35
3 votes
2 answers
115 views

Finding the consecutive distance of n-dimensional points with Mathematica

I want to create a list of (n-dimension, average of points) with 10,000 points per n-dimension. I can't figure out how to take the distance of consecutive points. Say in 2-dimensions, there are 3 ...
mmfranco's user avatar
3 votes
2 answers
459 views

Finding the length of a line constructed by coordinates

I have a list of coordinates, for example: ...
erez's user avatar
  • 317
0 votes
1 answer
108 views

How to find PlanarAngle[] across periodic boundaries?

Suppose we have a collection of points selected as being within a certain radius (0.1) of myCenterPoint: ...
TumbiSapichu's user avatar
  • 1,603
0 votes
1 answer
207 views

Efficient algorithm for Euclidean distance on a lattice [closed]

I am unable to code the problem in Mathematica. For the problem, please see the attached image. Help in this regard will be greatly appreciated. The statement of the problem is as follows: Consider a ...
user199's user avatar
  • 71
2 votes
1 answer
457 views

Earth Mover Distance/Wasserstein Distance Of Two Lists

I am in need of calculating the Earth Mover Distance between two one-dimensional discrete distributions with finite support (a.k.a "two lists of identical length whose entries add up to 1"). ...
Matthias's user avatar
  • 353
2 votes
1 answer
75 views

How to find the position of the closest part to a certain sentence in a large paragraph?

I have a large paragraph, the part of which is near to(not always equivalent to) one given sentence. Now I want to find the position of this part. For example, my paragraph is below (for convenience, ...
SHBooKP's user avatar
  • 370
0 votes
0 answers
35 views

Extracting GraphDistance out of SpatialGraphDistribution

I am trying to generate a graph which has Euclidean distances between the vertices. The documentation for SpatialGraphDistribution says that ...
Nitin's user avatar
  • 431
1 vote
0 answers
65 views

Accelerate the distance function of two point sets

I have two point sets point and impPoint. I want to calculate a distance function from each element in the ...
sidy's user avatar
  • 141
0 votes
0 answers
38 views

The smallest (and biggest) distance of points from the function

please give me an advice. I have points ("data", x and y coordinates). For these points, I created a residual function ...
Thera's user avatar
  • 41
2 votes
1 answer
226 views

How to find the minimum Hamming distance?

I have a vector $v = (9, 2, 3, 4, 8)$. Vector space over $\mathbb{Z}_{11}$ is generated by a set: $e_{1} = (4, 2, 0, 0, 1)$, $e_{2} = (1, 9, 0, 1, 0)$, $e_{3} = (5, 0, 1, 0, 0)$, $e_{4} = (0, 7, 0, 0,...
johnD's user avatar
  • 23
4 votes
1 answer
164 views

Why does MMA force a DistanceFunctions to be positive?

Consider the following piece of code: DistanceMatrix[Range[10], DistanceFunction -> Function[{x, y}, x - y]] I would have expected it to return a skew-symmetric ...
ITA's user avatar
  • 393
3 votes
1 answer
512 views

Distance between two points in a picture

I have this picture: I'de like to obtain the distance between two of these points. The black scale bar is 3$\mu m$. To do so, I import the image to Mathematica and call it pic. Then by finding ...
user avatar
5 votes
1 answer
111 views

Improving performace of `GeoDistance` and `NearestNeighborGraph`

I am trying to construct a NearestNeighborGraph of the 3143 US counties, using their latitude and longitude positions. ...
Pillsy's user avatar
  • 18.5k
1 vote
1 answer
159 views

Possible bug in RegionDistance with RegionBoundary?

Code as simple as it is: ...
SnzFor16Min's user avatar
  • 2,240
0 votes
0 answers
39 views

FindClusters Hamming Distance giving error

I am trying to run FindClusters[hex, DistanceFunction -> HammingDistance[IntegerDigits[#, 2, 8], IntegerDigits[0, 2, 8]] &] over a list of data but I keep ...
skyfire's user avatar
  • 477
0 votes
1 answer
114 views

How can I plot various points on a world map and compare distances?

How can I plot various points on a world map and compare distances? For example, the distance between Jerusalem and Westford, MA compared to the distance between Westford, MA and Recife, Brasil? Then ...
DeathPunch's user avatar
18 votes
4 answers
1k views

Find the equidistance curve between two curves

I have three function $f(x)=x^x$, $g(x)=\ln(x)^{\ln(x)}$, $h(x)=\ln(x)^2$ and I want to find (numerically) $C$ the center of the circle tangent to the three curves. I think that one way is to find ...
Domenico Modica's user avatar
0 votes
1 answer
74 views

Maximize a simple expression based on EuclideanDistance takes too long

Do you know if there is a mistake in this command syntax? It is very simple and still it takes too long. I cannot obtain any result at all: ...
Penelope Benenati's user avatar
2 votes
2 answers
165 views

Get 3D surface grown by constant distance

There is a nice example of how to generate an isometric visualisation of surfaces which are at a constant distance from a given region. All these examples are just working on one single region. If one ...
Rainer's user avatar
  • 2,911
20 votes
4 answers
805 views

Pathfinding on 2D regions

How can I find a shortest or near optimal route between two points where the route is constrained within a 2D region? First, consider the following bundle of lines: ...
flinty's user avatar
  • 25.5k
0 votes
0 answers
230 views

Total Variation Distance(between Gaussians)

I am interested in a tool that calculates the total variation distance between two multivariate Normal distributions. Any help will be much appreciated as I am a complete beginner.(So far, I have ...
cgss's user avatar
  • 101
1 vote
2 answers
229 views

How to find the shortest distance between two regions?

I need to find the shortest distance between the two regions and the two points of the shortest distance, but the following code cannot achieve this requirement: ...
A little mouse on the pampas's user avatar
2 votes
1 answer
230 views

For an enclosed surface region, how to find the furthest point on that surface to another point that is not on that surface?

I have an enclosed 3D surface (a distorted sphere surface region, which is got by finding an enclosed contour of a 3D volumetric data, and apply RegionBoundary[BoundaryDiscretizeGraphics[ ]] to get ...
Dennis's user avatar
  • 437
9 votes
4 answers
1k views

Find smallest distance from a point to a Bézier curve

I wish to find the smallest distance from a point to a curved defined via a Bézier function. I want to do this automatically. For particular cases it is not to difficult. Here is a minimum working ...
Hugh's user avatar
  • 16.5k
2 votes
0 answers
85 views

Display minimum distance and minimum-distance path between two points on a polyhedron

Given a genus-zero polyhedron (e.g., PolyhedronData["Dodecahedron"]) and a point $P$ anywhere on its surface, color all points on the polyhedron by the length of ...
David G. Stork's user avatar
5 votes
2 answers
936 views

Distance between a point and a curve

I have the general equation of an elipse and a point P0: elipse=0.31368-0.113863x-0.00127066x^2+0.00329003y+0.000817666xy+0.0000929297y^2 P0={-6.4,172.0} I would ...
Jane's user avatar
  • 51
6 votes
1 answer
68 views

Force two distance matrices to use and show a common legend

I have two distance matrices. Both are comparing two entities in the same way. I create each matrix using ...
brienna's user avatar
  • 1,071
4 votes
1 answer
230 views

Distance between two cities

I need help calculating the distance between 2 cities in Wolfram MAthematica. I would need to create two drop-down lists of European capitals. After selecting any two cities from the lists, I would ...
Thera's user avatar
  • 41
6 votes
1 answer
161 views

How to TextRecognize sparse grid of tabular data?

I cannot give the actual image (contains private information) but the results of ...
Edmund's user avatar
  • 42.3k
5 votes
2 answers
113 views

Breaking a Kinked line into $(n-1)$ segments of equal Euclidean distance?

I'm wondering if anyone has a nice solution for breaking a kinked line into $(n-1)$ segments of equal euclidean distance? Here is a MWE of my attempt. I think it does the job, and I'm sure the code ...
user106860's user avatar
1 vote
2 answers
107 views

How to change color of DistanceTransform image?

I want to overlay a set of points onto a distance transform of them. But, I don't really like the black default color of the distance transform. Is there a way to change this? Given the points ...
TumbiSapichu's user avatar
  • 1,603
0 votes
1 answer
502 views

Calculating the distance between two points and get direction [closed]

I am programming a molecular dynamics program with periodic boundary conditions. Here, I have a problem: I have a list of coordinates like ...
Armani42's user avatar
10 votes
2 answers
728 views

Distance measures on a map of a game

I have an image which my DM made of map for a DND game and I want to do two things. Click on two points on my map, then based on the key for scaling have Mathematica tell me how far apart those ...
Wombles's user avatar
  • 792
4 votes
2 answers
778 views

Find the smallest and largest distance between two points distributed in 3D space

Suppose I have some 3D points, e.g. {{0, 0, 1}, {0, 0, 1.3}, {0, 1, 0}, {1.2, 0, 0}}. Now I want to find the smallest and largest distance between two points. A ...
Schrodinger's user avatar