{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "# $H_{\\rm SSS}$, up to and including third post-Newtonian order\n", "\n", "## Author: Zach Etienne\n", "\n", "## This notebook constructs the spin-spin-spin coupling terms in the Hamiltonian up to and including third post-Newtonian order.\n", "\n", "**Notebook Status:** Validated \n", "\n", "**Validation Notes:** All expressions in this notebook were transcribed twice by hand on separate occasions, and expressions were corrected as needed to ensure consistency with published PN expressions. In addition, this tutorial notebook has been confirmed to be self-consistent with its corresponding NRPy+ module, as documented [below](#code_validation). **Additional validation tests may have been performed, but are as yet, undocumented.**\n", "\n", "### This notebook exists as the following Python module:\n", "1. [PN_Hamiltonian_SSS.py](../../edit/NRPyPN/PN_Hamiltonian_SSS.py)\n", "\n", "### This notebook & corresponding Python module depend on the following NRPy+/NRPyPN Python modules:\n", "1. [indexedexp.py](../../edit/indexedexp.py): [**documentation+tutorial**](../Tutorial-Indexed_Expressions.ipynb)\n", "1. [NRPyPN_shortcuts.py](../../edit/NRPyPN/NRPyPN_shortcuts.py): [**documentation**](NRPyPN_shortcuts.ipynb)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Table of Contents\n", "$$\\label{toc}$$\n", "\n", "1. Part 1: [$H_{SSS,{\\rm 3PN}}$](#threepn), as derived in [Levi and Steinhoff (2015)](https://arxiv.org/abs/1410.2601)\n", "1. Part 2: [Validation against second transcription and corresponding Python module](#code_validation)\n", "1. Part 3: [LaTeX PDF output](#latex_pdf_output): $\\LaTeX$ PDF Output" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Part 1: $H_{\\rm SSS, 3PN}$, as derived in [Levi and Steinhoff (2015)](https://arxiv.org/abs/1410.2601) \\[Back to [top](#toc)\\]\n", "$$\\label{twopn}$$ \n", "\n", "As described in the [nonspinning Hamiltonian notebook](PN-Hamiltonian-Nonspinning.ipynb), the basic physical system assumes two point particles of mass $m_1$ and $m_2$ with corresponding momentum vectors $\\mathbf{P}_1$ and $\\mathbf{P}_2$, and displacement vectors $\\mathbf{X}_1$ and $\\mathbf{X}_2$ with respect to the center of mass. Here we also consider the spin vectors of each point mass $\\mathbf{S}_1$ and $\\mathbf{S}_2$, respectively.\n", "\n", "[Steinhoff, Hergt, and Schäfer (2008a)](https://arxiv.org/abs/0712.1716) and [Steinhoff, Hergt, and Schäfer (2008b)](https://arxiv.org/abs/0809.2200) adopt the additional notation\n", "\n", "\\begin{align}\n", "\\mathbf{r}_{12} &= (\\mathbf{X}_1-\\mathbf{X}_2)\\\\\n", "r_{12} = r_{21} &= |\\mathbf{r}_{12}|\\\\\n", "\\mathbf{n}_{12} &= \\frac{\\mathbf{r}_{12}}{r_{12}},\n", "\\end{align}\n", "and when the numbers in subscripts are flipped, the particles are interchanged.\n", "\n", "To reduce the possibility of copying errors, the equation for $H_{\\rm SSS, 3PN}$ is taken directly from the arXiv LaTeX source code of Eq 3.12 in [Levi and Steinhoff (2015)](https://arxiv.org/abs/1410.2601), and only mildly formatted to (1) improve presentation in Jupyter notebooks and (2) to ensure some degree of consistency in notation across different terms in other Hamiltonian notebooks:\n", "\n", "\\begin{align}\n", "H_{\\text{SSS(BHB),\\ 3PN}}&=\\frac{1}{m_1^2r^4}\\left\\{\\frac{3}{2}\\left(\\mathbf{S}_{1}^2\\, \n", "\\mathbf{S}_{2}\\cdot\\mathbf{n}\\times\\mathbf{p}_{1}\n", "+\\mathbf{S}_{1}\\cdot\\mathbf{n}\\,\\mathbf{S}_{2}\\cdot\\mathbf{S}_{1}\\times\\mathbf{p}_{1}\n", "-5\\left(\\mathbf{S}_{1}\\cdot\\mathbf{n}\\right)^2\\mathbf{S}_{2}\\cdot\\mathbf{n}\\times\\mathbf{p}_{1}\\right.\\right.\\\\\n", "&\\qquad\\qquad\\quad +\\mathbf{n}\\cdot\\mathbf{S}_{1}\\times\\mathbf{S}_{2}\\left(\\mathbf{S}_{1}\\cdot\\mathbf{p}_{1}\n", "-5\\mathbf{S}_{1}\\cdot\\mathbf{n}\\,\\mathbf{p}_{1}\\cdot\\mathbf{n}\\right)\\\\\n", "&\\qquad\\quad -\\frac{3m_1}{2m_2}\\left[\\mathbf{S}_{1}^2\\,\n", "\\mathbf{S}_{2}\\cdot\\mathbf{n}\\times\\mathbf{p}_2+2\\mathbf{S}_{1}\\cdot\\mathbf{n}\\,\n", "\\mathbf{S}_{2}\\cdot\\mathbf{S}_{1}\\times\\mathbf{p}_{2}\n", "-5\\left(\\mathbf{S}_{1}\\cdot\\mathbf{n}\\right)^2\\mathbf{S}_{2}\\cdot\\mathbf{n}\\times\\mathbf{p}_{2}\\right)\\bigg]\\\\\n", "&\\qquad\\qquad \\left.-\\mathbf{S}_{1}\\times\\mathbf{n}\\cdot\\left(\\mathbf{p}_{2}\n", "-\\frac{m_2}{4m_1}\\mathbf{p}_{1}\\right)\\left(\\mathbf{S}_{1}^2\n", "-5\\left(\\mathbf{S}_{1}\\cdot\\mathbf{n}\\right)^2\\right)\\right\\}\\\\\n", "&\\quad+ 1\\longleftrightarrow2.\n", "\\end{align}" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:35:47.617159Z", "iopub.status.busy": "2021-03-07T17:35:47.616249Z", "iopub.status.idle": "2021-03-07T17:35:47.948492Z", "shell.execute_reply": "2021-03-07T17:35:47.947745Z" } }, "outputs": [], "source": [ "# Step 0: Add NRPy's directory to the path\n", "# https://stackoverflow.com/questions/16780014/import-file-from-parent-directory\n", "import indexedexpNRPyPN as ixp # NRPy+: Symbolic indexed expression (e.g., tensors, vectors, etc.) support\n", "from NRPyPN_shortcuts import div,dot,cross # NRPyPN: shortcuts for e.g., vector operations\n", "\n", "# Step 1: 3PN spin-spin-spin term, from Eq. 3.12 of\n", "# Levi and Steinhoff (2015):\n", "# https://arxiv.org/abs/1410.2601\n", "def f_H_SSS_3PN(m1,m2, n12U,n21U, S1U,S2U, p1U,p2U, r12):\n", " def f_H_SSS_3PN_pt(m1,m2, nU, S1U,S2U, p1U,p2U, r):\n", " p2_minus_m2_over_4m1_p1 = ixp.zerorank1()\n", " for i in range(3):\n", " p2_minus_m2_over_4m1_p1[i] = p2U[i] - m2/(4*m1)*p1U[i]\n", " H_SSS_3PN_pt = (+div(3,2)*(+dot(S1U,S1U)*dot(S2U,cross(nU,p1U))\n", " +dot(S1U,nU)*dot(S2U,cross(S1U,p1U))\n", " -5*dot(S1U,nU)**2*dot(S2U,cross(nU,p1U))\n", " +dot(nU,cross(S1U,S2U))*(+dot(S1U,p1U)\n", " -5*dot(S1U,nU)*dot(p1U,nU)))\n", " -3*m1/(2*m2)*( +dot(S1U,S1U) *dot(S2U,cross(nU,p2U))\n", " +2*dot(S1U,nU) *dot(S2U,cross(S1U,p2U))\n", " -5*dot(S1U,nU)**2*dot(S2U,cross(nU,p2U)))\n", " -dot(cross(S1U,nU),p2_minus_m2_over_4m1_p1)*(dot(S1U,S1U) - 5*dot(S1U,nU)**2))/(m1**2*r**4)\n", " return H_SSS_3PN_pt\n", " global H_SSS_3PN\n", " H_SSS_3PN = (+f_H_SSS_3PN_pt(m1,m2, n12U, S1U,S2U, p1U,p2U, r12)\n", " +f_H_SSS_3PN_pt(m2,m1, n21U, S2U,S1U, p2U,p1U, r12))" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:35:47.959986Z", "iopub.status.busy": "2021-03-07T17:35:47.959235Z", "iopub.status.idle": "2021-03-07T17:35:47.961367Z", "shell.execute_reply": "2021-03-07T17:35:47.961857Z" } }, "outputs": [], "source": [ "# Second version, for validation purposes only.\n", "def f_H_SSS_3PNv2(m1,m2, n12U,n21U, S1U,S2U, p1U,p2U, q):\n", " def SHS2015_HSSS_3PNv2_pt(m1,m2, nU, S1U,S2U, p1U,p2U, q):\n", " p2_minus_m2_over_4m1_p1 = ixp.zerorank1()\n", " for i in range(3):\n", " p2_minus_m2_over_4m1_p1[i] = p2U[i] - m2/(4*m1)*p1U[i]\n", " H = ( div(3,2)*(+ dot(S1U,S1U)*dot(S2U,cross(nU,p1U)) # line 1\n", " + dot(S1U,nU)*dot(S2U,cross(S1U,p1U)) # line 1\n", " -5*dot(S1U,nU)**2*dot(S2U,cross(nU,p1U)) # line 1\n", " +dot(nU,cross(S1U,S2U))*(dot(S1U,p1U)-5*dot(S1U,nU)*dot(p1U,nU))) # line 2\n", " -div(3,2)*m1/m2*(+ dot(S1U,S1U)*dot(S2U,cross(nU,p2U)) # line 3\n", " +2*dot(S1U,nU)*dot(S2U,cross(S1U,p2U)) # line 3\n", " -5*dot(S1U,nU)**2*dot(S2U,cross(nU,p2U))) # line 3\n", " -dot(cross(S1U,nU), p2_minus_m2_over_4m1_p1)*(dot(S1U,S1U) - 5*dot(S1U,nU)**2 ))/(m1**2*q**4)\n", " return H\n", "\n", " global H_SSS_3PNv2\n", " H_SSS_3PNv2 = (+SHS2015_HSSS_3PNv2_pt(m1,m2, n12U, S1U,S2U, p1U,p2U, q)\n", " +SHS2015_HSSS_3PNv2_pt(m2,m1, n21U, S2U,S1U, p2U,p1U, q))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Part 4: Validation against second transcription and corresponding Python module \\[Back to [top](#toc)\\]\n", "$$\\label{code_validation}$$ \n", "\n", "As a code validation check, we verify agreement between \n", "* the SymPy expressions transcribed from the cited published work on two separate occasions, and\n", "* the SymPy expressions generated in this notebook, and the corresponding Python module." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:35:47.971997Z", "iopub.status.busy": "2021-03-07T17:35:47.970940Z", "iopub.status.idle": "2021-03-07T17:35:48.202572Z", "shell.execute_reply": "2021-03-07T17:35:48.202000Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ALL TESTS PASS\n" ] } ], "source": [ "import sympy as sp # SymPy: The Python computer algebra package upon which NRPy+ depends\n", "from NRPyPN_shortcuts import m1,m2, n12U,n21U, S1U,S2U, p1U,p2U, q # NRPyPN: import needed input variables\n", "\n", "f_H_SSS_3PN(m1,m2, n12U,n21U, S1U,S2U, p1U,p2U, q)\n", "\n", "def error(varname):\n", " print(\"ERROR: When comparing Python module & notebook, \"+varname+\" was found not to match.\")\n", " sys.exit(1)\n", "\n", "# Validation against second transcription of the expressions:\n", "f_H_SSS_3PNv2(m1,m2, n12U,n21U, S1U,S2U, p1U,p2U, q)\n", "if sp.simplify(H_SSS_3PN - H_SSS_3PNv2) != 0: error(\"H_SSS_3PNv2\")\n", "\n", "# Validation against corresponding Python module:\n", "import PN_Hamiltonian_SSS as HSSS\n", "HSSS.f_H_SSS_3PN(m1,m2, n12U,n21U, S1U,S2U, p1U,p2U, q)\n", "\n", "if sp.simplify(H_SSS_3PN - HSSS.H_SSS_3PN) != 0: error(\"H_SSS_3PN\")\n", "print(\"ALL TESTS PASS\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Part 5: Output this notebook to $\\LaTeX$-formatted PDF file \\[Back to [top](#toc)\\]\n", "$$\\label{latex_pdf_output}$$\n", "\n", "The following code cell converts this Jupyter notebook into a proper, clickable $\\LaTeX$-formatted PDF file. After the cell is successfully run, the generated PDF may be found in the root NRPy+ tutorial directory, with filename\n", "[PN-Hamiltonian-SSS.pdf](PN-Hamiltonian-SSS.pdf) (Note that clicking on this link may not work; you may need to open the PDF file through another means.)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:35:48.207312Z", "iopub.status.busy": "2021-03-07T17:35:48.206537Z", "iopub.status.idle": "2021-03-07T17:35:51.504767Z", "shell.execute_reply": "2021-03-07T17:35:51.505461Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Created PN-Hamiltonian-SSS.tex, and compiled LaTeX file to PDF file PN-\n", " Hamiltonian-SSS.pdf\n" ] } ], "source": [ "import os,sys # Standard Python modules for multiplatform OS-level functions\n", "import cmdline_helperNRPyPN as cmd # NRPy+: Multi-platform Python command-line interface\n", "cmd.output_Jupyter_notebook_to_LaTeXed_PDF(\"PN-Hamiltonian-SSS\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.11" } }, "nbformat": 4, "nbformat_minor": 4 }