Skip to main content
9 votes
Accepted

How can I prevent conversion of a SparseArray to a DenseArray?

Just for the records: For order = 1, the matrix product is just a sum of the identity matrix plus ...
Henrik Schumacher's user avatar
7 votes
Accepted

Writing a matrix as a linear combination of matrices

...
Bob Hanlon's user avatar
  • 160k
6 votes
Accepted

How to find all the possible products from a list of commutative $2 \times 2$ matrices?

Try this one-liner ...
yarchik's user avatar
  • 19.1k
5 votes

Solving a system of linear equations modulo n

We now have LinearSolveMod in the Wolfram Function Repository ...
5 votes

Computing log-determinant?

The determinant of a matrix may be outside the usual 64-bit floating point range, even if the log determinant isn't. Hence using Log[Det[...]] to compute the log ...
Wicher's user avatar
  • 101
5 votes

Eigenvectors are divided by zero depending on evaluation, 4x4 matrix

You have to use FullSimplify: ...
eldo's user avatar
  • 78.4k
5 votes

Is there a non-allocating way to modify elements of single-reference packed arrays?

After I wrote the C code below, it came to my mind that the first thing you should do in your Mathematica session is to set $HistoryLength = 0; Otherwise, at least ...
Henrik Schumacher's user avatar
5 votes

Tensor product inside the compiler

Here is a working example using FunctionCompile. This example works for two lists. I think it can be generalized to tensors with higher dimensions. ...
Craig Carter's user avatar
  • 4,565
4 votes
Accepted

how to solve problem involving a condition?

You can convert root to radicals using ToRadicals. Just use Eigenvalues then apply ToRadicals then simplify using $c>0$. ...
Nasser's user avatar
  • 146k
4 votes
Accepted

Commutant of set of matrices

Take a random matrix: n = 3; M = RandomInteger[{-10, 10}, {n, n}] (* {{9, 1, 8}, {-7, 8, -3}, {7, 10, -7}} *) Build a matrix of unknowns: ...
Roman's user avatar
  • 48.4k
4 votes

How to write function series in Mathematica?

I am assuming $\otimes$ means normal matrix multiplication. In that case ...
Nasser's user avatar
  • 146k
4 votes

Eigenvectors are divided by zero depending on evaluation, 6x6 matrix

This is not an answer but too long for a comment. I can try to explain why you might not want to go the route you seem to be taking. First observe that, independent of the parameters, 0 is an ...
Daniel Lichtblau's user avatar
4 votes
Accepted

How to create a vector as a tensor object for different euclidean bases?

We name "global" the built in basis. Assume then that 2 arbitrary basis are stored column wise in the following matrices: ...
Daniel Huber's user avatar
  • 53.2k
4 votes
Accepted

Saving solutions of equations with indexed variables to a table

First, use Solve to get the solution: sol = First@Solve[{c[0, 4, 0] + ...} == {494/(6561 Sqrt[π]), ...}]; Now iterate through the values and put them in another ...
Domen's user avatar
  • 27.3k
4 votes

Finite Differences:

...
Syed's user avatar
  • 55.7k
4 votes

Finite Differences:

We can use Difference[#,n] to get n order difference. Flatten[#,{{2},{1}}] can be use to ...
cvgmt's user avatar
  • 76.9k
4 votes

Converting an algebric expression into a matrix form

I think CoefficientArrays is what you are after. I start by putting in your expression and defining two vectors of coefficients. ...
Hugh's user avatar
  • 16.5k
4 votes

Find more relationships with LatticeReduce

If we limit vec to four elements and test all possible sublist we get more results. ...
azerbajdzan's user avatar
  • 19.7k
4 votes

Subsets command not working as expected with dot product of matrices

A fundamental aspect of Mathematica is that everything is an expression and evaluating an expression is just applying rules to transform the expression into another expression. You really can't rely ...
lericr's user avatar
  • 30.2k
4 votes
Accepted

How to get all possible multiplicative combinations of $5$ matrices with unique output

Do not use uppercase symbols, they are used for the system. We may solve this using only abstract elements, without the complication of matrices. I note the abstract elements by : g[i]. We know that ...
Daniel Huber's user avatar
  • 53.2k
3 votes

Problem of RollPitchYawAngles and orthogonalize

You can find the orthogonal matrix matO that is closest to the matrix mat by a singular-value decomposition (see, for example, ...
Roman's user avatar
  • 48.4k
3 votes

Eigenvalues and classification of critical points

...
MarcoB's user avatar
  • 67.4k
3 votes

Does the solution exist in this matrix system?

Apparently, your system has a 5-dimensional null space: ...
Henrik Schumacher's user avatar
3 votes

Non-valid modulus when using LinearSolve

We now have LinearSolveMod in the Wolfram Function Repository Get a solution and generating set for the null vectors: ...
Daniel Lichtblau's user avatar
3 votes

Show steps in finding the reduced row echelon form of a symbolic matrix

I added one minor bug fix to Nasser's excellent code. In my testing, if the matrix has more rows than columns, it would continue eliminating even if it's run out of columns, e.g. treating the non-...
hhliu's user avatar
  • 81
3 votes

How can I construct this matrix?

n = 5; Table[RotateRight[Range[n], i], {i, 0, n - 1}] // MatrixForm ...
eldo's user avatar
  • 78.4k
3 votes

Eigenvectors are divided by zero depending on evaluation, 6x6 matrix

This is too long for a comment, but not quite a full solution, since it would require tweaking for the particular problem at hand. But I can at least illustrate a method of fixing this issue that ...
march's user avatar
  • 23.9k
3 votes

Is there a better way to calculate the number of codewords of weight $i$ in a list of codewords?

I cannot comment on the nice pieces of Mathematica code suggested by the other answerers, but as a (former) coding theorist I want to remark that people working in this area often use a generating ...
Jyrki Lahtonen's user avatar
3 votes

Given square matrices A and B, how to solve T obeys Transpose[T]. A . T = B?

Using the A, B matrices provided by the OP in the question we use the solution found in this post and we find ...
Hans Olo's user avatar
  • 1,838
3 votes

Given square matrices A and B, how to solve T obeys Transpose[T]. A . T = B?

I wonder if you're asking the impossible. Here is an example for 3x3 matrices $A$ and $B$. There are 48 integer-only solutions. Would not having 10x10 matrices result in many, many more integer-only ...
JimB's user avatar
  • 41.9k

Only top scored, non community-wiki answers of a minimum length are eligible