Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a 12x12 matrix (2D list), called M, which depends on some variables. Usually I set all of the expect of one (call it x).

To my surprise, when I use M1=M/.{x->1} Mathematica (8 as well as 9) completely ignores statement and does not replace x by 1 in M1 matrix. Moreover, when I use Det[M] (without replacing x by a number), I cannot get any result. I have to set eg. x=1 and than calculate determinant for this value, which is not very practical for the further calculations.

Do you have any idea where might be the problem? I do not think that my matrix is so complicated that Mathematica cannot simply calculate a general expression for its determinant. I do not use Simplify or FullSimplify.

share|improve this question

closed as off-topic by Kuba, Yves Klett, Verbeia Jul 30 '13 at 13:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Kuba, Yves Klett, Verbeia
If this question can be reworded to fit the rules in the help center, please edit the question.

Can you share the code you are working on ? –  Sektor Jul 30 '13 at 9:29
The matrix is coming from an external file, which is exported from another notebook. It seems to be OK. Its components are nonlinear complex expressions. In the code I just read the matrix and try to calculate its determinant. –  LLapsus Jul 30 '13 at 9:42
You can have a look at the internal representation via FullForm[M1]. This could give you a clue why it behaves the way it does. –  Thies Heidecke Jul 30 '13 at 10:11

1 Answer 1

Definitely, I found what went wrong. It was just a minor problem. I read my matrix from an external file but Mathematica saved i as a SparseArray. I just learned that ReplaceAll does not work with sparse arrays. When I convert it to a Normal form it works.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.