# Contravariant & Covariant indices in Tensors (Symbolic)


```python
from einsteinpy.symbolic import ChristoffelSymbols, RiemannCurvatureTensor
from einsteinpy.symbolic.predefined import Schwarzschild
import sympy
sympy.init_printing()
```

### Analysing the schwarzschild metric along with performing various operations


```python
sch = Schwarzschild()
sch.tensor()
```


```python
sch_inv = sch.inv()
sch_inv.tensor()
```


```python
sch.order
```


```python
sch.config
```




    'll'



### Obtaining Christoffel Symbols from Metric Tensor


```python
chr = ChristoffelSymbols.from_metric(sch_inv) # can be initialized from sch also
chr.tensor()
```


```python
chr.config
```




    'ull'



### Changing the first index to covariant


```python
new_chr = chr.change_config('lll') # changing the configuration to (covariant, covariant, covariant)
new_chr.tensor()
```


```python
new_chr.config
```




    'lll'



### Any arbitary index configuration would also work!


```python
new_chr2 = new_chr.change_config('lul')
new_chr2.tensor()
```

### Obtaining Riemann Tensor from Christoffel Symbols and manipulating it's indices


```python
rm = RiemannCurvatureTensor.from_christoffels(new_chr2)
rm[0,0,:,:]
```


```python
rm.config
```




    'ulll'




```python
rm2 = rm.change_config("uuuu")
rm2[0,0,:,:]
```


```python
rm3 = rm2.change_config("lulu")
rm3[0,0,:,:]
```


```python
rm4 = rm3.change_config("ulll")
rm4.simplify()
rm4[0,0,:,:]
```

#### It is seen that `rm` and `rm4` are same as they have the same configuration

da3149b2aad7c4c060fb0be3d6a3d8fce54e2d32
ipynb
Jupyter Notebook
docs/source/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb
bibek22/einsteinpy
78bf5d942cbb12393852f8e4d7a8426f1ffe6f23
MIT
2020-06-01T18:37:53.000Z
2020-06-01T18:37:53.000Z
docs/source/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb
bibek22/einsteinpy
78bf5d942cbb12393852f8e4d7a8426f1ffe6f23
MIT
2019-04-08T17:39:50.000Z
2019-04-11T03:10:09.000Z
docs/source/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb
bibek22/einsteinpy
78bf5d942cbb12393852f8e4d7a8426f1ffe6f23
MIT
Qwen/Qwen-72B
1. YES
2. YES