8

You can use Subsets: mat = Array[Subscript[a, ##]&, {6, 6}]; TeXForm @ MatrixForm @ mat $\left( \begin{array}{cccccc} a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} & a_{1,5} & a_{1,6} \\ a_{2,1} & a_{2,2} & a_{2,3} & a_{2,4} & a_{2,5} & a_{2,6} \\ a_{3,1} & a_{3,2} & a_{3,3} & a_{3,4} & a_{3,5} &...


7

Control`PCS`SmithForm[A, λ] // MatrixForm // TeXForm $\left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 & \lambda & 0 \\ 0 & 0 & \lambda (\lambda +1) \\ \end{array} \right)$


6

The Wolfram Function Repository has a (recently added) function for this. amat = {{1 - lam, 2 lam - 1, lam}, {lam, lam^2, -lam}, {1 + lam^2, lam^3 + lam - 1, -lam^2}}; ResourceFunction["PolynomialSmithDecomposition"][amat] (* Out[3320]= {{{0, -1 - lam - lam^2, 1 + lam}, {0, 1 + lam^2, -lam}, {1, -lam^2 - lam^3, -1 + lam + lam^2}}, {{1, 0, 0}, ...


4

Clear["Global`*"] k = Sqrt[k1^2 + k2^2]; Simplify as you go along m = {{-Sqrt[Pi/2]*I*(k1/(2*k))*Exp[-k*h], Exp[-k*h] + Sqrt[Pi/2]*Kn*k*Exp[-k*h], 0}, {-Sqrt[Pi/2]*I*(k2/2*k)*Exp[-k*h], 0, Exp[-k*h] + Sqrt[Pi/2]*Kn*k*Exp[-k*h]}, {(1/2*Kn)*Exp[-k*r3] - (k/2*Kn)*r3* Exp[-k*r3] + (k/2*Kn)*h*Exp[-k*r3] + (k1^2/2*Kn*k)*r3* ...


4

If I understand your computations, this can be done with Fold: Fold[RollLM[dz, 210000, 262440000 π, pBF[(#2 - 0.5) dz]].#1 &, Vec2A, Range[n]] // Simplify; This gives the same result as your Do[...] // Last // Simplify. Next let's compute Vec3A and solve: Vec3A = BearLM[810000, 850000].% // Simplify Solve[{%[[3]] == 0, %[[4]] == 0}, {vA, PhiA}][[1]] ...


3

It may be possible using RiccatiSolve which can solve an equation of the form $$a^{T }.x+x.a-x.b.r^{-1}.b^{T }.x+q=0$$ If we assume $x=x^T$ and then choose values $a=0$, $b=I$, $r=A^{-1}$, and $q=B$, the above equation becomes $$0^{T }.x+x.0-x^T.I.(A^{-1})^{-1}.I^{T }.x+B=0$$ $$ x^T.A.x=B$$ The assumption $x=x^T$ specifies conditions that the matrices $...


3

SparseArray`KrylovLinearSolve[A, a, "Method" -> "BiCGSTAB", "Preconditioner" -> f, "StartingVector" -> solF ] might get you rid of some calling overhead. But improving the quality of your preconditioner will have a considerably larger effect. If LinearSolve[B] works as a preconditioner, then possibly its incomplete LU preconditioner might ...


3

You could use the code in my answer to How to force Series[] to compute expansions by considering non commutative multiplication?. Let: $Assumptions = (A0 | A1 | A2 | A3) ∈ Matrices[{d, d}]; A = A0 + A1 s + A2 s^2 + A3 s^3; Then: Series[Inverse[A], {s, 0, 3}] /. MatrixPower[A0, -1] -> Inverse[A0] //TeXForm $\text{A0}^{-1}-s \text{A0}^{-1}.\text{A1}.\...


3

I am not qualified to be at this site because the last time I used eigenvectors was well over half a century ago. The word "stiff matrix" came back to me, so I increased the precision of the author's code by rounding the two real numbers to 50 places. It took forever to compute, but Mathematica solved the problem accurately. That is, R = N[5/100, 50]; and ...


3

mat = Array[a, {6, 6}]; Join @@ Table[mat[[j ;; j + 3, k ;; k + 3]], {j, Length@mat - 3}, {k, Length@mat - 3}] $\left\{\left( \begin{array}{cccc} a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} \\ a_{2,1} & a_{2,2} & a_{2,3} & a_{2,4} \\ a_{3,1} & a_{3,2} & a_{3,3} & a_{3,4} \\ a_{4,1} & a_{4,2} & a_{4,3} & a_{4,...


1

Might not be so elegant, but try this: (* create a test array *) startingArray = ArrayReshape[Range[36], {6, 6}]; startingArray // MatrixForm all4x4 = Partition[Partition[#, 4, 1] & /@ startingArray, 4, 1]; MatrixForm[#] & /@ Flatten[Transpose[#] & /@ all4x4, 1] This yields the expected 9 arrays.


1

I do not exactly know what you mean. Maybe one or more of the symbols that you use in the replacement have already definitions attached to them? If you prefer to do it by vectorization (which indeed should generally be prefered over ReplaceAll for performance reasons), you can do it like this: Define a function f; Block takes care of shielding the symbols ...


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