Questions tagged [euclidean-distance]

the Euclidean distance or Euclidean metric is the "ordinary" distance between two points that one would measure with a ruler, and is given by the Pythagorean formula.

In mathematics, the Euclidean distance or Euclidean metric is the "ordinary" distance between two points that one would measure with a ruler, and is given by the Pythagorean formula. By using this formula as distance, Euclidean space (or even any inner product space) becomes a metric space. The associated norm is called the Euclidean norm.

http://en.wikipedia.org/wiki/Euclidean_distance

941 questions
0
votes
1 answer

Defining euclidean function distance using graphics package only

from graphics import* def distance(pt1,pt2): pt1=Point(x,y) pt2=Point(x1,y1) sqrt((x-x1) ** 2 + (y-y1) ** 2) return distance distance((100,50),(45,30)) This is the error I'm getting File "/Users/tigersoprano/Documents/test.py", line…
0
votes
1 answer

calculating euclidean distance of 2 byte arrays java

I have 2 main images and I want to compare a set of other images to them. What I do is computing the byte array of those two images and then compare those 2 with the current image being processed. This are the 2 main images: File upper = new…
user3540466
  • 303
  • 1
  • 2
  • 13
0
votes
1 answer

Calculating distance between two elements only in the array in python

So I have two questions: First I'm trying to print my array that contains 1004 elements but it's printing only the first 29 elements and then jumping to 974 to continue printing. How can I get the full array of 1004 elements? This is my…
Micheal
  • 17
  • 1
  • 7
0
votes
1 answer

Measuring the distance between two relative frequency vectors

I am having a problem in choosing a adequate distance function to measure the similarity (dissimilarity) between two relative frequency vectors. More specifically, I am using shape feature vectors that contain data about the basic shapes (circle,…
peterS
  • 71
  • 1
  • 2
  • 6
0
votes
1 answer

Euclidean distance when similar features are slightly shifted

Let us say I want to find a similar vector for a vector a = [0 0 2 0 0 0 0 0 0] I have two candidates: b1 = [0 0 0 2 0 0 0 0 0], where the "feature" is just 1 position away b2 = [0 0 0 0 0 0 0 2 0], where the "feature" is 5 positions…
iloo
  • 926
  • 12
  • 26
0
votes
1 answer

Matlab: How to efficiently compute distances

I have a matrix X of dimension r = 2 rows and col = 20000 columns and I want to compute the square root of the sum of squared distances = Euclidean distance between pair of points. For ex: Let, X = 1 2 3 4 5 6 7 8 Dist1 =…
SKM
  • 959
  • 2
  • 19
  • 45
0
votes
0 answers

Convert a .csv distance data file to nexus (.nex) file

I have a pairwise distance matrix in .csv format which I wish to convert to nexus (.nex) format for analysing the data dn building trees in software that require input files in .nex format. I looked up some questions on this forum but did not get a…
Anurag Mishra
  • 1,007
  • 6
  • 16
  • 23
0
votes
2 answers

Calculate Euclidean distance for each item in a list

I'm using Pillow with Python 3.3, and for each image I have, I want to analyse all pixels colors and calculate if each color is nearest to white or to black. I've tried with Euclidean distance with this formula: >>>a,b=(127,255) #color value of…
0
votes
1 answer

Movement of clusters over time

I am trying to do a cluster analysis, based on the transactional data for a financial product, and try and measure their movement over time. I have my static cluster ready (based on the transactions in first quarter). Now I want to see their…
0
votes
1 answer

Creating a structure point and then calculating distance between two points

I need some help figuring how do i create a structure point. I need two fields x and y then I want to create a function that calculates the distance between these two points. What I have right now is: function [ out ] = pointDist3( pointpair1,…
Venom
  • 27
  • 7
0
votes
1 answer

MATLAB calculating distances in a loop

I'm loading a .csv file to do a few calculations in matlab. The file itself has ~1600 lines, but I'm interested in only a subset. load file.csv; %load file for i = 400:1200 %rows I am interested in rh_x= file(i,60); % columns interested, in…
user3295674
  • 893
  • 5
  • 19
  • 42
0
votes
1 answer

R - How to speed up Euclidean distance calculation on a very large dataset

community, I have a very large dataset containing 3 columns with coordinates (x, y, z) and 24 x 10^6 rows. I need to calculate the euclidean distance between all rows and the first row which is 0, 0, 0. With the loop below this takes a very long…
Niels Raes
  • 51
  • 1
  • 7
0
votes
2 answers

Declare and define the function distance() to find the Euclidean distance between the two points (x[0], y[0]) and (x[1], y[1]) in c

Declare and define the function distance() to find the Euclidean distance : √((x1 - x2)² + (y1 - y2)²) between the two points (x[0], y[0]) and (x[1], y[1]) This function should just calculate and return the answer. C PROGRAM ----- double…
Megan
  • 11
  • 1
0
votes
2 answers

How do I efficiently find the distance between all points in a set in C?

I'm currently learning C and have recently written a program to find the minimum spanning tree using Prim's algorithm. This program works fine, but requires the cost of each edge (of course). If I want to find the MST for a large number of 2D…
Tedfoo
  • 1
0
votes
1 answer

Pandas - convert columns to grouped array coordinates

I have a DataFrame of (x, y) coordinates that I would like to transform into array's to perform pairwise distance calculations on. df = pd.DataFrame({'type': ['a', 'a', 'a', 'b', 'b', 'c', 'c', 'c'], ... 'x': [1, 3, 5, 1,…
chris_l
  • 3
  • 2