josdejong/mathjs

Better documentation of usolve limitations, or possibly error message when input is not upper triangular?

Open

#2,333 建立於 2021年10月6日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)JavaScript (1,298 fork)batch import
documentationfeaturehelp wanted

倉庫指標

Star
 (13,832 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Minimal code:

window.onload = function() {
	const U = math.matrix([[0.10452846326765346,-120],[-0.9945218953682733,-0]])
	const b = math.matrix([-22.163070207475485, -59.419761706007094])

	result = math.usolve(U,b)
	console.log(result)	
}

The error I get: Uncaught Error: Linear system cannot be solved since matrix is singular.

I entered the very same equation into GNU Octave which was able to solve it: it is no unsolvable system. When switching the lines, it even becomes an upper triangular matrix with nonzero values on the diagonal line. So its determinant is not zero, which implicates that the matrix is not even singular!

貢獻者指南