Linear Algebra and the C Language/a0ow


Dot Product

In mathematics, the dot product is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors), and returns a single number.... Wikipedia: Dot product

Compute orthogonal vectors

You want to compute the orthogonal vectors to the vectors V. To calculate these vectors, I chose the algorithm that calculates free vectors. I create a system Ab with at least two rows and I solve this system using the free variables algorithm.

/*  The algorithm of free variables (The free vectors: b_free) */
      gj_PP_mR(Ab,NO);                                    
  put_zeroR_mR(Ab,Ab_free);           
  put_freeV_mR(Ab_free); 
      gj_PP_mR(Ab_free,YES); 
     c_Ab_b_mR(Ab_free,b_free);

I check if the dot product of two vectors is zero; this means that they are orthogonal to each other.

  for(c=C0; c<VARRAY; c++) 
  
    for(r=C0;  r<UARRAY; r++) 

         printf(" v^t[%d] u[%d] = %+.4f\n",c,r, dot_R(vt[c],u[r]));

If you want normalize the vectors, you can find an example Here

Application

Compute an orthogonal vector:

Compute two orthogonal vectors:

Compute three orthogonal vectors:

Compute four orthogonal vectors:

Compute five orthogonal vector: