Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.8K Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Avoid strange results from LinearSolve (and Solve)?

Posted 7 years ago

I encounter strange behaviour of LinearSolve (and Solve): Given a symmetric, positive matrix M (4x4, but nasty expressions) I try to solve the linear system M.x=rhs with rhs=(1,0,0,0). Using LinearSolve[M,rhs] I obtain an answer, that yields Indetermined values, when evaluated for special values of M. The same answer is obtained when using Solve. But if I calculate the Inverse of M and multiply that with rhs, I obtain the correct response, without any indetermined entries. For larger matrices this bypass would become too involved.

Attachments:
POSTED BY: Alois Steindl
6 Replies
POSTED BY: Alois Steindl
POSTED BY: Alois Steindl
POSTED BY: Daniel Lichtblau
POSTED BY: Frank Kampas

Hello, thanks for your response! Actually the matrix is the mass-matrix of a spatial double pendulum, which rotates around a central body. The angles theta1 and theta2 are the angles with the vertical direction in the plane, and psi1 and psi2 are the angles out of plane. So the matrix is symmetric and positive definite (for general values of the parameters). If I set the angles to zero before solving the equation, also LinearSolve yields the correct result; otherwise the solution contains some strange denominators, which evaluate to zero at the straight downhanging configuration (all angles 0). If there were more solutions, also the computation of the inverse should indicate problems.

I would have expected that LinearSolve behaves better than the solution using the inverse matrix. (I tell my students, that they should avoid calculating the inverse.)

POSTED BY: Alois Steindl
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard