Dear Christoph,
Thanks for your help!
I checked it in R and it works if we extend a and b with one element for
each run. Unfortunately, I actually want to merge two vectors and then
calculate the H for the merge. It is consequently no addition of 1
element but an addition of x elements. I did
Dear Stef
Please check my code below carefully, because it is Friday
afternoon and there might be mistakes in it:
## initialize two random vectors (length n = 100)
a <- rnorm(100)
b <- rnorm(100)
## computation of your formula (see ?outer which is very
## useful here)
(c <- sum(sqrt(outer(a,a,"-
Dear R-ians,
I am looking for the simplification of a formula to improve the
calculation speed of my program. Therefore I want to simplify the
following formula:
H = Si (Sj ( sqrt [ (Ai - Aj)² + (Bi - Bj)² ] ) )
where:
A, B = two vectors (with numerical data) of length n
sqrt = square root