Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

1
vote
1answer
71 views

Transform linear system into a matrix form

I have a system of linear equations in variables $A_n$ of form: $$ \sum _{k=-K}^K h_k A_{n-k} J_{n-k}\left(\frac{(1-i) \text{$\eta $Sqrt}(n-k)}{\sqrt{2}}\right)+A_n\left(\frac{(1-i) \eta ...
0
votes
0answers
81 views

Gaussian Elimination with full pivoting [on hold]

I have some problems with an implementation of the Gaussian elimination with full pivoting. It seems to me that I've programmed it correctly, but nevertheless it throws errors and I can't find my ...
0
votes
0answers
30 views

Generating vectors with restrictions on a lattice

Suppose we are given a certain adjacency matrix that contains the information for a given lattice. I want to generate a configuration of vectors that satisfy a restriction. Specifically, if I have ...
0
votes
1answer
60 views

Creating Matrix,Inverted and Upper Triangulate inside Module

I was trying to fit this into a module but I didn't have any luck. And for some reason it won't Inverse the Matrix. Here's the code: Input: ...
-1
votes
1answer
60 views

Help needed with assignment [on hold]

Can I get some help with this: Write a module which as an input receives two matrices, the first matrix transforms in to the same matrix, but in the new matrix occur absolute values of the first, ...
4
votes
2answers
136 views

Improve simulation speed using Compile

I have two square matrices, a hermitian matrix h and an unitary matrix v. I am interested in the following function ...
0
votes
0answers
50 views

Which method to use for finding maximum without actually computing optimization function explicitly?

I am new to Mathematica and I am currently working on an optimization problem. The optimization function that I have easy to calculate for some assignment of variable but it is very difficult to ...
-1
votes
1answer
60 views

Module whose input is a function of 2 variables [closed]

I need to make a Module whose input is a function of 2 variables and 2 variables m,n so i can make a Matrix with Array. Basicaly, I need this: ...
-1
votes
0answers
30 views

Estimating fundamental matrix for stereo pair

I want to calculate fundamental matrix for stereo pair. Matlab has this function - estimateFundamentalMatrix. Is there an analog in Mathematica? If no how I can calculate it?
1
vote
2answers
71 views

Matrix with infinity on main diagonal

The question is trivial, however, there might be unexpected solutions. What would be nice way to create a square matrix with $\infty$ on main diagonal, and some arbitrary constant everywhere else? My ...
2
votes
2answers
208 views

How to make Mathematica show matrices and vectors nicely

It shows me like {{0}, {1}, {0}, {-1}} . Is it possible to make it look like a vector, always?
5
votes
3answers
159 views

Constructing a grid from a matrix

I would like to construct a grid from a matrix. For example, one possible matrix is $M1$. $$M1= \begin{pmatrix} c2 & a1 & a1 & a1 & a1 & a1\\ a2 & b1 & c2 & a1 & ...
0
votes
1answer
40 views

symbol matrix calulation

I have question about matrix calculation. like $\mathbf{b}^{t}\Sigma \mathbf{b}$, where $\Sigma$ is 7 by 7 matrix, and $\mathbf{b}$ is vector of 7. and each element in the vector b or $\Sigma$ is ...
0
votes
1answer
50 views

Symbolically solve system of equations involving matrix

I need to solve the following system of equations symbolically for a_i, b_i, and c_i: ...
0
votes
1answer
88 views

Extract coefficient matrix $A$ from expression $f(x)$

I have expression: $$f(x)=\sum_{i=0}^{K-1}\sum_{j=0}^{N-1}a_{i,j}e^{ix}x^j.$$ I want to extract coefficient matrix $A$ from expression $f(x)$ where $$A=\left( \begin{array}{ccccc} a_{0,0}& ...
3
votes
1answer
107 views

$\mathbf L\mathbf D\mathbf L^\top$ Cholesky decomposition

Mathematica can do a Cholesky decomposition $\mathbf A = \mathbf L\mathbf L^\top$, but how do I do a LDL decomposition $\mathbf A = \mathbf L\mathbf D\mathbf L^\top$, with $\mathbf L$ being a unit ...
2
votes
0answers
54 views

Factor out a constant from a matrix

I've got a matrix in which every entry is of the form x/4. I cant find out how to factor out the 1/4 so that the actual matrix is clearer. Thanks for your help!
14
votes
3answers
573 views

Why is calling Dot with many arguments so inefficient?

Say I want to multiply a reasonably large list of symbolic matrices. ...
2
votes
1answer
49 views

Efficient Implementation of Resistance Distance for graphs?

Is there an implementation of the resistance distance matrix (or just resistance matrix) for graphs available in Mathematica?
0
votes
0answers
45 views

in the part assignment is not a symbol, create different matrices with a “Do” loop [duplicate]

Im trying to assemble new matrices from some previous matrices I have created, but I can´t. What Im trying to do is the following: 1) I have different matrices: ...
0
votes
1answer
53 views

Returning functions that are partly evaluated

I have some performance issues when calling Table[{h, Slow1[h, n]}, {n, nlist}, {h, 0.1, 10, 0.5}]; for a given list ...
1
vote
1answer
70 views

How to construct a kernel from a function?

I would like to convolve an image with a mathematical function. I understand that I need to have the mathematical function in a matrix form. How can I build it? Thanks
12
votes
1answer
235 views

Why does partitioning increase Dot execution speed?

I have noticed that multiplying a list of matrices can be significantly sped up by partitioning the list, calculating the product of the partitions matrices, and then multiplying the results. ...
0
votes
1answer
76 views

whats wrong when I use for loop for creating a matirx? [closed]

When I use separate value for "i" and "j", I get the correct desirable answer. ...
0
votes
2answers
25 views

Multiplying columns of a list of matrices

I have the following list of matrices ...
0
votes
1answer
57 views

Symbolic matrix inversion

If I try to get an inverse of a matrix: a | b | c b | d | 0 c | 0 | 0 Inverse[{{a, b, c}, {b, d, 0}, {c, 0, 0}}] I get the answer: ...
0
votes
3answers
56 views

Simplifying Terms in a Matrix

Given the following 3 matrices: M1=1/3*{{1,1,1},{1,α,α^2},{1,α^2,α]}} Z1={{Z+Zg,Zg,Zg},{Zg,Z+Zg,Zg},{Zg,Zg,Z+Zg}} M2={{1,1,1},{1,α^2,α},{1,α,α^2}} where alpha ...
-1
votes
1answer
49 views

Beginner Question: Assigning an indexed Variable to a given list

I am pretty new to the game and have a problem, which i am sitting on for hours. 1) I created a random Matrix 5x5 ...
21
votes
0answers
176 views

