1

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.

loltospoon
  • 145
  • 3

1 Answers1

1

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]
user85503
  • 992
  • 1
  • 9
  • 22