0
$\begingroup$

The code:

vec1 = {{-1}, {0}, {1}} // MatrixForm
vec2 = {{-1}, {1}, {0}} // MatrixForm
p[v2_, v1_] := v1 (v1.v2)/Sqrt[(v1.v1) (v2.v2)];
u2 = vec2 - p[vec2, vec1]

The output:

enter image description here

Mathematica won't calculate the dot product in the output. I've tried Simplify, FullSimplify, Reduce, and MatrixForm. The last two were total guesses.

$\endgroup$
0
$\begingroup$

Remove the extra braces inside the vectors, such that the code becomes

vec1 = {-1, 0, 1}
vec2 = {-1, 1, 0}
p[v2_, v1_] := v1 (v1.v2)/Sqrt[(v1.v1) (v2.v2)];
u2 = vec2 - p[vec2, vec1]
$\endgroup$
  • $\begingroup$ That was it, thanks! $\endgroup$ – loltospoon Mar 20 '17 at 1:49

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