Does Mathematica store hidden information for matrix objects?

Bug introduced in 10.0.0 and persisting through 10.1.0 or later I found a case where calling one built-in function (HermitianMatrixQ) for a given matrix changes ...
1
vote
1answer
62 views

Divide each element of a list of 500 matrices by another matrix

Lets say that I have a Table of dimension (3,3,500) and I'd like to perform element-wise division by a 3x3 matrix along the third dimension (of length 500 in this case). What is the most elegant way ...
4
votes
1answer
67 views

Speed up the auxiliary function magicSquare when $n$ is doubly-even

Today, I saw a question about magic square. Please see here When $n$ is doubly-even.Namely, Mod[n,4]==0 ...
0
votes
0answers
33 views

Parametrizing a matrix given its trace and norm

I have a problem where I have to generate random matrices with the following properties: ($a$ is a given fixed number) $\mathrm{Tr}\, A=0$ $\mathrm{Tr}(A^\dagger A)=\|A\|_F^2=a$ I was wondering ...
5
votes
4answers
172 views

Counting variable from a list of matrices

I have a list of matrices ...
4
votes
2answers
112 views

Gridding in a Nested Matrix

We have a nested matrix as: nested={{he, {{e, f, g, h}, {s, 0, q, i}, {s, 0, q, j}}}, {ho, {{e, f, g, h}, {0, u, t, i}, {u, t, 0, j}}}} and with the line ...
1
vote
1answer
326 views

