Calculates the pseudo inverse of a matrix using SVD.
PINV(a, tol)
a |
- |
An input array. |
tol |
- |
Optional. A real, the singular value tolerance. Defaults to |
An array, P, the pseudo inverse of the input matrix a, such that
a = {{1, 4, 7},
{2, 5, 8},
{3, 6, 9}}
P = pinv(a)
P == {{-0.638889, -0.055556, 0.527778},
{-0.166667, 0.000000, 0.166667},
{ 0.305556, 0.055556, -0.194444}}
a *^ P *^ a == {{1, 4, 7},
{2, 5, 8},
{3, 6, 9}}
P *^ a *^ P == {{-0.638889, -0.055556, 0.527778},
{-0.166667, 0.000000, 0.166667},
{ 0.305556, 0.055556, -0.194444}}
Consider the following over-determined system of equations:
x + 4y + 7z = 30
2x + 5y + 8z = 36
3x + 6y = 15
x + 2y + z = 2
A = {{1, 4, 7},
{2, 5, 8},
{3, 6, 0},
{1, 2, 1}}
x = {30,
36,
15,
2}
P = pinv(A);
P == {{-1.725926, 1.451852, -0.214815, 0.466667},
{ 0.866667, -0.733333, 0.266667, -0.200000},
{-0.107407, 0.214815, -0.118519, 0.033333}}
b = P *^ x;
b == {-1.8,
3.2,
2.8}
y = A *^ b;
y == {30.0,
34.8,
13.0,
7.4}
norm(x-y) == 5.6921
PINV can be used to solve a system of overdetermined equations that minimizes the mean squared error. See SVDDIV for a similar method to solve a system of equations via SVD.
See LINFIT to fit an arbitrary set of basis functions to a series using the method of least squares.
PINV uses SVD to compute the Moore-Penrose pseudo inverse. The pseudo inverse P, of a matrix a has the same size as transpose(a) such that:
a *^ P *^ a == a
P *^ a *^ P == P