|
|
Subscribe / Log in / New account

A new release for GNU Octave

A new release for GNU Octave

Posted Dec 17, 2020 9:27 UTC (Thu) by bneven (subscriber, #53893)
Parent article: A new release for GNU Octave

Your example system of equations is not linearly independent; (x, 1-2x, x) is a solution for any value of x. Shouldn't Octave warn you about that?


to post comments

A new release for GNU Octave

Posted Dec 17, 2020 10:02 UTC (Thu) by xyz (subscriber, #504) [Link]

The example given is not representative of the usual way to solve linear systems in Octave.
It is not idiomatic as the usual way would be to use the left division operator, also following the usual notation the matrix is represented with a capital letter:

>> A = [1 2 3; 3 2 1; 2 2 2];
>> b = [2 2 2]';
>> A \ b
warning: matrix singular to machine precision
ans =

0.3333
0.3333
0.3333

As you see Octave is saying that within the used precision the matrix is non-invertible and so the solution is not unique.

Regarding linsolve this is what the first lines have to say about it. (TL;DR linsolve is an advance frontend when used with other options)

>> help linsolve
'linsolve' is a function from the file /home/jamatos/devel/octave/scripts/linear-algebra/linsolve.m

-- X = linsolve (A, B)
-- X = linsolve (A, B, OPTS)
-- [X, R] = linsolve (...)
Solve the linear system 'A*x = b'.

With no options, this function is equivalent to the left division
operator ('x = A \ b') or the matrix-left-divide function
('x = mldivide (A, b)').
....

A new release for GNU Octave

Posted Dec 20, 2020 17:40 UTC (Sun) by leephillips (subscriber, #100450) [Link]

One can certainly check for the uniqueness of solutions in Octave, but that was not important in this brief example. The returned solution is correct, if not unique.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds