matrix – How To Define An Outer Product (in xAct)?

I am working with xAct / xCoba / xTras and I would like to construct a matrix out of a vector.
So, I have a vector `V` on a manifold `M`:

``````DefManifold(M, 3, IndexRange(a, n))
DefTensor(V((Mu)), M)
``````

Now, I would like to take the outer / dyadic product to construct a 4×4 matrix on the manifold M4 by doing something like

``````{1,B(mu)} * {1,B(nu)}
=
{{1 , B1    , B2    , B3},
{B1 , B1.B1 , B1.B2 , B1.B3},
{B2 , B2.B1 , B2.B2 , B2.B3},
{B3 , B3.B1 , B3.B2 , B3.B3}}
``````

where `*` is the outer product and `.` the scalar (or dot) product between the vector components `Bi`.

How can this be done? Thank you very much in advance for your reply. 🙂

matrix – Testing a condition to replace elements of amatrix

I want to write a code that checks each element of a given matrix `C2` and in case they are’t 0 or 1 , replaces them with 1. My code is so far as follows and the code should does the following for any $$ntimes n$$ matrices. Any ideas?

``````C2 = Table[RandomChoice[{1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 30], {j, 1, 30}];
For[i = 2, i < 10, i++, C3 = MatrixPower[C2, i]; C2 = C3 + C2]
``````

matrix analysis – Growth of eigenvalues for certain sequences of matrices

Suppose we have an aperiodic matrix $$A_t$$ that has entries that are either $$0$$ or are positive integer powers of $$t$$, i.e. we could have
$$A_t = begin{pmatrix} 0 & t & t^2\ t & t^2 & 0\ t & 0 & t end{pmatrix}$$
for example.

Suppose $$t>0$$ and let $$Lambda(t)$$ denote the unique, real, simple maximal eigenvalue of $$A_t$$ guaranteed by the Perron-Frobenius Theorem. If we consider the function
$$f(t) = logLambda(e^t)$$
then it is possible to show using a variational principle and perturbation theory that $$f(t)$$ is increasing, convex and analytic (this is non-trivial!) with uniformly bounded (for $$tinmathbb{R}$$) first derivative. In particular the limits
$$lim_{ttoinfty} frac{f(t)}{t} = alpha_1 text{and} lim_{tto – infty} frac{f(t)}{t} = alpha_2$$
both exist and are finite. My question is the following:
can we calculate the error term associated to these limits? That is, can we find $$g(t)$$ such that
$$f(t) = alpha_1 t + O(g(t))$$
as $$ttoinfty$$ for example?

Any thoughts/insights would be greatly appreciated – thanks!

linear algebra – Are there any results in generalizing matrix theory to multidimensional arrays?

In matrix theory(2-dimensional arrays), we can define addition, multiplication, rank and determination etc. I’m working on generalizing these properties to multidimensional arrays as many as possible. Are there any results in this way? I’d really appreciate it if you could provide some references.

co.combinatorics – Matrix obtained by recursive multiplication and a cyclic permutation

Have you ever seen this matrix? Each row is obtained from the previous one by multiplying each element by the corresponding element of the next cyclic permutation of $$(a_1,dots, a_n)$$:
$$hspace{-2cm}left( begin{array}{llllllll} 1 & 1 & 1 & dots & 1 & 1 \ a_1 & a_2 & a_3 & dots & a_{n-1} & a_{n} \ a_1 a_2 & a_2a_3 & a_3 a_4 & dots & a_{n-1} a_n & a_{n} a_1 \ a_1 a_2a_3 & a_2a_3 a_4 & a_3 a_4a_5 & dots & a_{n-1} a_n a_1& a_{n} a_1 a_2 \ a_1 a_2a_3a_4 & a_2a_3 a_4 a_5& a_3 a_4a_5 a_6& dots & a_{n-1} a_n a_1 a_2& a_{n} a_1 a_2a_3 \ dots & dots & dots & dots & dots & dots \ a_1 a_2a_3a_4 dots a_{n-2}& a_2a_3 a_4 a_5dots a_{n-1} & a_3 a_4a_5 a_6dots a_n&dots & a_{n-1} a_n a_1 a_2dots a_{n-4}& a_{n} a_1 a_2a_3dots a_{n-3} \ a_1 a_2a_3a_4 dots a_{n-1}& a_2a_3 a_4 a_5dots a_{n} & a_3 a_4a_5 a_6dots a_1& dots & a_{n-1} a_n a_1 a_2dots a_{n-3}& a_{n} a_1 a_2a_3dots a_{n-2} \ end{array} right)$$
I would like to know if there is a closed formula for the determinant; of course it is invariant (up to sign) under cyclic permutations of $$(a_1,a_2,dots,a_n)$$.

Prove the upper bound of the determinant of row stochastic matrix is 1

I have seen that the for a row stochastic matrix, $$det(A)leq 1$$
However I could not find any proper proof for that.
I am wondering, is it because all eigenvalues have absolute value $$leq 1$$, and since the $$det(A) =$$ product of all eigenvalues, then derive $$det(A) leq 1$$.
Can anyone help me to elaborate on that?
Much appreciate. Thank you.

Simplifying elements of a matrix

These elements of the matrices can be simplified by hand much further{roots can be cancelled and all}, yet the Fullsimplify in Mathematica doesn’t simply it completely.

The matrix is:

``````{{-((p^2 + Sqrt(m^2 + p^2) p3 - p0 (Sqrt(m^2 + p^2) + p3))/
m), -(((p^2 + (m + Sqrt(m^2 + p^2)) (m - p0)) (-I p2 + Sqrt(
p^2 - p2^2 - p3^2)))/(m (m + Sqrt(m^2 + p^2)))), (1/(
m (m + Sqrt(m^2 + p^2))))(-p^2 p2 + Sqrt(m^2 + p^2) p0 p2 +
m (-Sqrt(m^2 + p^2) + p0) p2 - I p0 p3 Sqrt(p^2 - p2^2 - p3^2) +
I p3 Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2)) +
I m^2 (I p2 + Sqrt(p^2 - p2^2 - p3^2)) +
I m (p3 Sqrt(p^2 - p2^2 - p3^2) +
Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2)))), (1/(
m (m + Sqrt(m^2 + p^2))))(-I (Sqrt(m^2 + p^2) - p0) p2^2 +
I m^2 (p0 - p3) -
I p3 (p^2 + Sqrt(m^2 + p^2) p3 - p0 (Sqrt(m^2 + p^2) + p3)) +
p2 (-p0 Sqrt(p^2 - p2^2 - p3^2) +
Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2))) +
m (I (p0 - p3) (Sqrt(m^2 + p^2) + p3) +
p2 (-I p2 + Sqrt(p^2 - p2^2 - p3^2))))}, {-(((p^2 + (m + Sqrt(
m^2 + p^2)) (m - p0)) (I p2 + Sqrt(p^2 - p2^2 - p3^2)))/(
m (m + Sqrt(m^2 + p^2)))), (-p^2 + p0 (Sqrt(m^2 + p^2) - p3) +
Sqrt(m^2 + p^2) p3)/m, (1/(
m (m + Sqrt(m^2 + p^2))))(-I (Sqrt(m^2 + p^2) - p0) p2^2 +
I m^2 (p0 + p3) + I m (Sqrt(m^2 + p^2) - p3) (p0 + p3) +
I p3 (p^2 - Sqrt(m^2 + p^2) p0 - Sqrt(m^2 + p^2) p3 + p0 p3) +
p0 p2 Sqrt(p^2 - p2^2 - p3^2) -
p2 Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2)) -
m p2 (I p2 + Sqrt(p^2 - p2^2 - p3^2))), (1/(
m (m + Sqrt(m^2 + p^2))))(p^2 p2 + m (Sqrt(m^2 + p^2) - p0) p2 -
Sqrt(m^2 + p^2) p0 p2 + I p0 p3 Sqrt(p^2 - p2^2 - p3^2) -
I p3 Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2)) +
m^2 (p2 + I Sqrt(p^2 - p2^2 - p3^2)) +
I m (-p3 Sqrt(p^2 - p2^2 - p3^2) +
Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2))))}, {(1/(
m (m + Sqrt(m^2 + p^2))))(-p^2 p2 + Sqrt(m^2 + p^2) p0 p2 +
m (-Sqrt(m^2 + p^2) + p0) p2 + I p0 p3 Sqrt(p^2 - p2^2 - p3^2) -
I p3 Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2)) +
I m^2 (I p2 + Sqrt(p^2 - p2^2 - p3^2)) +
I m (-p3 Sqrt(p^2 - p2^2 - p3^2) +
Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2)))), (1/(
m (m + Sqrt(m^2 + p^2))))(I (Sqrt(m^2 + p^2) - p0) p2^2 -
I m^2 (p0 + p3) +
I p3 (-p^2 + Sqrt(m^2 + p^2) p0 + Sqrt(m^2 + p^2) p3 - p0 p3) +
p0 p2 Sqrt(p^2 - p2^2 - p3^2) -
p2 Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2)) -
I m ((Sqrt(m^2 + p^2) - p3) (p0 + p3) +
p2 (-p2 - I Sqrt(p^2 - p2^2 - p3^2)))), (-p^2 +
p0 (Sqrt(m^2 + p^2) - p3) + Sqrt(m^2 + p^2) p3)/
m, ((p^2 + (m + Sqrt(m^2 + p^2)) (m - p0)) (-I p2 + Sqrt(
p^2 - p2^2 - p3^2)))/(m (m + Sqrt(m^2 + p^2)))}, {(1/(
m (m + Sqrt(m^2 + p^2))))(I (Sqrt(m^2 + p^2) - p0) p2^2 -
I m^2 (p0 - p3) +
I p3 (p^2 + Sqrt(m^2 + p^2) p3 - p0 (Sqrt(m^2 + p^2) + p3)) +
p2 (-p0 Sqrt(p^2 - p2^2 - p3^2) +
Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2))) +
m (-I (p0 - p3) (Sqrt(m^2 + p^2) + p3) +
p2 (I p2 + Sqrt(p^2 - p2^2 - p3^2)))), (1/(
m (m + Sqrt(m^2 + p^2))))(p^2 p2 + m (Sqrt(m^2 + p^2) - p0) p2 -
Sqrt(m^2 + p^2) p0 p2 - I p0 p3 Sqrt(p^2 - p2^2 - p3^2) +
I p3 Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2)) +
m^2 (p2 + I Sqrt(p^2 - p2^2 - p3^2)) +
I m (p3 Sqrt(p^2 - p2^2 - p3^2) +
Sqrt(-(m^2 + p^2) (-p^2 + p2^2 + p3^2)))), ((p^2 + (m + Sqrt(
m^2 + p^2)) (m - p0)) (I p2 + Sqrt(p^2 - p2^2 - p3^2)))/(
m (m + Sqrt(m^2 + p^2))), -((
p^2 + Sqrt(m^2 + p^2) p3 - p0 (Sqrt(m^2 + p^2) + p3))/m)}}
``````

