Tag Info

Hot answers tagged

7

b = {{1, 1, 0, 0, 0, 0}, {1, -1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1}, {-1, -2, -3, -3, -3, -3/2}}; h = NullSpace@b (* {{0, 0, -1, 0, 1, 0}, {0, 0, -1, 1, 0, 0}} * MatrixRank@Join[b, h] (* 6 *)


7

Update: it seems this only works in 10.1 and later, but not in 10.0. This works: Assuming[(a | b | c) ∈ Matrices[{d, d}], TensorExpand@Transpose[a.(b + c)]] (* Transpose[b, {2, 1}].Transpose[a, {2, 1}] + Transpose[c, {2, 1}].Transpose[a, {2, 1}] *) We needed to tell Mathematica that a, b and c are square matrices and use TensorExpand. Check here: ...


7

As indicated in the comments, machine-precision linear algebra operations in Mathematica use the Intel MKL library optimized implementation of BLAS/LAPACK. That is the case for all platforms where MKL is available: Windows, Linux and Mac OS X (there will be no obvious MKL library files present in the layout on OS X in 10.1 or later due to static linking). ...


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:


4

As an extended side note, p = Map[KroneckerProduct[#, #] &] @ Map[Normalize] @ vecs; (* You can use Orthogonalize instead of Map[Normalize], too *) generates a projection matrix that projects any matrix onto your known subspace, and it can be used to subtract off that piece. Examining this matrix, p (* {{1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, ...


3

Just to separate this from a package-based answer. In Mathematica 10.2, you can now do this with the built-in function SmithDecomposition. So using the same matrix from my previous answer: mat = {{1, 2, 3}, {-2, 3, 1}, {3, 2, 1}}; MatrixForm /@ SmithDecomposition[mat] Where the second element is the Smith normal form.


2

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


2

As @GuessWhoItis mentioned, some or all of this can be done analytically. But I'll answer your question regarding Mathematica syntax, as it seems to be the goal of what you're trying to achieve here. Mathematica does not recognise "i" being a variable in "ci". The best way to deal with this is to define cVector=Table[c[i],{i,n}]; or alternatively, ...


2

[This is what Wolfram tech support told me when I filed a bug report:] That is because using machine precision (inexact) numbers such 0. (as opposed to exact numbers like 0) forces Eigenvectors[] to seach for eigenvectors numerically and hence the error message. For example, please evaluate and compare the results of the following expression used with ...


2

I am not sure what a valid transpose of a StateSpaceModel is but here is an attempt: ssm = StateSpaceModel @ TransferFunctionModel[{{a^2/(s^2 + b s + c)}}, s] Transpose /@ #[[{1, 3, 2, 4}]] & /@ ssm


2

Using @Guess comment answer, but spelled out in more detail: a = {{1, -3, 2, -2}, {3, -2, 0, -1}, {2, 36, -28, 27}, {1, -3, 22, 5}}; L = {{1, 0, 0, 0}, {b, 1, 0, 0}, {c, d, 1, 0}, {e, f, g, 1}}; U = {{1, -3, 2, -2}, {0, h, i, j}, {0, 0, k, l}, {0, 0, 0, m}}; result = {L, U} /. First @ Solve[L.U == a]; MatrixForm /@ result Note that matrix multiplication ...


1

There is a LUDecomposition function in Mathematica: a = {{1, -3, 2, -2}, {3, -2, 0, -1}, {2, 36, -28, 27}, {1, -3, 22, 5}}; n = Dimensions[a][[1]]; {LU, MP, MC} = LUDecomposition[a] LU = First[LUDecomposition[a]] L = LU * SparseArray[{i_, j_}/; j<i -> 1, {n, n}] + IdentityMatrix[n] U = LU * SparseArray[{i_, j_}/; j>=i -> 1, {n, n}] L.U


1

Simplify@Eigenvectors[{{Cos[0. + x], Exp[I x]}, {1, 0}}] $\left( \begin{array}{cc} e^{-1. i x} \left(-0.25 \sqrt{1.+2. e^{2 i x}+16. e^{3 i x}+e^{4 i x}}+0.25 e^{2. i x}+0.25\right) & 1. \\ 0.25 e^{-1. i x} \left(\sqrt{1.+2. e^{2 i x}+16. e^{3 i x}+e^{4 i x}}+e^{2. i x}+1.\right) & 1. \end{array} \right)$


1

For a numerical approximation you may try something like: M = {{s, ab, ac}, {ab, s, bc}, {ac, bc, s}}; disc = Discriminant[CharacteristicPolynomial[M, x], x] // FullSimplify f[e_] := 2 Norm[e]^-3 (1 - 3 Sin[θ]^2 Cos[φ - ArcTan[e[[1]], e[[2]]]]^2) Cos[{x, y}.e]; ab = f[{1, 0}]; ac = f[{0, 1}]; bc = f[{1, 1}] + f[{-1, 1}]; s = f[{2, 0}] + f[{0, 2}]; ...


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


1

To settle this once and for all: Consider the Jordan decomposition of a symbolic generalization of your matrix: jd[x_, y_] = JordanDecomposition[{{1, x + I y}, {x + I y, -1}}] whose explicit expression is {{{(1 - Sqrt[1 + x^2 + 2 I x y - y^2])/(x + I y), (1 + Sqrt[1 + x^2 + 2 I x y - y^2])/(x + I y)}, {1, 1}}, {{-Sqrt[1 + x^2 + 2 I x y - ...



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