2
$\begingroup$

Why does the dot() function in MATLAB return different expressions based on the order in which I pass vectors?

enter image description here

$\endgroup$
10
  • 4
    $\begingroup$ The premise of your question is incorrect. The "dot product" of complex vectors is not commutative. $\endgroup$ – Brian Borchers Nov 4 '20 at 19:15
  • 1
    $\begingroup$ I guess the confusion arises because f is symbolic (x and y could be complex) whereas u is explicitly real-valued. $\endgroup$ – Charlie S Nov 4 '20 at 19:53
  • 2
    $\begingroup$ I don't have matlab, but according to this link mathworks.com/help/symbolic/… you can add assumptions to symbolic variables. x = sym('x', 'real');y = sym('y', 'real'); That may clear things up. $\endgroup$ – Charlie S Nov 4 '20 at 19:56
  • 3
    $\begingroup$ You can declare that x and y are real using "syms x y real". $\endgroup$ – Chenna K Nov 4 '20 at 20:33
  • 2
    $\begingroup$ Sorry for the shorthand. The point is that depending on your convention you take either the conjugate of the first vector or the second vector in the product. The point remains that this can cause confusion... $\endgroup$ – Brian Borchers Nov 4 '20 at 22:35

Your Answer

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

Browse other questions tagged or ask your own question.