Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 6358

Questions on the manipulation of matrices in Mathematica.

6 votes

Calculating the equilibrium value of a discrete time system in matrix form?

Such a system for arbitrary $A$ has only the trivial equilibrium $x=0$. In this case you're lucky that the dominant eigenvalue of $A$ is 1. In this case, the equilibrium is proportional to the corre …
Chris K's user avatar
  • 20.4k
5 votes
Accepted

How do I create a n*n matrix with a Do loop?

Better to use Table: n = Input["What positive integer would you like to start your matrix with?"]; Table[i + j*n, {j, 0, n - 1}, {i, n}] …
Chris K's user avatar
  • 20.4k
19 votes
1 answer
497 views

Efficiently defining a SparseArray function

I've got a fairly large SparseMatrix (~60,000 entries in a ~10,000-by-10,000 matrix) that depends on two parameters (im1 and im2). It's made from eight parts and is mostly banded, plus a top row. … Looking at timings, I see that setting up the matrix is 3X slower than finding the eigenvector: RepeatedTiming[tm = TM[1., 2.];] (* {0.32, Null} *) RepeatedTiming[Eigenvectors[tm, -1, Method -> "Arnoldi …
Chris K's user avatar
  • 20.4k
10 votes

Tracking Eigenvalues Through a Crossing

Because your matrix is symmetric, $\vec u$=$\vec v$. First, a function to find the (right) eigenvector corresponding to a given eigenvalue, based on this answer by @mikado. Eigenvector[mat_, λ_? … Next, a function to compute the change in the eigenvalue with respect to the parameter (assuming symmetric matrix): dλ[λ_?NumericQ, b_?NumericQ] := Module[ {v = Eigenvector[H /. B -> b, λ]}, v. …
Chris K's user avatar
  • 20.4k
8 votes

Tracking Eigenvalues Through a Crossing

Here's another CharacteristicPolynomial-free approach, this one using Eigenvalues[Method -> "Arnoldi"] to find a single eigenvalue, then tracking it over parameter values using linear extrapolation (o …
Chris K's user avatar
  • 20.4k
1 vote
Accepted

Find the parameter values for my matrix for it to have imaginary eigenvalues

NumericQ] := Max[Re[Eigenvalues[a /. u -> v]]] Plot[maxev[u], {u, -10, 10}, PlotRange -> {0, 10}] Your 3x3 example matrix doesn't seem to have any points with Re[eigenvalue]=0, so let me modify it: …
Chris K's user avatar
  • 20.4k
5 votes
Accepted

I want to improve my algorithm of knowing eigenvalues of the matrix H(k)

The biggest speed-up comes from constructing H only once, not every time in the main loop. I also avoided the For loop in saving your results, which repeatedly called Eigenvalues. n = 100; M = 0.4; …
Chris K's user avatar
  • 20.4k