{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Ricci Tensor and Scalar Curvature calculations using Symbolic module" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import sympy\n", "from sympy import cos, sin, sinh\n", "from einsteinpy.symbolic import MetricTensor, RicciTensor, RicciScalar\n", "\n", "sympy.init_printing()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Defining the Anti-de Sitter spacetime Metric" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "syms = sympy.symbols(\"t chi theta phi\")\n", "t, ch, th, ph = syms\n", "m = sympy.diag(-1, cos(t) ** 2, cos(t) ** 2 * sinh(ch) ** 2, cos(t) ** 2 * sinh(ch) ** 2 * sin(th) ** 2).tolist()\n", "metric = MetricTensor(m, syms)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Calculating the Ricci Tensor(with both indices covariant)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$$\\left[\\begin{matrix}3 & 0 & 0 & 0\\\\0 & - 3 \\cos^{2}{\\left (t \\right )} & 0 & 0\\\\0 & 0 & \\left(\\sin^{2}{\\left (t \\right )} - 1\\right) \\sinh^{2}{\\left (\\chi \\right )} - 2 \\cos^{2}{\\left (t \\right )} \\sinh^{2}{\\left (\\chi \\right )} & 0\\\\0 & 0 & 0 & \\left(\\sin^{2}{\\left (t \\right )} - 1\\right) \\sin^{2}{\\left (\\theta \\right )} \\sinh^{2}{\\left (\\chi \\right )} - 2 \\sin^{2}{\\left (\\theta \\right )} \\cos^{2}{\\left (t \\right )} \\sinh^{2}{\\left (\\chi \\right )}\\end{matrix}\\right]$$" ], "text/plain": [ "⎡3 0 0 \n", "⎢ \n", "⎢ 2 \n", "⎢0 -3⋅cos (t) 0 \n", "⎢ \n", "⎢ ⎛ 2 ⎞ 2 2 2 \n", "⎢0 0 ⎝sin (t) - 1⎠⋅sinh (χ) - 2⋅cos (t)⋅sinh (χ) \n", "⎢ \n", "⎢ ⎛ 2 ⎞ \n", "⎣0 0 0 ⎝sin (t) - 1⎠⋅sin\n", "\n", " 0 ⎤\n", " ⎥\n", " ⎥\n", " 0 ⎥\n", " ⎥\n", " ⎥\n", " 0 ⎥\n", " ⎥\n", "2 2 2 2 2 ⎥\n", " (θ)⋅sinh (χ) - 2⋅sin (θ)⋅cos (t)⋅sinh (χ)⎦" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Ric = RicciTensor.from_metric(metric)\n", "Ric.tensor()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Calculating the Ricci Scalar(Scalar Curvature) from the Ricci Tensor" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAACsAAAASCAYAAADCKCelAAAABHNCSVQICAgIfAhkiAAAATlJREFUSInt1k8rRFEYx/EPzStA8gbsvIiLhZVSrFmwUEoWSillx1azlwU7ZSd2iqWilNmgyWJWkmFBobGYMzWN+XNv5taIb53u7bm/c+6309O5lz/MFLI4xTNK2G2S78UcDnCDVxRxhll0pyl7GQRfkIshOx8yBexhA9t4CvV9dKUlO4zB8IIohuwIxn3fwQHch/mTbbesQ6S1bDNWw/xspZBqT/yQ93D9qBQ6VTaD6XB/VCl2quwmhnCI40ahvHKfxB3N+jGKkanHYpiXQ0/1g0xN8BZvCRYuJBRpxQK2cI1RPLZ5/YZEku3sUshfoT8lp4ZE4suuhOwF+lJ0akgknuxayJ2r6dFa2v0pmwiD8ldoDHfK/wrwgOWq/Ax28Kl8+BfrrJkPmbazrvnpkU+YL+EkDdF/fi1f+rphTBitGoEAAAAASUVORK5CYII=\n", "text/latex": [ "$$-12$$" ], "text/plain": [ "-12" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "R = RicciScalar.from_riccitensor(Ric)\n", "R.expr" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The curavture is -12 which is in-line with the theoretical results" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }