Tag Info

Hot answers tagged

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

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 ...


5

For the love of this fine site, please post copyable code along with accompanying images the next time! Anyway: myb1 = {{{{1, 2}, {1, 2}}, {{2, 3}, {3, 4}}}, {{{5, 2}, {8, 2}}, {{1, 2}, {1, 2}}}}; Map[MatrixPower[#, 2] &, myb1, {2}] {{{{3, 6}, {3, 6}}, {{13, 18}, {18, 25}}}, {{{41, 14}, {56, 20}}, {{3, 6}, {3, 6}}}} Map[#.# &, ...


4

Instead of While[i<21,...], use Table[...,{i,20}]. The ... part can be reduced to r = k[[a[[i]]]]; Factor[Det[r]] To find the PolynomialLCM, simply replace the head ( List) of the table with PolynomialLCM using Apply, or @@ for short: PolynomialLCM @@ Table[...,{i,20}]


4

Matrices (and also vectors and other tensors) are multipled using Dot. Using your code, just replace * by . (I also removed all ('s and )'s as they don't do anything in this context. {{x, y, 1}}.{{a, b/2, d/2}, {b/2, c, e/2}, {d/2, e/2, f}}.{{x}, {y}, {1}} Result:


3

In general, the relation between an original matrix and the eigenvalue decomposition is the following: m = RandomReal[1, {5, 5}]; {eval, evec} = Eigensystem[m]; Norm[Transpose[evec].DiagonalMatrix[eval].Inverse@Transpose[evec]-m] which outputs 0. So, in order to diagonalize the matrix m, we have to evaluate Inverse[u].m.u with u=Tranpose@Eigenvectors@m.


2

Just use the same syntax as in your link: SUNTrace[Commutator[SUNT[SUNIndex[a]], SUNT[SUNIndex[b]]] Commutator[ SUNT[SUNIndex[c]], SUNT[SUNIndex[d]]], Explicit -> True] EDIT: Addressing additional question from OP's comments The thing is that if you write SUNTrace[SUNT[SUNIndex[a]].SUNT[SUNIndex[b]].SUNT[SUNIndex[c]].SUNT[SUNIndex[d]‌​], ...


2

The following function will calculate the eigensystem numerically when provided with numerical values of $j$ and $q$. This is, I believe, what @Szabolcs was referring to in his comment. I wonder if this is what you mean when you ask for a "numerical solution". Clear[eigen] eigen[jj_?NumericQ, qq_?NumericQ] := Chop@Eigensystem[N[f /. {j -> jj, q -> ...


2

I had actually answered this in a different thread that was eventually closed. Since that answer fits perfectly for this question, I'll use it here: I will use $\sigma$ as an abbreviation for PauliMatrix. The goal is to get back a result in terms of the symbolic matrices $\sigma$. Fortunately, this can always be done because the Pauli matrices when ...


2

Try the following: SetAttributes[simplifyPM, HoldFirst] simplifyPM[expression_] := Module[ {intermediate}, intermediate = HoldForm[expression] //. PauliMatrix[a_].PauliMatrix[a_] :> IdentityMatrix[Dimensions[PauliMatrix[a]]]; intermediate /. IdentityMatrix[_].m_?MatrixQ :> m ] You can then use it as follows: results = ...


2

Here is a simpler answer: adj[m_] := Inverse[m] Det[m]


2

Replace the Print[det] in the print with: Paste[det]


1

\[GothicCapitalR] = {{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{0, 1, 0}, {0, 0, 1}, {1, 0, 0}}, {{0, 0, 1}, {1, 0, 0}, {0, 1, 0}}, {{1, 0, 0}, {0, 0, 1}, {0, 1, 0}}, {{0, 0, 1}, {0, 1, 0}, {1, 0, 0}}, {{0, 1, 0}, {1, 0, 0}, {0, 0, 1}}}; i = 1; j = 1; det = 1; a = Subsets[Range[6], {3}]; v = {x, y, z}; k = \[GothicCapitalR].v; PolynomialLCM @@ ...


1

First of all, the desired result Composition[f1, f2][x] auto-evaluates to something slightly different: Composition[f1, f2][x] (* ==> f1[f2[x]] *) If that's OK with you, then I could simply re-use my answer to Having the derivative be an operator, without the first two lines in which I define the specific action of the operators as derivatives. So all ...



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