Usage of Piecewise/RSolve to solve an equation based on condition

I am trying to compute price of call option on a stock using the finite difference method. I have a VBA code for it, and I am trying to find out how I can use Mathematica memoization functions and ...
0
votes
0answers
54 views

Recursive computation using Piecewise

I am trying to create an array using a series of equations using Piecewise. I am stuck in one of them. I am just putting a simplified version of code as below. I ...
-1
votes
1answer
90 views

Laplace equation

I tried to run this code, but it doesn't work for NDSolve ...
0
votes
0answers
36 views

Deciphering output messages using Solve

I'm trying to solve the following system. The error messages I'm getting suggest that there may not be a solution [my desired result], but I'm not sure if there could be something else going on. The ...
0
votes
0answers
55 views

How to handle substrings of a matrix by a named index

I am using open source code to run stochastic simulations. The output looks like this: ...
1
vote
3answers
94 views

Absolute VectorPlot scaling

I'm trying to visualize the vector components of a rotation matrix with absolute vector lengths. VectorScale help states that When using an explicit sfun, ...
0
votes
0answers
66 views

Matrix iteration failing after second step

I am calculating 11x6 matrix using different logics as in below code. Problem is in Do loop in below code where I have two different criteria to update matrix "fd". I am expecting logic in IF which ...
0
votes
1answer
49 views

Replace element of matrix based on rule which invloves other element of same matrix

I am trying to replace 1s row of matrix d iteratively from right by multiplying last element in 1st row with (1-int*dt) to generate 2nd last element. The replacement continues till I reach the 1st ...
0
votes
0answers
54 views

How to replace a part of array based on certain rules which involves usage of other array

I am trying to replace outermost column of array "fd" in below code. fd is matrix of dimension (nas1,nts) which is initially filled with 1. I want to replace outermost column of fd with result of Max ...
2
votes
1answer
71 views

Abstract iterator in Do

I'm trying to write a module. Its input is a matrix (tensor), the module should return new tensor with increased rank with 1. The new tensor is defined as $$ O \Rightarrow N_{\alpha \beta \ldots ...
1
vote
2answers
69 views

Problem in matrix multiplication

I created a random directed acyclic graph using Mathematica. I need to compute a specific function from its adjacency matrix. ...
2
votes
2answers
166 views

Are there any good mass row/column swapping functions for matrices?

I have the following matrix Keeping the 20 row and 20 column fixed (so the 21st rows and columns because I started at 0)...how do I push each row and column back one spot? I need to push the 0th row ...
1
vote
3answers
209 views

Writing code to update a large matrix?

How can I write a code to update a matrix based on certain rules? I plan on constructing a large matrix, and I cannot submit entries one by one. The rules for the matrix are as followed: $$ ...
4
votes
4answers
113 views

Express block matrix in terms of matrix basis

I'm trying to construct a function that returns the multiplication table of a matrix Lie algebra. Assuming a basis of matrices, my definitions: ...
1
vote
0answers
28 views

How can I get symbolic orthonormal eigenvectors for 3 by 3 hermitian matrix?

Using the following syntax, I can obtain the symbolic eigenvalues and eigenvectors of the following Hermitian matrix (a,b,c,d are all real parameters): ...
0
votes
0answers
47 views

How to change dimensions of a matrix? [on hold]

I have two sets of data that I'm working with, both of which should be 1024 x 1024 matrices (they're from the same instrument). However, when I go to manipulate them, the dimensions of one are read as ...