# Contravariant & Covariant indices in Tensors (Symbolic)


```python
from einsteinpy.symbolic import SchwarzschildMetric, MetricTensor, ChristoffelSymbols, RiemannCurvatureTensor
import sympy
sympy.init_printing()
```

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


```python
sch = SchwarzschildMetric()
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[0,0,:,:]
```

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

97c58f50b29334ca16e6eb88469ea9fb8a23cf09
ipynb
Jupyter Notebook
docs/source/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb
r0cketr1kky/einsteinpy
d86f412736a42e2cf688a1e21d7b553868a14bc4
MIT
2019-03-08T16:13:56.000Z
2019-03-08T16:13:56.000Z
docs/source/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb
r0cketr1kky/einsteinpy
d86f412736a42e2cf688a1e21d7b553868a14bc4
MIT
docs/source/examples/Playing with Contravariant and Covariant Indices in Tensors(Symbolic).ipynb
r0cketr1kky/einsteinpy
d86f412736a42e2cf688a1e21d7b553868a14bc4
MIT
2022-03-19T18:46:13.000Z
2022-03-19T18:46:13.000Z
Qwen/Qwen-72B
1. YES
2. YES