Writing tensors as arrays in LaTeX with superscript and subscript notation

  • Context: LaTeX 
  • Thread starter Thread starter Philosophaie
  • Start date Start date
  • Tags Tags
    Arrays Latex
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 3K views
Philosophaie
Messages
456
Reaction score
0
How do you write these in the new Latex:

x^k = Array{r \\ \theta \\ \phi \\ t}

g_{ij} = Array{1/(1-2*m/r) & 0 & 0 & 0 \\ 0 & r^2 & 0 & 0\\0 & 0 & r^2*(sin(h))^2 & 0\\0 & 0 & 0 & -(1-2*m/r)}

\Gamma^i_{jk} = 1/2*g^{il} * (\frac{d g_{lj}}{d x^k} + \frac{d g_{lk}{d x^j} - \frac{d g_{jk}{d x^l})

Riemann^i_{jkl}) = \frac{d \Gamma^i_{jl}}{d x^k} - \frac{d \Gamma^i_{jk}}{d x^l} + \Gamma^i_{km)*\Gamma^m_{jl} - \Gamma^i_{lm} * \Gamma^r_{jk}

Just putting "##" or "$$"" at the beginning and end does not work.
 
Last edited:
Physics news on Phys.org
This is the only way I know. Right click and select 'tex' to see the code.

[tex]\left[ \begin {array}{cccc}<br /> 1/(1-2m/r) & 0 & 0 & 0 \\ <br /> 0 & r^2 & 0 & 0\\<br /> 0 & 0 & r^2(sin(h))^2 & 0\\<br /> 0 & 0 & 0 & -(1-2m/r)<br /> \end {array} \right][/tex]
This one had some errors in the Tex
##\Gamma^i_{jk} = (1/2)g^{il} \left( \frac{d g_{lj}}{d x^k} + \frac{d g_{lk}}{d x^j} - \frac{d g_{jk}}{d x^l}\right)##
 
Last edited:
Mentz114 said:
This is the only way I know. Right click and select 'tex' to see the code.

[tex]\left[ \begin {array}{cccc}<br /> 1/(1-2m/r) & 0 & 0 & 0 \\ <br /> 0 & r^2 & 0 & 0\\<br /> 0 & 0 & r^2(sin(h))^2 & 0\\<br /> 0 & 0 & 0 & -(1-2m/r)<br /> \end {array} \right][/tex]
This one had some errors in the Tex
##\Gamma^i_{jk} = (1/2)g^{il} \left( \frac{d g_{lj}}{d x^k} + \frac{d g_{lk}}{d x^j} - \frac{d g_{jk}}{d x^l}\right)##

For the matrix, here's how I do them:
$$\begin {bmatrix}
1/(1-2m/r) & 0 & 0 & 0 \\
0 & r^2 & 0 & 0\\
0 & 0 & r^2(sin(h))^2 & 0\\
0 & 0 & 0 & -(1-2m/r)
\end {bmatrix}$$

About the only difference from what Mentz114 did was that I used the bmatrix environment rather than the array environment. The bmatrix environment produces a matrix whose left and right sides are brackets, hence the 'b' in bmatrix. For this simpler environment you don't need to supply left and right sides of the matrix, nor do you need to include the {cccc} thing to specify the columns. There is also a pmatrix environment, where the left and right sides of the matrix are parentheses - ( and ).

You can right-click on the matrix to see my LaTeX code.