Quantcast
Channel: Math.NET Numerics
Viewing all articles
Browse latest Browse all 971

New Post: Linear dependent vectors

$
0
0
We probably should add a method for that. In the meantime you can, for example, check whether the determinant of the 2x2 matrix of the vector's scalar products is zero:
var a = Vector<double>.Build.Dense(new[] {1.0,2,3,4});
var b = Vector<double>.Build.Dense(new[] {-2.0,-4,-6,-8});
var c = Vector<double>.Build.Dense(new[] {-2.0,-4,-6,-7});

Matrix<double>.Build.Dense(2, 2, new[] {a*a, b*a, a*b, b*b}).Determinant() // = 0, hence linearly dependent
Matrix<double>.Build.Dense(2, 2, new[] {a*c, c*a, a*c, c*c}).Determinant() // = -9016, hence linearly independent
PS: yes, either here or StackOverflow with "mathdotnet" tag

Viewing all articles
Browse latest Browse all 971

Trending Articles