2
$\begingroup$

I have two arrays $a$ and $b$ containing complex values. Now I one of my target operations is the following: $$||a-b||$$ The result should be a single real number. Now I am a bit confused how to apply the norm here: Should I rather calculate first the norm of each value in the array, and then apply the formula above: $$a[i] = \sqrt(a[i].real^2+a[i].imag^2)$$ $$||a[i]-b[i]||$$ or should I first subtract the values, and then apply the formula: $$tmp = a[i]-b[i]$$ $$||tmp|| = \left(\sum \sqrt(tmp.real^2 + tmp.imag^2)^n\right)^{\frac{1}{n}}$$? What is intended by the operation shown above?

$\endgroup$
  • 2
    $\begingroup$ The usual sense is: You subtract. $a-b=(c_1,c_2,...,c_n)$.Then $\|a-b\|=\sqrt{\sum_{k=1}^{n}|c_k|^2}$. Each $c_k=a_k+ib_k$ is a complex number. Therefore $|c_k|=\sqrt{a_k^2+b_k^2}$. Putting all together you get $\|a-b\|=\sqrt{\sum_{k=1}^{n}(a_k^2+b_k^2)}$. $\endgroup$ – OR. Apr 3 '15 at 13:04
7
$\begingroup$

For any complex vector $$\|c\|=\sqrt{\langle c,c\rangle}=\sqrt{\sum_{i=1}^nc_i\overline{c}_i}.$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.