# Contravariant & Covariant indices in Tensors (Symbolic)


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

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

304357d29cfc14afc534de66f60cbdbd454b3ed6
ipynb
Jupyter Notebook
docs/source/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb
iamhardikat11/einsteinpy
7bf0ca0020b273e616b6e7c19aed7a5e13925444
MIT
2019-02-04T09:15:22.000Z
2022-03-19T13:50:17.000Z
docs/source/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb
iamhardikat11/einsteinpy
7bf0ca0020b273e616b6e7c19aed7a5e13925444
MIT
2019-02-02T10:57:27.000Z
2022-02-26T16:37:05.000Z
docs/source/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb
iamhardikat11/einsteinpy
7bf0ca0020b273e616b6e7c19aed7a5e13925444
MIT
2019-01-30T14:14:14.000Z
2022-02-28T21:18:18.000Z
Qwen/Qwen-72B
1. YES
2. YES