How do you setup initial values in MMA's Gram-Schmidt process.

Take this example:

ClearAll[a, b, c, d, e, f]
Orthogonalize[{a - b, c - d, e - f}, Dot, Method -> "GramSchmidt"]

However, the first term in the result would, by definition, be a-b - this simplifies subsequent expressions.

Using the MathWorld notation, I'm asking how to setup the MMA calculation such that $\psi_0=0, \psi_1=a-b$.

I think the following is related, but happy to submit as a separate question:

I'd also like to be able to use a different notation for the inner product. Rather than the Dot notation (...).(...), is the following possible?:

\[DoubleStruckCapitalE][( ...) ( ...) | Subscript[\[ScriptCapitalF], 
  t - 1]]

1 Answer 1


Turns out you cannot do this using the built in function Orthogonalize.

Rather you need to meld answers from two previous questions: The first here. The second here.


This function is opinionated at inserts 0 as the first value returned in the list.

oneStepOrtogonalizeGen[vec_, {}, _, _, _] := vec;

oneStepOrtogonalizeGen[vec_, vecmat_List, dotF_, plusF_, timesF_] := 
  Fold[plusF[#1, timesF[-dotF[vec, #2]/dotF[#2, #2], #2]] &, vec, 

GSOrthogonalizeGen[startvecs_List, dotF_, plusF_, timesF_] := 
  Module[{rr = Array[0 &, Length[startvecs] + 1], rtemp},
   rtemp = 
    oneStepOrtogonalizeGen[startvecs[[1]], {}, martingaleDot, 
     functionPlus, functionTimes];
   rr[[1]] = 0;
   rr[[2]] = rtemp;
    rtemp = 
     oneStepOrtogonalizeGen[rtemp, {startvecs[[i]]}, martingaleDot, 
      functionPlus, functionTimes];
    rr[[i + 1]] = rtemp;
    , {i, 2, Length[startvecs]}];

Now you can define your own inner product notation/evaluation, as well as set initial values as you like.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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