Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

3
votes
1answer
144 views

How to speed up filling a matrix as much as possible in a loop?

In order to find the solution of an $n\times n$ system of nonlinear equations by the method $x_{k+1}=x_k-D_k^{-1}f(x_k)$ where $D_k$ is an approximation of the Jacobian and defined by ...
0
votes
1answer
44 views

Lift and projection method in Least Squares Inverse Eigenvalue Problems [closed]

I need to implement the lift and projection method proposed by XUZHOU CHEN AND MOODY T. CHU in http://www4.ncsu.edu/~mtchu/Research/Papers/lsiep.pdf on page 7 in ...
2
votes
1answer
118 views

Easier way to calculate Taylor remainder in 2nd order series

At the moment I have implemented the code for a Taylor 2nd order series for the function in three variables: $x_3^3+\frac{x_1-x_2}{x_1+x_2}$ The code builds on following expression: ...
2
votes
1answer
99 views

Product of $N\ 2 \times 2$ matrices and subsequently solving an equation dependent on the product

I have $N\ 2 \times 2$ matrices, each one containing one variable energy which may be complex. I want to muliply them all together to a single matrix ...
1
vote
5answers
171 views

Do not expand matrices in Mathematica calculation

Here is an example of a problem I'm having. Consider that I have defined: omega={{p[t]},{q[t]},{r[t]}} x={{a},{b},{c}} R={{1,2,3},{4,5,6},{7,8,d}} What I would ...
3
votes
3answers
133 views

Chopping matrix elements, real or imaginary

An undesired shape of a matrix has the following form: which is created by ...
5
votes
1answer
83 views

Would like to draw something similar to confusionMatrix created by ClassifierMeasurements

How do I show the values in each box? I know how to add the labels. Thank You
2
votes
1answer
271 views

Structure analysis based on direct stiffness method. Solve taking too much time

The program generates a very large matrix based on some input from the user. The matrix is symmetric and called generalstifnessmatrix. It also generates 2 other lists(displacement and forces list) ...
2
votes
1answer
76 views

Mathematica's Solve[] and LinearSolve[] doesn't work to solve a system of equations IF parameters are not replaced

