All Questions
Tagged with euclidean-distance math
29
questions
27
votes
2
answers
38k
views
Is "norm" equivalent to "Euclidean distance"?
I am not sure whether "norm" and "Euclidean distance" mean the same thing. Please could you help me with this distinction.
I have an n by m array a, where m > 3. I want to calculate the Eculidean ...
19
votes
3
answers
30k
views
Calculate Euclidean distance between 4-dimensional vectors
Let's say I have two 4-dimensional vectors (i.e. a and b) as follows:
a = {a1, a2, a3, a4}
b= {b1, b2, b3, b4}
How do I compute the Euclidean distance between these vectors?
14
votes
5
answers
21k
views
Fastest way to calculate the distance between two CGPoints?
Distance between two points:
sqrt((x1-x2)^2 + (y1-y2)^2)
Is there a way to do this math faster in objective-C ?
EDIT: I think I need to clarify above. I wrote the formula above just to clarify what ...
11
votes
5
answers
6k
views
What is the most efficient way to find the euclidean distance in 3d using mysql?
I have a MySQL table with thousands of data points stored in 3 columns R, G, B. how can I find which data point is closest to a given point (a,b,c) using Euclidean distance?
I'm saving RGB values of ...
6
votes
2
answers
1k
views
Matlab formula optimization: Radial Basis Function
z - matrix of doubles, size Nx2;
x - matrix of doubles, size Nx2;
sup = x(i, :);
phi(1, i) = {@(z) exp(-g * sum((z - sup(ones([size(z, 1) 1]),:)) .^ 2, 2))};
this is a Radial Basis Function (RBF) ...
4
votes
4
answers
3k
views
Faster way to compare two sets of points in N-dimensional space?
List1 contains a high number (~7^10) of N-dimensional points (N <=10), List2 contains the same or fewer number of N-dimensional points (N <=10).
My task is this: I want to check which point in ...
3
votes
2
answers
131
views
Generate P random N-dimensional points from list of ALL possible pairwise distances
I would like to generate random N-dimensional points with the constraint of having precise Euclidean distances (known) between each other.
Number of points P = 100
Number of dimensions of the ...
3
votes
1
answer
6k
views
Calculate overlap between two rectangles on x/y grid?
I need to calculate the overlap (amount or yes/no) that two rectangles make on a special x/y grid. The grid is 500x500 but the sides and corners connect (are continuous). So the next point after 499 ...
3
votes
1
answer
2k
views
How to calculate weighted similarity with scipy.spatial.distance.cosine?
From the function definition:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cosine.html
scipy.spatial.distance.cosine(u, v, w=None)
but my codes got some errors:
from ...
3
votes
2
answers
1k
views
squared-euclidean distance with RealVectors in Apache Commons Math
I'm using Apache Commons RealVector and ArrayRealVector classes in Java. I can calculate the euclidean distance between two vectors v1 and v2 as
double dist = v1.getDistance(v2);
However, I'm ...
2
votes
1
answer
251
views
Euclidian Distance math error
import math
from math import sqrt
Hailey=[0,4,1,4,0,0,4,1]
Verica=[3,0,0,5,4,2.5,3,0]
temp=[]
distance=0
x=0
for i in range(0,len(Hailey)):
if (Hailey[i]!=0 and Verica[i]!=0):
temp[x]=...
2
votes
1
answer
172
views
Calculate distances between a line and all points on an intersecting plane in r
I have a regular, rectangular grid of x, y, z values (an image).
I also have an x, y, z line that intersects the grid.
For each plane (z-level) in the grid, I want to compute the Euclidean distance ...
1
vote
2
answers
6k
views
What is negative squared euclidean distance?
It is described as -||xi-xy||^2.
So for 2 two dimensional points do I code it like this?
- ((x1-x2) + (y1-y2))^2
or
-( (x1-x2)^2 + (y1-y2)^2 )
or
-(sqrt( (x1-x2)^2 + (y1-y2)^2 ))
or some ...
1
vote
1
answer
965
views
Given lengths of 3 sides of a triangle, compute an average distance between the middle points of the sides
I have come across a problem. The problem statement is
A team of 3 people, is going to participate in a competition. According to the regulations of this competition, every team is given a single ...
1
vote
2
answers
189
views
Vector deltas and moving in unknown areas
I was in need of a little math help that I can't seem to find the answer to, any links to documentation would be greatly appreciated.
Heres my situation, I have no idea where I am in this maze, but I ...
1
vote
2
answers
3k
views
Finding maximum/minimum distance of two rows in a matrix using MATLAB
Say we have a matrix m x n where the number of rows of the matrix is very big. If we assume each row is a vector, then how could one find the maximum/minimum distance between vectors in this matrix?
1
vote
1
answer
34
views
Determine the next point 2D after some distance from initial point
Hi I'm creating a simple program to create create lines.
When the user is drawing a line, first he needs to draw the first point
*ignore '5cm' information for above image
The second point (mouse ...
1
vote
3
answers
5k
views
3D Trilateration using given distances of unknown fixed points
I am new to this forum and not a native english speaker, so please be nice! :)
Here is the challenge I face at the moment:
I want to calculate the (approximate) relative coordinates of yet unknown ...
1
vote
2
answers
736
views
How to express Euclidean distance in two dimension instead of one?
I have two variables containing an array of 300-dimensional vectors called a and b. Of which the minimal value is -10.0 and the max value is 10.0 per vector value.
My goal is to visualize the ...
0
votes
1
answer
3k
views
Calculating the distance between two squares on a grid - Java
I am creating a game in Java and have a grid of squares that make up the playable area. The player has certain targets and I need to work out how far away the player is from those targets using the x ...
0
votes
4
answers
4k
views
Determine Point Coordinates In 3D
I have a line that exists in 3D that is between two known points: {X1, Y1, Z1} and {X2, Y2, Z2}.
(X1,Y1,X1)----------(X2,Y2,Z2)
There is a point (Xd,Yd,Zd) on the line between those points at ...
0
votes
2
answers
149
views
Decimal representation in python
When given input Iam getting result like 1.0 but I need it to be 1.000000000000
How should I modify within hypot??
small=1000000000
from math import hypot
def pairwise(iterable):
a, b = iter(...
0
votes
2
answers
77
views
Total Euclidian length of a vector
Given a set of vectors points, what is an efficient way of computing total Euclidian length (sum of Euclidian thenthes between all points). I think about:
from scipy.spatial.distance import cdist
...
0
votes
1
answer
582
views
Proper similarity measure for clustering
I have problems in finding a proper similarity measure for clustering. I have around 3000 arrays of sets, where each set contains features of certain domain (e.g., number, color, days, alphabets, etc)....
0
votes
2
answers
51
views
define multi-dimensional object of a given volume
this question is in theoretical math perspective.
In the space S = [-1, 1]^d, given a volume V, can I always define object in S with exactly this volume? also - can I surround any x in S with an ...
0
votes
0
answers
2k
views
How to convert Euclidean Distance to a percentage confidence?
I have an application doing facial recognition which uses euclidean distance to compare encoded numpy arrays of faces. The algorithm outputs the distance between the two face images as a float value.
...
0
votes
2
answers
3k
views
Calculating the geographic and euclidean distances for TSP in Java
Basically I'm using data from TSPLIB and I have this spec .
This is how I calculated the Euclidean distance (according to the above spec):
public static double calculateDistance(double x1, double y1, ...
-1
votes
1
answer
202
views
How to calculate distance from a player to a dynamic collision point
I'm trying to create sensors for a car to keep track of the distances from the car to the borders of the track. My goal is to have 5 sensors (see image below) and use them to train a machine learning ...
-1
votes
2
answers
3k
views
How to calculate distance between several points simultaneously with Euclidean Distance
I know how to get distance between points, however I want to get distance between 2 objects where each object has several points. (See illustration below.)
I want to calculate distance between ...