some of the substitution we can make are (already taken),

``````{p1 -> Sqrt(p^2 - p2^2 - p3^2), e -> Sqrt(p^2 + m^2)}
Assuming({Element({p0, p, p2, p3}, Reals), m > 0}, sat2 = sat // FullSimplify)
``````

What more could be done to simplify the elements of the matrix?

matrix – Need help reviewing Mathematica expression which came from Physics

Please help me check the conversion of these two expressions in physics to their respective Mathematica expression. Where sigma is the Pauli matrices in standard form, E/p0 is energy, m is mass and p is the momentum.

For eq(5.29)
I got:

``````w = ((e + m)/(2*m))^(1/2) {{1 + p3/(e + m), (p1 - (I *p2))/(e + m), 0,
0}, {(p1 + (I* p2))/(e + m), 1 - p3/(e + m), 0, 0}, {0, 0,
1 - p3/(e + m), -((p1 - (I* p2))/(e + m))}, {0,
0, -((p1 + (I* p2))/(e + m)), 1 + p3/(e + m)}}
``````

And for eq(5.30)

``````P = (m^(-1))*(((Gamma)0*p0) +((Gamma)1*p1) + ((Gamma)2*
p2) + ((Gamma)3*p3));
``````

Where,

``````(Gamma)0 = {{0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}, {0, 1, 0, 0}};
(Gamma)1 = {{0, 0, 0, 1}, {0, 0, 1, 0}, {0, -1, 0, 0}, {-1, 0, 0, 0}};
(Gamma)2 = {{0, 0, 0, -I}, {0, 0, I, 0}, {0, I, 0, 0}, {-I, 0, 0, 0}};
(Gamma)3 = {{0, 0, 1, 0}, {0, 0, 0, -1}, {-1, 0, 0, 0}, {0, 1, 0, 0}};
``````

Inverting lower triangular matrix in time n^2

I have a lower triangular matrix `nxn` called `A` and I want to get `A^{-1}` solved in O(n^2). How can I do it?

I tried using method called forward substitution but the inversion is solved in O(n^3) for full matrix nxn