(I'm working on Mathematica 10.3) I have a system of 81 algebraic linear equations with 81 variables (variables are a1 to a81). ...
19
votes
3answers
713 views

Why is calling Dot with many arguments so inefficient?

Say I want to multiply a reasonably large list of symbolic matrices. ...
5
votes
4answers
154 views

Add to matrix missing elements (for list of time series)

This question is an extension of the 43122. I’ve looked through many interesting post (like this) but (as always) missed the direct matching. So the setting is simple: ...
3
votes
2answers
115 views

How to form binary matrix with constants and given probability?

I want to create a binary matrix of 6x3 in which six elements (m13,m23, m33, m42, m52, m61) are constant and assigned '0' value; whereas for other twelve elements (m11, m12, m21, m22, m31,m32, m41, ...
6
votes
1answer
121 views

List consisting of positions of the matrix elements and the elements themselves

Given a 2D matrix I would like to make a list with elements consisting of positions of the matrix elements and the elements themselves. Let the matrix be ...
4
votes
1answer
116 views

How to increase the evaluation speed of this somewhat complicated table / matrix operation?

I'd like to calculate the following one-dimensional array: OneDimArray = Table[(Norm[Sum[ MatrixA[[i,j]]VectorB[[j]],{j,N}]])^2,{i,N}] However this takes a very ...
2
votes
1answer
136 views

different situations with Compilation of ConstantArray

First, we load some tools related to Compile for analysis. ...
1
vote
2answers
65 views

How to replace the selected value in matrix with a specific digit?

I want to replace the selected values through "RandomChoice" by 1 and all other values in matrix with 0. I want output in binary form matirx. ...
3
votes
2answers
133 views

Factor multiplied matrix with vector

Say I have a matrix multiplication of the form $$B=A\cdot X$$ or $$\left( \begin{array}{c} \text{a11} \text{x1}+\text{a12} \text{x2}+\text{a13} \text{x3} \\ \text{a21} \text{x1}+\text{a22} ...
24
votes
5answers
921 views

Can (compiled) matrix permanent evaluation be further sped-up?

Update III  Mathematica 10.2.0 now ships with a predefined System`Permanent function, which the PermanentCode package ...
2
votes
1answer
84 views

Eigenvectors choose intuitive ordering/sorting

Starting from some symmetric $L\times L$ matrices $M$(see below), I want to compute the eigenvectors in Mathematica, in order to construct an ...
5
votes
3answers
1k views

Generating random symmetric matrix

Suppose first that I want to generate a matrix whose elements are independent and identically distributed (i.i.d.) with distribution dist. This is easy: ...
0
votes
2answers
103 views

How to map the second highest value in each row of a matrix

I have a matrix with three or more columns called mat. I would like to map the second highest value in each row of mat into its ...
13
votes
2answers
537 views

more numerically accurate inverse matrix

I encountered the following matrix mat = {{2, 2.161209223472559` + 1.682941969615793` I}, {2.161209223472559` - 1.682941969615793` I, 2}} and ...
1
vote
2answers
132 views

LUDecomposition for non-square matrices

How do we go about finding the LUDecomposition for non-square matrices. When i try to input the standard LUDecomposition ...
1
vote
2answers
125 views

How to parallelize this code?

Initialize a matrix a with value of $\alpha$ in central cell as "ice", and $\beta$ in every other cell. ...
3
votes
1answer
60 views

How to fill a tensor with matrices one by one?

I have this tensor: nn = 4; tableToFill = Table[x, {p, 1, nn}, {q, 1, nn}, {i, 1, nn}, {j, 1, nn}]; that I want to fill with a matrix one by one with a matrix ...
3
votes
0answers
52 views

FindInstance of Matrices

I'm trying to use FindInstance to find examples of matrices that complete an expression. However, it seems like I need to specify atomics as my variables to the function. So, here's a really simple ...
0
votes
0answers
56 views

Can't operate on vector within a list of rules

I'm trying to set up a list of rules which includes the following: ...
0
votes
0answers
47 views

LatticeReduce question

Does LatticeReduce work with arbitrary precision arithmetic? That is, if I give it a linearly independent integer basis, but the integers are 40 decimal digits long ...
7
votes
1answer
224 views

How write a new MatrixRank feature with symbolic computation

The current MatrixRank is a slight foolish without any capacity of symbolic computation ,feature of Mathematica, like this: ...
3
votes
1answer
126 views

FindMaximum “is not a real number at” nrnum problem

I'm experiencing a problem using FindMaximum that I don't understand (due to my newbie knowledge of Mathematica's syntax). That is, FindMaximum sometimes returns a (correct) answer, but sometimes ...
0
votes
1answer
41 views

Tolerance of PositiveSemidefiniteMatrixQ [closed]

I believe the following should be True but returns False for me: ...
0
votes
1answer
106 views

Generate random Hermitian matrices [duplicate]

I want to generate random Hermitian matrices. For now, random Hermitian matrices with size 2 are obvious to construct. But elegant methods for higher dimension would be nice! Are there methods besides ...
0
votes
0answers
34 views

Handling a matrix with components greater than machine precision

I have four quantities stemming from a 4th order differential equation. I can represent these as a vector which is a product of a 4X4 matrix $$ M=\left\{v,\frac{\partial v}{\partial x},\frac{\partial ...
3
votes
3answers
118 views

How can I make custom accumulated sequences like the following?

First of all, I don't really know how to formulate the question, so if you understand my question and know a better way to phrase it, please revise. I have the following Matrixes: ...
2
votes
1answer
455 views

Understanding the difference between matrix indices and image coordinates in context of ListDensityPlot

In Mathematica help it's written that: ListDensityPlot[array] -> generates a smooth density plot from an array of values. ...
2
votes
2answers
73 views

Problem with ArrayFlatten to concatenate matrix

I would like to concatenate 2 matrix : - the first which is a line of 2 elements - the second which is a matrix of 2-2 elements I use the following code : ...
6
votes
2answers
72 views

A problem about matrix/vector extension via $\tt ArrayPad$

Given that I have a vector and matrix as follow: vec = Array[Subscript["P", #] &, 6, 0]; mat = Array[Subscript["P", #1, #2] &, {5, 4}, {0, 0}]; And I ...
2
votes
1answer
59 views

Eigenvalues are not the same in the special case

I have this matrix: h = { {e1, 2, x}, {2, 2, x}, {x, x, 2} }; I want to calculate the eigenvalues and then set x equal to zero: ...
6
votes
1answer
69 views

Matrix Multiplication after “Flatten”

Say we originally had two matrices, $A$ and $B$, both $n \times n$, whose product $$ C= A.B $$ Now I flatten $A$. I can obtain a flatten $C$, from the following multiplication $$ ...
15
votes
5answers
549 views

A quicker than outer

I need to get a matrix $\{a(x_i-x_j)\}$, where $x_i$ form a partition of an interval, $a(x)$ is a given function. I use ...
2
votes
3answers
80 views

How can I create a dynamic Matrix inside a function?

I have a function where a n parameter is handed and a list of values is calculated inside of it. I then need to solve a linear system of equations that require me ...
1
vote
1answer
99 views

Visualizing Matrix that represents a network

I have a nxn matrix $A$ that represents a network. I have $n$ nodes in the network, and the matrix $A$ represents the number of connection (edges) between the different nodes. For example, if $A$=0, ...
3
votes
2answers
287 views

Understanding polyharmonic splines

Rahul Narain and J.M. gives implementation of the thin plate polyharmonic splines in this post. Rahul Narain's method is clear. J.M.'s is convenient to reuse. But J.M. used too many ...
0
votes
1answer
67 views

errors in simple for loops

Im trying to run the following code, which I have translated from Matlab. I created a for loop nested inside another for loop. mW is a matrix, and ...
4
votes
1answer
201 views

how can i associate the headings of columns/rows with content of itself and then recall what i want after i've imported the excel file in mathematica

Hello, i make another try... I have to import a file like this below (it is an excel file, i show you just the beginnig. it should have thousend of rows and columns). After i've imported the file i ...
0
votes
1answer
47 views

Output of Coefficientrules into Jacobian matrix

I have a pair of large polynomials in u, v, a1...a9 and b1...b9, generated by ...
0
votes
2answers
49 views

Enlarge a matrix and fill in zeros [closed]

Suppose I have a dynamically generated 4-dimensional matrix L in the shape shape={d1, d2,d3,d4}, and ...