Is there a way where Mathematica gives a step-by-step process for orthonormalization of vectors? I have the final result, but I would like to see the process of GramSchmidt to obtain the normalized basis.
Asked
Active
Viewed 113 times
0
1 Answers
1
You can refer to the method in this post.
GramSchmidt[w_?MatrixQ] :=
Module[{v = ConstantArray[0, Length[w]]},
Table[v[[n]] =
w[[n]] -
Sum[(v[[i]] . w[[n]]/v[[i]] . v[[i]])*v[[i]], {i, 1, n - 1}], {n,
1, Length[w]}];
v]
tmat = {{1, 0, 1}, {2, 6, 3}, {1, 1, 1}, {2, 3, 5}};
GramSchmidt[tmat]
Appendix:
A little mouse on the pampas
- 5,760
- 2
- 13
- 40

Printstatement could show the result of each step. (You don't mention it, but I assume you know of the built-in functionOrthogonalize[].) – Michael E2 Mar 13 '21 at 15:13Printto print what you want to see, it makes me wonder, what do you want printed? I don't think I can figure that out either. – Michael E2 Mar 14 '21 at 05:28Printwhere I would, and printed out a row after it was changed. When I’m confused, I do something on the level of someone who is confused: I printPrint[1 -> x]wherexis the data calculated by the first step of the code; thenPrint[2 -> y]at the second step of the code, and so on. In this way, when I see what I really wanted to print, I know whichPrintstatement gave me the desired output. – Michael E2 Mar 14 '21 at 05:56