# Tag Info

15

This bug has been fixed in V10 mat = {{7/2 - I/2, -1 + I, 1/2 + 5 I/2}, {-1 + I, 5 + I, -1 + I}, {1/2 + 5 I/2, -1 + I, 7/2 - I/2}}; Eigensystem[mat] Gives: {{6, 3 + 3 I, 3 - 3 I}, {{1, -2, 1}, {1, 1, 1}, {-1, 0, 1}}} \begin{array}{ccc} 6 & 3+3 i & 3-3 i \\ \{1,-2,1\} & \left\{1,1,1\right\} & \{-1,0,1\} \\ \end{array}

12

With the understanding that the criterion for including a point in the 3D matrix is that it has 3 unique domains in any of the 26 points surrounding a zero value in the watershed here is a simple way to extract the data. In the case where zero values in the watershed are in minority it may be the fastest approach to getting a list of points that fulfill the ...

9

The order of eigenvalues is the most convenient order for the algorithm, which find these eigenvalues. You can always order them as you want very simply a = # + #\[Transpose] &@RandomReal[1, {10, 10}]; {ε, ψ} = Eigensystem[a]; {ε, ψ} = {ε[[#]], ψ[[#]]} &@ Ordering[ε]; Furthermore, the eigenvalues can be complex for non-Hermitian matrices. There is ...

9

The Susyno and LieART Mathematica packages can do this. I know best the first one (I wrote it), so let me use it as an example in this answer. Assuming that you have installed and loaded the package in a Mathematica session, your example ($\mathbf{10}\times\mathbf{27}$ in $SU(3)$) is computed as follows: ReduceRepProduct[SU3, {{3, 0}, {2, 2}}] This ...

8

a = RandomReal[{0, 1}, {2, 8}]; b = RandomReal[{0, 1}, {2, 8, 2}]; a.# & /@ b {{{2.58906, 3.35618}, {2.5578, 3.12812}}, {{1.3762, 2.87723}, {1.56668, 3.04675}}}

8

