linalg
::orthog
Orthogonalization of vectors
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
linalg::orthog(S
, <Real>)
linalg::orthog(S)
orthogonalizes the vectors
in S using
the GramSchmidt orthogonalization algorithm.
The vectors in S
are orthogonalized with
respect to the scalar product linalg::scalarProduct
.
If O is
the returned set, then the vectors of O span
the same subspace as the vectors in S
, and they
are pairwise orthogonal, i.e.: for
all with .
The vectors returned are not normalized. To normalize them use map(O,
linalg::normalize)
.
For an ordered set of orthogonal vectors, S
should
be a list.
The vectors in S
must be defined over the
same component ring.
The component ring of the vectors in S
must
be a field, i.e., a domain of category Cat::Field
.
If you use the Real
option, linalg::orthog
computes
an orthogonal basis using a real scalar product in the orthogonalization
process.
The following list of vectors is a basis of the vector space ℝ^{3}:
MatR := Dom::Matrix(Dom::Real): S := [MatR([2, 1, 0]), MatR([3, 1, 1]), MatR([1, 1, 1])]
The GramSchmidt algorithm then returns an orthogonal basis for ℝ^{3}. We get an orthonormal basis with the following input:
ON:= linalg::orthog(S)
The vectors can be normalized using linalg::normalize
:
map(ON, linalg::normalize)
We may also build a matrix from the vectors in S
an
apply linalg::orthog
to this matrix. The result
is the matrix whose columns are given by the above elements of the
list ON
:
A:= S[1].S[2].S[3]
linalg::orthog(A)
The orthogonalization of the vectors:
T := {matrix([[2, 5, 3]]), matrix([[0, 2, 1]])}
gives:
linalg::orthog(T)
The result of linalg::orthog
is a list or
set of linearly independent vectors, even if the input contains linearly
dependent vectors:
MatQ := Dom::Matrix(Dom::Rational): S := [MatQ([2, 1]), MatQ([3, 4]), MatQ([1, 1])]
linalg::orthog(S)
Compute an orthogonal basis of this matrix:
A := matrix([[a, 1], [1, a]]): linalg::orthog(A)
To avoid complex conjugates, use the Real
option:
linalg::orthog(A, Real)

A set or list of vectors of the same dimension (a vector is
an n×1 or 1
×n matrix of
a domain of category 

Avoid using a complex scalar product in the orthogonalization process. 
Set or a list of vectors, respectively.