Questions on the linear algebra functionality of Mathematica.

learn more… | top users | synonyms

6
votes
5answers
3k views

Computing eigenvectors and eigenvalues

I have a (non-sparse) $9 \times 9$ matrix and I wish to obtain its eigenvalues and eigenvectors. Of course, the eigenvalues can be quite a pain as we will probably not be able to find the zeros of its ...
6
votes
2answers
320 views

How to estimate the matrix condition number in the 2-Norm?

The Mathematica documentation say it is possible to estimate the Matrix condition number in norm 1, 2, Infinity. But the 2-Norm raise a message. This is an extract from reference documentation ...
6
votes
1answer
444 views

Eigenvector corresponding to a specific eigenvalue already found earlier

just a quick question that is very simple but somewhat hard to explain. I am using 4 specific eigenvalues of a large 80x80 k-dependant matrix. I found the 4 eigenvalues of interest for various k and ...
6
votes
1answer
254 views

How to create a large sparse block matrix

I need to generate a very large sparse block matrix, with blocks consisting only of ones along the diagonal. I have tried several ways of doing this, but I seem to always run out of memory. The ...
6
votes
1answer
678 views

Fastest way to do vector / matrix multiplication with constant matrix

Suppose we have a fixed n x n matrix, call it $B$. What is fastest way to evaluate $v^t B\;v$ over many different vectors $v$? Since $B$ is a constant matrix, does this allow the number of operations ...
6
votes
1answer
212 views

Computations in the exterior algebra

I want to be able to compute with explicit exterior algebras of vector spaces. For example, given a real vector space $V$ of $3 \times 3$ matrices, I want to consider expressions of the form $v\wedge ...
6
votes
1answer
233 views

Is matrix multiplication automatically done in parallel in Mathematica 9?

In good old Mathematica versions (5.2, 6.0), matrix multiplication was automatically done in parallel. For example, on an 8-core machine, define two square real matrices: ...
6
votes
1answer
119 views

LinearSolveFunction unusable if stored to disk?

I encounter a problem when saving a LinearSolveFunction to disk, where the LinearSolveFunction is obtained with LinearSolve for ...
6
votes
0answers
163 views

Calculating the rank of a huge sparse array

By virtue of the suggestion in my previous question, I constructed the sparse matrix whose size is $518400 \times 86400$, mostly filled with $0$ and $\pm 1$. Now I want to calculate its rank. Since ...
6
votes
0answers
243 views

How to produce the ILU0 or ILUT as stand-alone procedures on sparse matrices?

Mathematica uses the ILU0 procedures automatically to precondition large sparse linear systems; e.g. ...
6
votes
0answers
294 views

Inverse of a large sparse Hermitian block matrix

I am looking for a method (if it exists) for the inverse of a large sparse Hermitian block matrix. The off diagonal sparse matrices, named δ are 4x4, and they have ...
5
votes
1answer
2k views

Simpler way of performing Gaussian Elimination?

Is there a simpler way of performing Gaussian Elimination other than using RowReduce? Such as a single built in function? Edit: Look at the example from our simulation class. Not too difficult, but ...
5
votes
6answers
750 views

A matrix-vector cross product

I want to do a cross product involving a vector of Pauli matrices $\vec \sigma = \left( {{\sigma _1},{\sigma _2},{\sigma _3}} \right)$; for example, $\vec \sigma \times \left( {1,2,3} \right)$. ...
5
votes
4answers
737 views

How to find the index of a square matrix in Mathematica quickly?

Let $A$ be an $n\times n$ complex matrix. The smallest nonnegative integer $k$ such that $\mathrm{rank}(A^{k+1})=\mathrm{rank}(A^{k})$, is the index fo $A$ and denoted by $\mathrm{Ind}(A)$. I would ...
5
votes
1answer
246 views

Symbolic linear algebra

I would like to know how I can ask Mathematica to expand (and simplify) such an expression : $$ (\alpha A + \beta B)^\top (\alpha A + \beta B) $$ where $\alpha,\beta$ are two real numbers and $A,B$ ...
5
votes
3answers
560 views

How to solve an eigensystem faster?

