### Translated by

このページのコンテンツは英語から自動翻訳されています。自動翻訳をオフにする場合は「<a class="turn_off_mt" href="#">ここ</a>」をクリックしてください。

## sparse matrix problem in solve systems of linear equations

Naime

### Naime (view profile)

さんによって質問されました 2019 年 1 月 24 日

### John D'Errico (view profile)

さんによって 編集されました 2019 年 1 月 24 日
John D'Errico

### John D'Errico (view profile)

さんの 回答が採用されました
I have F= 1.0e+05 *[-6.2281; -2.6137;0.1177; -0.4726]
J= 1.0e+05 *
(1,1) 1.2527
(2,1) -0.2980
(3,1) -0.1361
(4,1) 0.0240
(1,2) -0.2980
(2,2) 0.3484
(3,2) -0.0156
(4,2) -0.0416
(1,3) -0.1361
(2,3) -0.0156
(3,3) 1.2470
(4,3) -0.2760
(1,4) 0.0240
(2,4) -0.0416
(3,4) -0.2760
(4,4) 0.4438
when I want to calculate
dx = (J \ F);
gives Warning: Matrix is singular to working precision.
I change it to dx = pinv(J)*F
gives this error (SVD does not support sparse matrices. Use SVDS to compute a subset of the
singular values and vectors of a sparse matrix). so I change it to dx = pinv(full(J))*F. Does it correct ?

#### 0 件のコメント

サインイン to comment.

## 1 件の回答

2019 年 1 月 24 日

### John D'Errico (view profile)

2019 年 1 月 24 日
採用された回答

J is not sparse. In fact, J is essentially a full matrix. It has no zeros in it at all! So why are you using sparse matrix storage? And especially on such a small, tiny matrix? I think you are using sparse storage for no good reason. In fact, sparse is costing you capability, time, and even memory. Not a lot. But it is just a bit silly here.
As far as using pinv(full(J))*F, yes, that is a way to resolve the singularity issues, but it may be a poor choice. A singular matrix is usually a sign that something is wrong. Yes, you can close your eyes, pushing forth, full speed ahead. But far too often that just results in a train wreck.
As a wild guess, the use of the variable names J & F here indicates to me that you might be trying to do some sort of Newton iteration. A singular matrix there suggests that you are getting into a bad place in that search, that something is wrong. But then, what do I know, since you have told us nothing at all, except that you seem to be very confused in why you are doing what you are doing. So maybe, just maybe, it is time to slow down. Look at the warnings, and take that curve ahead with the brakes applied. (In other words, think very carefully about what you are doing.)

#### 0 件のコメント

サインイン to comment.

Translated by