To verify that matrix is a zero of its characteristic polynomial, The Characteristic polynomial of the matrix is found, then evaluated for the matrix. The result should be the zero matrix. Clear[x] a = {{-1, -4, -2}, {0, 1, 1}, {-6, -12, 2}}; n = Length[a]; p = CharacteristicPolynomial[a, x]; (Sum[ Coefficient[p, x, i] MatrixPower[a, i], {i, 0, Exponent[p, ...

8

You are correct to say that this is a problem with the precision of the numbers involved. You can set the precision of those numbers explicitly: SetPrecision[{{3.9999999999998025*^14 + 0.001*I, 3.141592653589793 - 3.1405926535897932*I}, {3.141592653589793 - 3.1405926535897932*I, 3.9999999999998025*^14 + 0.001*I}}, 20]; Eigenvalues[%] (* ...

7

You have to be a bit careful here; your last approach does not give the desired matrix F: (LinearSolve[dV, dv] // Transpose).dV === dv False Then what does give the correct output? We can use the fact that for generic matrices $A$ and $B$ we have $A.B = (B^T.A^T)^T$ and write F = Transpose @ LinearSolve[Transpose @ dV, Transpose @ dv] And indeed, ...

7

You are apparently looking for a way to reliably compare two numerical matrices by using their eigensystems. This can always be done for normal matrices by using the eigenvectors to construct their spectral decomposition. To do that, you shape the eigenvectors into the equivalent system of projectors. Then you can compare the projectors instead. The good ...

7

Here is an approach that might work out. Use GroebnerBasis to set up all polynomial relations, then reduce to see where there may be linear dependencies. We use surrogate variables to define algebraic relations for roots and reciprocals, so sx stands in for sqrt(x) below, and similar for the reciprocal variables xr1 and sxr2. We also use new variables to ...

7

Matlab is the fertile soil of bad Mathematica programming... try baseGenerator2[m_Integer, n_Integer] := Reverse@Sort[Join @@ Permutations /@ IntegerPartitions[n, {m}, Range[n, 0, -1]]] And for your own sanity, don't use uppercase initials on symbols - you may very well clash with built-ins and/or create debugging nightmares (e.g. N is a built-in, by ...

6

The compatibility information at Compatibility/tutorial/LinearAlgebra/MatrixManipulation says These functions were available in previous versions of Mathematica and are now available on the web at library.wolfram.com/infocenter/MathSource/6770: LinearEquationsToMatrices InverseMatrixNorm ConditionNumber You can download the original package ...

6

Mathematica actually has a function purpose-built for the operation you're looking for. MatrixFunction[f, m] gives the matrix generated by the scalar function f at the matrix argument m. In your case, MatrixFunction[p, A] will return the 3-by-3 zero matrix, as desired.

6

Experimentation based on the documentation you quoted led to two valid Method options: MatrixExp[{{1.2, 5.6}, {3, 4}}, Method -> "Pade"] {{346.557, 661.735}, {354.501, 677.425}} MatrixExp[{{1.2, 5.6}, {3, 4}}, {1, 2}, Method -> "Krylov"] {1670.03, 1709.35} If "Krylov" is used for the single parameter syntax it complains: MatrixExp[{{1.2, ...

5

This is a bit long for a comment. You can use a tandem of LinearSolve and NullSpace. But for exact problems this will, I'm fairly sure, use dense matrices. That takes you back to what Solve is doing anyway, under the hood. Assuming your inputs are integer or rationals you might avoid dense matrix algebra as follows. Use numerical methods to find a single ...

5

Ok, I'll go ahead and answer my own question. After some thinking I came up with this: getIntersection[l1_, l2_] := Module[{n, ker, coeffs}, ker = NullSpace[Transpose[Join[l1,l2]]]; n = Length[l1]; coeffs = Map[Function[v, v[[1 ;; n]]], ker]; Return [Map[Function[v, v.l1], coeffs]]; ]; Can this be made any faster?

5

Dense blocks One can split matrices by blocks and use these blocks as a dense matrices blockSize = 100; m1[a_] m2[b_] ^:= a.b; part = DeveloperPartitionMap[If[Length@#@"NonzeroValues" > 0, m1@Normal@#, 0] &, a, {blockSize, blockSize}]; a2.u_ ^:= Flatten[DeveloperToPackedArray[ part.Developer`PartitionMap[m2, u, blockSize]], 1] I have ...

5

The LinearAlgebra package has been deprecated since Mathematica 5, and is no longer bundled with Mathematica 9 or newer. You can still download a part of it (which contains the MatrixConditionNumber function) at the URL that jtbandes gave in his answer. First, we need to load the package: (* Be sure to install the above linked package in a "LinearAlgebra" ...

5

The problem here can arise because of numerical underflow which appears for sufficiently large dimension of the problem. Some numerically very small number multiplies the parameter "a" and therefore "a" does not appear in the "solution". Consider a simple example Define the matrix m (fill it with random numbers, here exponentially distributed) In[263]:= ...

5

The two eigenvalues are degenerate. In general whenever you have degenerate eigenvalues there is arbitrariness in how to select the eigenvectors. You can construct a constant vector from the two degenerate eigenvectors like so: m = Import["https://dl.dropboxusercontent.com/u/63413473/ExampleMatrix.mx"]; {evals, evecs} = Eigensystem[m, -2]; You can check ...

5

Matrix multiplication is built in in Mathematica. Just use the dot for multiplication. Here are two 2x2 matrices a = PauliMatrix[1] b = PauliMatrix[3] (* Out[49]= {{0, 1}, {1, 0}} *) (* Out[50]= {{1, 0}, {0, -1}} *) Here's a product a.b (* Out[53]= {{0, -1}, {1, 0}} *) and here is the product of the same factors in reverse order b.a (* Out[52]= ...

5

Maybe MapThread gives the levelspec control you need: lst = {{{a, b}, {c, d}}, {{w, x}, {y, z}}}; g @@ MapThread[f, lst, 1] (* or just g @@ MapThread[f, lst] -- thanks: Mr.W *) (* g[f[{a,b},{w,x}],f[{c,d},{y,z}]] *) g @@ MapThread[f, lst, 2] (* g[{f[a,w],f[b,x]},{f[c,y],f[d,z]}] *) or, g @@ Thread[f @@ lst] (* g[f[{a,b},{w,x}],f[{c,d},{y,z}]] *) or ...

5

No, it is not doing a Gram-Schmidt procedure. One way to note that this is distinct from Gram-Schmidt is that Gram-Schmidt produces an orthonormal basis, whereas the example outputs in the Documentation Center page for LatticeReduce are neither normalized nor orthogonal. Instead, LatticeReduce returns a basis $B$ comprised of linear combinations of integer ...

5

You can also use (a.b\[Transpose])\[Transpose] or, equivalently, Transpose[a.Transpose[b]] to get the same result. a = RandomReal[{0, 1}, {2, 8}]; b = RandomReal[{0, 1}, {2, 8, 2}]; c = a.# & /@ b; (* from Sjoerd's answer *) (a.b\[Transpose])\[Transpose] == c (* True *)

5

In addition to using Solve one can augment the matrix by a row containing the modulus in each position and use HermiteDecomposition. Any zero row (modulo the modulus) in the resulting HNF corresponds to a null vector in the conversion matrix. i1 = IntervalDifferenceMatrix[{{0}, {1}, {4}}]; i2 = Append[i1, ConstantArray[12, 3]]; {uu, hnf} = ...

5

One way is shown below. Alternatives include using Simplify with Assumptions, again on testing that the eigenvalues are nonnegative. Resolve[ ForAll[p, 0 <= p <= 2, And @@ Thread[ Eigenvalues[{{1, 0, 0, Sqrt[1 - p]}, {0, 0, 0, 0}, {0, 0, p, 0}, {Sqrt[1 - p], 0, 0, 1 - p}}] >= 0]]] (* Out[9]= True *)

5

Any square matrix can be put into Jordan normal form via a similarity transformation; and for a matrix in Jordan normal form, the geometric and algebraic multiplicities of the eigenvalues are determined by its block structure. So you could take the following approach: generate a Jordan matrix with the appropriate multiplicities, and then perform a random ...

5

I think the function you are looking for is CoefficientArrays; here is its documentation. Your system is quite complex so I will let you deal with its intricacies, but here is a demonstration on a toy example. Let's define a set of linear equations in $x$, $y$, and $z$: eqns = {2 x - y + 4 z == 12, 3 x + 2 y + z == 10, -y + z == 1}; The solutions of ...

5

Apologies for the procedural approach, but this seems to work. Trace out one line at a time, using Interpolation to extrapolate where the next point is likely to be: c = {}; frames = {}; xvals = Pi Range[-1, 1, 1/100]; alle = Table[({y, #} & /@ Eigenvalues[m]), {y, xvals}] ; colors = Table[Hue[RandomReal[{0, 2/3}]], {Length@m}]; Clear[g]; Monitor[ Do[ ...

4

Ordering[Norm /@ Last @ N[Eigensystem[system]]]; gives you the ordering by norm. You can apply this on your eigenvalues and eigenvectors, e.g. Eigenvectors[system][[%]] EDIT To apply this on a list of matrices: (# &@Ordering[Norm /@ N[#]]) & /@ Eigenvectors[#] & /@ {mat1,mat2,...,matn}

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