I have a module that I need to call 1-10 million times in my program. Currently, it is taking several hours to run so I am hoping that I can cut down some runtime with your help. ...
5
votes
2answers
303 views

Faster Eigenvalues with lower precision goal

I compute all eigenvalues of a large matrix, and I decide that the speed is more important than the precision. Then the question is, can I speed up Eigenvalues[] by ...
5
votes
1answer
1k views

Solving a system of linear equations modulo n

I have a system of linear equations $$ a+b+c \equiv 31 \pmod{54} $$ $$ 4a+2b+c \equiv 3 \pmod{54} $$ $$ 9a+3b+c \equiv 11 \pmod{54} $$ What should I input (I'm using ...
5
votes
1answer
533 views

Finding the characteristic polynomial of a matrix modulus n

Given a square matrix, is it possible to calculate its characteristic polynomial modulo n? Unfortunately, this function ...
5
votes
3answers
125 views

Missing control for depth of Inner

Working on a mechanics problem, I stumbled on something peculiar: Since Inner is a generalisation of Dot, it changes its ...
5
votes
3answers
133 views

Assuming reals of unknown variables in a Matrix valued function

I am trying to write a generic matrix valued function in a package, of the form: f[matrix_] := Module[...] My problem is that I want to accept any matrix, but ...
5
votes
2answers
3k views

Solving a tridiagonal system of linear equations using the Thomas algorithm

I'm trying to write a function that can solve a tridiagonal system of linear equations using the Thomas algorithm. It basically solves the following equation. (Details can be found at the Wiki page ...
5
votes
1answer
575 views

Octonions in Mathematica

Is there a package or Notebook for Mathematica that can enable me to do some numerical calculations with octonions? Maybe a way to plug-in the octonion multiplication table?
5
votes
1answer
337 views

Obtaining a thin/compact SVD

I'm using SingularValueDecomposition for a least-squares regression, the instruction that works fine for what I need is ...
5
votes
3answers
838 views

Solution for equation system with piece-wise defined functions

As I could swear this worked just yesterday, I am probably just doing something stupid here and I am sorry to bother you :) I am trying to find the point where a curve crosses a line. In this case, ...
5
votes
2answers
253 views

Computing the sign of the real part of eigenvalues in a 3D linearized system with 3 parameters

So I have this dynamical system given by: $$ \left\{\begin{aligned} x' &= a(y-\phi(x))\\ y' &= x-y+z\\ z' &= -by \end{aligned}\right. $$ where $\phi(x) = \mu x^3 - \nu x$ and $a,b,\mu,\nu$ ...
5
votes
2answers
639 views

Can the CholeskyDecomposition function in Mathematica be made to work on non-symmetric matrices?

The CholeskyDecomposition[m] function in Mathematica requires a symmetric and positive definite matrix m. For instance, the ...
5
votes
2answers
1k views

How do I keep the right ordering of eigenvalues using Eigensystem?

I'm having an issue with the Eigensystem command. I need to diagonalize a bunch of 3 by 3 complex valued matrices, but more importantly, I need to keep the exact ...
5
votes
1answer
397 views

Tridiagonal symmetric matrix eigenvalue using bisection

I know that Eigenvalues is already quite well implemented in Mathematica, nor am I foolishly trying to improve on it. In order to improve my programming skills, I ...
5
votes
0answers
145 views

Is it possible to implement symbolic sub matrices?

The accepted answer in the following link: http://stackoverflow.com/questions/5708208/symbolic-matrices-in-mathematica-with-unknown-dimensions provides a functionality to create symbolic matrices ...
5
votes
0answers
951 views

Solve huge symbolic system of linear equations

I have a system of 76 symbolic linear equations (i.e. some coefficients are symbolic) with a sparse coefficient matrix. However, neither Solve[] nor ...
4
votes
3answers
1k views

Trying to simplify Root expressions from the output of Eigenvalues

I am trying to calculate eigenvalues of a sparse matrix with only two distinct non-zero elements, here Alpha and Beta, which are both negative reals. Mathematica returns some complex expressions with ...
4
votes
2answers
1k views

Gram Schmidt Process for Polynomials

I want to implement the Gram Schimdt procedure to the vector space of polynomials of degree up to 5, i.e. I want to find an orthogonal basis from the set of vectors $v=(1,x,x^2,x^3,x^4,x^5)$. The ...
4
votes
3answers
262 views

Approximate minimum degree permutation algorithm in Mathematica

In MATLAB there is a nice implementation of the so called AMD (approximate minimum degree permutation) algorithm named amd (see Online MATLAB Documentation). There is an alternative algorithm called ...
4
votes
2answers
271 views

Simplifying the trace of a matrix expression

I have a long expression involving matrices that I derived using the NCAlgebra package. Can I simplify the trace of the expression? For example, say b is a scalar ...
4
votes
3answers
663 views

Compute the rank of a matrix with variable entries

Say I have a matrix like $$ M=\left( \begin{array}{c c c} x & xz & w-2x \\ wz^3 & xy & z \\ y^2-z^3 & x+w & z+x^5 \end{array} \right) $$ is it possible to ask Mathematica ...
4
votes
3answers
101 views

A Product function for matrix products

I would like to use an equivalent of the product-function in mathematica, but where instead of multiplying numbers I multiply matrices?
4
votes
2answers
296 views

Should eigenvalues be ordered?

When I run Eigensystem on a symmetric matrix, the list of eigenvalues (and so, the corresponding eigenvectors) is ordered by absolute values, which is quite bizarre (it does make sense if you view the ...
4
votes
1answer
170 views

Implementing Bilinear Products

Consider a real, vector space $V$ with basis $B=\{v_1,v_2,\dots\}$, and let $\star:V\times V\to\mathbb R$ be a bilinear product on $V$. I would like to implement this product in Mathematica by ...
4
votes
1answer
296 views

How to fix errors in Gram-Schmidt process when using random vectors?

I first make a function to get a random vector on unit sphere in a swath around the equator. That is what the parameter $\gamma$ controls; if $\gamma = 1/2$, the vectors can be chosen anywhere on the ...
4
votes
1answer
152 views

Generating random symmetric matrix

Suppose first that I want to generate a matrix whose elements are i.i.d. with distribution dist. This is easy: ...
4
votes
1answer
491 views

Efficient method for inverting a block tridiagonal matrix

Is there a better method to invert a large block tridiagonal Hermitian block matrix, other than treating it as a ordinary matrix? For example: ...
4
votes
2answers
498 views

ordering of functional eigenvalues

Is there any order to the symbolic eigenvalues of a matrix returned by the command Eigenvalues[...]? While numerical eigenvalues are listed in descending order ...
4
votes
1answer
573 views

Computing Slater determinants

I need to compute Slater determinants. I'm wondering if I would benefit from assigning each of my functions to a variable prior to computation. I'm working with Slater determinants, but my question ...
4
votes
1answer
249 views

Sporadic bug in Mathematica 7.01.0 MatrixPower and/or Eigensystem functions on floating-point symmetric matrices with repeated eigenvalues

Note: From the comments submitted below by other StackExchange users it appears that this apparent bug was fixed sometime after version 7.0.1. I asked a vague variant of this question a few days ago, ...
4
votes
0answers
168 views

Discriminant of Characteristic Polynomial

I'm doing a calculation which finds the characteristic polynomial of a matrix with rather complex entries and then determines the discriminant of that polynomial. For smaller matrices up to around 7x7 ...
4
votes
0answers
239 views

NullSpace[_, Method->“OneStepRowReduction”] is sometimes wrong; how can I work out when this happens?

(This is on MMA 7.0.1.0 on OS X) I've just found a large matrix m for which NullSpace[m] and ...
3
votes
2answers
492 views
3
votes
3answers
306 views

Correct way to populate a DiagonalMatrix?

I would like to create a series of correlation matrices that starts with : sensMat[[1]] = DiagonalMatrix[ { 1,1,1,1,1 } ]) // MatrixForm and iterates in 0.1 ...
3
votes
2answers
1k views

Linear equation with complex numbers

I have to solve an equation of the type $$a z+b \overline{z}=c$$ with $a,b,c\in\mathbb{C}$. My approach is to set $F(z)=a z+b \overline{z}-c$ transform $z$ to $x+i y$ and then get a real linear ...