{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "# $p_t$, the tangential component of the momentum vector, up to and including 3.5 post-Newtonian order\n", "\n", "## Author: Zach Etienne\n", "\n", "## This notebook constructs the tangential component of the momentum vector, $p_t$, up to and including 3.5 PN order, and performs various validation tests. \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 work. Published work was cross-validated and typo(s) in published work were corrected. 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_p_t.py](../../edit/NRPyPN/PN_p_t.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: [$p_t$](#p_t), up to and including 3.5PN order, as derived in [Ramos-Buades, Husa, and Pratten (2018)](https://arxiv.org/abs/1810.00036)\n", "1. Part 2: [Validation against second transcription and corresponding Python module](#code_validation)\n", "1. Part 3: [Validation against trusted numerical values](#code_validationv2) (i.e., in Table V of [Ramos-Buades, Husa, and Pratten (2018)](https://arxiv.org/abs/1810.00036))\n", "1. Part 4: [LaTeX PDF output](#latex_pdf_output): $\\LaTeX$ PDF Output" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Part 1: $p_t$, up to and including 3.5PN order, as derived in [Ramos-Buades, Husa, and Pratten (2018)](https://arxiv.org/abs/1810.00036) \\[Back to [top](#toc)\\]\n", "$$\\label{p_t}$$ \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", "To reduce possibility of copying error, the equation for $p_t$ is taken directly from the arXiv LaTeX source code of Eq A2 in [Ramos-Buades, Husa, and Pratten (2018)](https://arxiv.org/abs/1810.00036), and only mildly formatted to (1) improve presentation in Jupyter notebooks, (2) to ensure some degree of consistency in notation across different terms in other NRPyPN notebooks, and (3) to correct any errors. In particular, the boxed negative sign at 2.5PN order ($a_5$ below) was missing in the original equation. We will later show that this negative sign is necessary for consistency with other expressions in the same paper, as well as with the expression up to 3PN order in [Healy, Lousto, Nakano, and Zlochower (2017)](https://arxiv.org/abs/1702.00872):\n", "\n", "$$\n", "p_t = \\frac{q}{(1+q)^2}\\frac{1}{r^{1/2}}\\left(1 + \\sum_{k=2}^7 \\frac{a_k}{r^{k/2}}\\right),\n", "$$\n", "where\n", "\n", "\\begin{align}\n", "a_2 &= 2\\\\\n", "a_3 &= \\left[-\\frac{3 \\left(4 q^2+3 q\\right) \\chi _{2z}}{4 (q+1)^2}-\\frac{3 (3 q+4) \\chi _{1z}}{4 (q+1)^2}\\right]\\\\\n", "a_4 &= \\left[ -\\frac{3 q^2 \\chi _{2x}^2}{2 (q+1)^2} +\\frac{3 q^2 \\chi _{2y}^2}{4 (q+1)^2}+\\frac{3 q^2 \\chi _{2z}^2}{4 (q+1)^2} \n", " +\\frac{42 q^2+41 q+42}{16 (q+1)^2}-\\frac{3 \\chi _{1x}^2}{2 (q+1)^2} \\right.\\\\\n", "&\\quad\\quad \\left. -\\frac{3 q \\chi _{1x} \\chi _{2x}}{(q+1)^2}+\\frac{3 \\chi _{1y}^2}{4 (q+1)^2}+\\frac{3 q \\chi _{1y}\\chi _{2y}}{2 (q+1)^2}+\\frac{3 \\chi _{1z}^2}{4 (q+1)^2}+\\frac{3 q \\chi _{1z} \\chi _{2z}}{2 (q+1)^2}\\right]\\\\\n", "a_5 &= \\left[ \\boxed{-1} \\frac{\\left(13 q^3+60 q^2+116 q+72\\right) \\chi _{1z}}{16 (q+1)^4}+\\frac{\\left(-72 q^4-116 q^3-60 q^2-13 q\\right) \\chi _{2z}}{16 (q+1)^4} \\right]\\\\\n", "a_6 &= \\left[\\frac{\\left(472 q^2-640\\right) \\chi _{1x}^2}{128 (q+1)^4} + \\frac{\\left(-512 q^2-640 q-64\\right) \\chi _{1y}^2}{128 (q+1)^4}+\\frac{\\left(-108 q^2+224 q+512\\right) \\chi _{1z}^2}{128 (q+1)^4}\\right.\\\\\n", "&\\quad\\quad \\left.+\\frac{\\left(472 q^2-640 q^4\\right) \\chi _{2x}^2}{128 (q+1)^4}+\\frac{\\left(192 q^3+560 q^2+192 q\\right) \\chi _{1x} \\chi _{2x}}{128 (q+1)^4} +\\frac{\\left(-864 q^3-1856 q^2-864 q\\right) \\chi _{1y} \\chi _{2y}}{128 (q+1)^4}\\right.\\\\\n", "&\\quad\\quad \\left.+\\frac{\\left(480 q^3+1064 q^2+480 q\\right) \\chi _{1z} \\chi _{2z}}{128 (q+1)^4}+\\frac{\\left(-64 q^4-640 q^3-512 q^2\\right) \\chi _{2y}^2}{128 (q+1)^4}+\\frac{\\left(512 q^4+224 q^3-108 q^2\\right) \\chi _{2z}^2}{128 (q+1)^4} \\right. \\nonumber\n", "\\\\\n", "&\\quad\\quad\\left.+\\frac{480 q^4+163 \\pi ^2 q^3-2636 q^3+326 \\pi ^2 q^2-6128 q^2+163 \\pi ^2 q-2636 q+480}{128 (q+1)^4} \\right]\\\\\n", "a_7 &= \\left[ \\frac{5 (4 q+1) q^3 \\chi _{2 x}^2 \\chi _{2 z}}{2 (q+1)^4}-\\frac{5 (4 q+1) q^3 \\chi _{2 y}^2 \\chi _{2 z}}{8 (q+1)^4}-\\frac{5 (4 q+1) q^3 \\chi _{2 z}^3}{8 (q+1)^4}+\\chi _{1x} \\left(\\frac{15 (2 q+1) q^2 \\chi _{2 x} \\chi _{2 z}}{4 (q+1)^4}+\\frac{15 (q+2) q \\chi _{2 x} \\chi _{1z}}{4 (q+1)^4}\\right)\\right. \\nonumber\n", "\\\\\n", "&\\quad\\quad \\left.+\\chi _{1y} \\left(\\frac{15 q^2 \\chi _{2 y} \\chi _{1z}}{4 (q+1)^4}+\\frac{15 q^2 \\chi _{2 y} \\chi _{2 z}}{4 (q+1)^4}\\right)+\\chi _{1z} \\left(\\frac{15 q^2 (2 q+3) \\chi _{2 x}^2}{4 (q+1)^4}-\\frac{15 q^2 (q+2) \\chi _{2 y}^2}{4 (q+1)^4}-\\frac{15 q^2 \\chi _{2 z}^2}{4 (q+1)^3} \\right.\\right. \\nonumber\n", "\\\\\n", "&\\quad\\quad \\left.\\left. -\\frac{103 q^5+145 q^4-27 q^3+252 q^2+670 q+348}{32 (q+1)^6}\\right)-\\frac{\\left(348 q^5+670 q^4+252 q^3-27 q^2+145 q+103\\right) q \\chi _{2 z}}{32 (q+1)^6}\\right.\\nonumber\n", "\\\\\n", "&\\quad\\quad \\left.+\\chi _{1x}^2 \\left(\\frac{5 (q+4) \\chi _{1z}}{2 (q+1)^4}+\\frac{15 q (3 q+2) \\chi _{2 z}}{4 (q+1)^4}\\right)+\\chi _{1y}^2 \\left(-\\frac{5 (q+4) \\chi _{1z}}{8 (q+1)^4}-\\frac{15 q (2 q+1) \\chi _{2 z}}{4 (q+1)^4}\\right)-\\frac{15 q \\chi _{1z}^2 \\chi _{2 z}}{4 (q+1)^3}-\\frac{5 (q+4) \\chi _{1z}^3}{8 (q+1)^4} \\right]\n", "\\end{align}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's divide and conquer, by tackling the coefficients one at a time:\n", "\n", "\\begin{align}\n", "a_2 &= 2\\\\\n", "a_3 &= \\left[-\\frac{3 \\left(4 q^2+3 q\\right) \\chi _{2z}}{4 (q+1)^2}-\\frac{3 (3 q+4) \\chi _{1z}}{4 (q+1)^2}\\right]\\\\\n", "a_4 &= \\left[ -\\frac{3 q^2 \\chi _{2x}^2}{2 (q+1)^2} +\\frac{3 q^2 \\chi _{2y}^2}{4 (q+1)^2}+\\frac{3 q^2 \\chi _{2z}^2}{4 (q+1)^2} \n", " +\\frac{42 q^2+41 q+42}{16 (q+1)^2}-\\frac{3 \\chi _{1x}^2}{2 (q+1)^2} \\right.\\\\\n", "&\\quad\\quad \\left. -\\frac{3 q \\chi _{1x} \\chi _{2x}}{(q+1)^2}+\\frac{3 \\chi _{1y}^2}{4 (q+1)^2}+\\frac{3 q \\chi _{1y}\\chi _{2y}}{2 (q+1)^2}+\\frac{3 \\chi _{1z}^2}{4 (q+1)^2}+\\frac{3 q \\chi _{1z} \\chi _{2z}}{2 (q+1)^2}\\right]\n", "\\end{align}" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:35.977376Z", "iopub.status.busy": "2021-03-07T17:37:35.976529Z", "iopub.status.idle": "2021-03-07T17:37:36.299778Z", "shell.execute_reply": "2021-03-07T17:37:36.299112Z" } }, "outputs": [], "source": [ "# Step 0: Add NRPy's directory to the path\n", "# https://stackoverflow.com/questions/16780014/import-file-from-parent-directory\n", "import sympy as sp # SymPy: The Python computer algebra package upon which NRPy+ depends\n", "import indexedexpNRPyPN as ixp # NRPy+: Symbolic indexed expression (e.g., tensors, vectors, etc.) support\n", "from NRPyPN_shortcuts import div # NRPyPN: shortcuts for e.g., vector operations\n", "\n", "# Step 1: Construct terms a_2, a_3, and a_4, from\n", "# Eq A2 of Ramos-Buades, Husa, and Pratten (2018)\n", "# https://arxiv.org/abs/1810.00036\n", "# These terms have been independently validated\n", "# against the same terms in Eq 7 of\n", "# Healy, Lousto, Nakano, and Zlochower (2017)\n", "# https://arxiv.org/abs/1702.00872\n", "def p_t__a_2_thru_a_4(m1,m2, chi1x,chi1y,chi1z, chi2x,chi2y,chi2z):\n", " q = m2/m1 # It is assumed that q >= 1, so m2 >= m1.\n", " global a_2,a_3,a_4\n", " a_2 = 2\n", " a_3 = (-3*(4*q**2+3*q)*chi2z/(4*(q+1)**2) - 3*(3*q+4)*chi1z/(4*(q+1)**2))\n", " a_4 = (-3*q**2*chi2x**2/(2*(q+1)**2)\n", " +3*q**2*chi2y**2/(4*(q+1)**2)\n", " +3*q**2*chi2z**2/(4*(q+1)**2)\n", " +(+42*q**2 + 41*q + 42)/(16*(q+1)**2)\n", " -3*chi1x**2/(2*(q+1)**2)\n", " -3*q*chi1x*chi2x/(q+1)**2\n", " +3*chi1y**2/(4*(q+1)**2)\n", " +3*q*chi1y*chi2y/(2*(q+1)**2)\n", " +3*chi1z**2/(4*(q+1)**2)\n", " +3*q*chi1z*chi2z/(2*(q+1)**2))" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.309523Z", "iopub.status.busy": "2021-03-07T17:37:36.308685Z", "iopub.status.idle": "2021-03-07T17:37:36.311565Z", "shell.execute_reply": "2021-03-07T17:37:36.311018Z" } }, "outputs": [], "source": [ "# Second version, for validation purposes only.\n", "def p_t__a_2_thru_a_4v2(m1,m2, chi1x,chi1y,chi1z, chi2x,chi2y,chi2z):\n", " q = m2/m1 # It is assumed that q >= 1, so m2 >= m1.\n", " global a_2v2,a_3v2,a_4v2\n", " # Validated against HLNZ2017 version\n", " a_2v2 = 2\n", " # Validated against HLNZ2017 version\n", " a_3v2 = (-(3*(4*q**2+3*q)*chi2z)/(4*(q+1)**2)-(3*(3*q+4)*chi1z)/(4*(q+1)**2))\n", " # Validated against HLNZ2017 version\n", " a_4v2 = -(3*q**2*chi2x**2)/(2*(q+1)**2)+(3*q**2*chi2y**2)/(4*(q+1)**2)+(3*q**2*chi2z**2)/(4*(q+1)**2)+(42*q**2+41*q+42)/(16*(q+1)**2)-(3*chi1x**2)/(2*(q+1)**2)-(3*q*chi1x*chi2x)/((q+1)**2)+(3*chi1y**2)/(4*(q+1)**2)+(3*q*chi1y*chi2y)/(2*(q+1)**2)+(3*chi1z**2)/(4*(q+1)**2)+(3*q*chi1z*chi2z)/(2*(q+1)**2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, $a_5$ and $a_6$:\n", "\n", "\\begin{align}\n", "a_5 &= \\left[ \\boxed{-1} \\frac{\\left(13 q^3+60 q^2+116 q+72\\right) \\chi _{1z}}{16 (q+1)^4}+\\frac{\\left(-72 q^4-116 q^3-60 q^2-13 q\\right) \\chi _{2z}}{16 (q+1)^4} \\right]\\\\\n", "a_6 &= \\left[\\frac{\\left(472 q^2-640\\right) \\chi _{1x}^2}{128 (q+1)^4} + \\frac{\\left(-512 q^2-640 q-64\\right) \\chi _{1y}^2}{128 (q+1)^4}+\\frac{\\left(-108 q^2+224 q+512\\right) \\chi _{1z}^2}{128 (q+1)^4}\\right.\\\\\n", "&\\quad\\quad \\left.+\\frac{\\left(472 q^2-640 q^4\\right) \\chi _{2x}^2}{128 (q+1)^4}+\\frac{\\left(192 q^3+560 q^2+192 q\\right) \\chi _{1x} \\chi _{2x}}{128 (q+1)^4} +\\frac{\\left(-864 q^3-1856 q^2-864 q\\right) \\chi _{1y} \\chi _{2y}}{128 (q+1)^4}\\right.\\\\\n", "&\\quad\\quad \\left.+\\frac{\\left(480 q^3+1064 q^2+480 q\\right) \\chi _{1z} \\chi _{2z}}{128 (q+1)^4}+\\frac{\\left(-64 q^4-640 q^3-512 q^2\\right) \\chi _{2y}^2}{128 (q+1)^4}+\\frac{\\left(512 q^4+224 q^3-108 q^2\\right) \\chi _{2z}^2}{128 (q+1)^4} \\right. \\nonumber\n", "\\\\\n", "&\\quad\\quad\\left.+\\frac{480 q^4+163 \\pi ^2 q^3-2636 q^3+326 \\pi ^2 q^2-6128 q^2+163 \\pi ^2 q-2636 q+480}{128 (q+1)^4} \\right]\\\\\n", "\\end{align}" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.325163Z", "iopub.status.busy": "2021-03-07T17:37:36.324456Z", "iopub.status.idle": "2021-03-07T17:37:36.327087Z", "shell.execute_reply": "2021-03-07T17:37:36.326570Z" } }, "outputs": [], "source": [ "# Construct terms a_5 and a_6, from\n", "# Eq A2 of Ramos-Buades, Husa, and Pratten (2018)\n", "# https://arxiv.org/abs/1810.00036\n", "# These terms have been independently validated\n", "# against the same terms in Eq 7 of\n", "# Healy, Lousto, Nakano, and Zlochower (2017)\n", "# https://arxiv.org/abs/1702.00872\n", "# and a sign error was corrected in the a_5\n", "# expression.\n", "def p_t__a_5_thru_a_6(m1,m2, chi1x,chi1y,chi1z, chi2x,chi2y,chi2z, FixSignError=True):\n", " SignFix = sp.sympify(-1)\n", " if FixSignError == False:\n", " SignFix = sp.sympify(+1)\n", " q = m2/m1 # It is assumed that q >= 1, so m2 >= m1.\n", " global a_5,a_6\n", " a_5 = (SignFix*(13*q**3 + 60*q**2 + 116*q + 72)*chi1z/(16*(q+1)**4)\n", " +(-72*q**4 - 116*q**3 - 60*q**2 - 13*q)*chi2z/(16*(q+1)**4))\n", " a_6 = (+(+472*q**2 - 640)*chi1x**2/(128*(q+1)**4)\n", " +(-512*q**2 - 640*q - 64)*chi1y**2/(128*(q+1)**4)\n", " +(-108*q**2 + 224*q +512)*chi1z**2/(128*(q+1)**4)\n", " +(+472*q**2 - 640*q**4)*chi2x**2/(128*(q+1)**4)\n", " +(+192*q**3 + 560*q**2 + 192*q)*chi1x*chi2x/(128*(q+1)**4)\n", " +(-864*q**3 -1856*q**2 - 864*q)*chi1y*chi2y/(128*(q+1)**4)\n", " +(+480*q**3 +1064*q**2 + 480*q)*chi1z*chi2z/(128*(q+1)**4)\n", " +( -64*q**4 - 640*q**3 - 512*q**2)*chi2y**2/(128*(q+1)**4)\n", " +(+512*q**4 + 224*q**3 - 108*q**2)*chi2z**2/(128*(q+1)**4)\n", " +(+480*q**4 + 163*sp.pi**2*q**3 - 2636*q**3 + 326*sp.pi**2*q**2 - 6128*q**2 + 163*sp.pi**2*q-2636*q+480)\n", " /(128*(q+1)**4))" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.339690Z", "iopub.status.busy": "2021-03-07T17:37:36.339082Z", "iopub.status.idle": "2021-03-07T17:37:36.341191Z", "shell.execute_reply": "2021-03-07T17:37:36.341659Z" } }, "outputs": [], "source": [ "# Second version, for validation purposes only.\n", "def p_t__a_5_thru_a_6v2(m1,m2, chi1x,chi1y,chi1z, chi2x,chi2y,chi2z, FixSignError=True):\n", " SignFix = sp.sympify(-1)\n", " if FixSignError == False:\n", " SignFix = sp.sympify(+1)\n", " q = m2/m1 # It is assumed that q >= 1, so m2 >= m1.\n", " pi = sp.pi\n", " global a_5v2,a_6v2\n", " # Validated (separately) against HLNZ2017, as well as row 3 of Table V in RHP2018\n", " a_5v2 = SignFix*((13*q**3+60*q**2+116*q+72)*chi1z)/(16*(q+1)**4)+((-72*q**4-116*q**3-60*q**2-13*q)*chi2z)/(16*(q+1)**4)\n", " # Validated (separately) against HLNZ2017 version\n", " a_6v2 = (+(+472*q**2 - 640)*chi1x**2/(128*(q+1)**4)\n", " +(-512*q**2 - 640*q - 64)*chi1y**2/(128*(q+1)**4)\n", " +(-108*q**2 + 224*q + 512)*chi1z**2/(128*(q+1)**4)\n", " +(+472*q**2 - 640*q**4)*chi2x**2/(128*(q+1)**4)\n", " +(+192*q**3 + 560*q**2 + 192*q)*chi1x*chi2x/(128*(q+1)**4)\n", " +(-864*q**3 -1856*q**2 - 864*q)*chi1y*chi2y/(128*(q+1)**4)\n", " +(+480*q**3 +1064*q**2 + 480*q)*chi1z*chi2z/(128*(q+1)**4)\n", " +(- 64*q**4 - 640*q**3 - 512*q**2)*chi2y**2/(128*(q+1)**4)\n", " +(+512*q**4 + 224*q**3 - 108*q**2)*chi2z**2/(128*(q+1)**4)\n", " +(+480*q**4 + 163*pi**2*q**3 - 2636*q**3 + 326*pi**2*q**2 - 6128*q**2 + 163*pi**2*q - 2636*q + 480)\n", " /(128*(q+1)**4))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we compare the expression for $a_5$ with Eq. 7 of [Healy, Lousto, Nakano, and Zlochower (2017)](https://arxiv.org/abs/1702.00872), as additional validation that there is at least is a sign inconsistency:\n", "\n", "To reduce the possibility of copying errors, the following equation for $a_5$ is taken directly from the arXiv LaTeX source code of Eq. 7 of [Healy, Lousto, Nakano, and Zlochower (2017)](https://arxiv.org/abs/1702.00872), 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 NRPyPN notebooks.\n", "\n", "**Important: Note that [Healy, Lousto, Nakano, and Zlochower (2017)](https://arxiv.org/abs/1702.00872) adopts notation such that particle labels are interchanged: $1\\leftrightarrow 2$, with respect to [Ramos-Buades, Husa, and Pratten (2018)](https://arxiv.org/abs/1810.00036)**\n", "\n", "\\begin{align}\n", "a_5 &= + \\left( -\\frac{1}{16}\\,{\\frac {q \\left( 72\\,{q}^{3}+116\\,{q}^{2}+60\\,q+13 \\right) \n", "{\\chi_{1z}}}{ \\left( 1+q \\right) ^{4}}}\n", "-\\frac{1}{16}\\,{\\frac { \\left( 13\\,{q}^{3}+60\\,{q}^{2}+116\\,q+72 \\right) {\\chi_{2z}}}\n", "{ \\left( 1+q \\right) ^{4}}} \\right)\\\\\n", "\\end{align}" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.347566Z", "iopub.status.busy": "2021-03-07T17:37:36.346969Z", "iopub.status.idle": "2021-03-07T17:37:36.349081Z", "shell.execute_reply": "2021-03-07T17:37:36.349535Z" } }, "outputs": [], "source": [ "# Third version, for addtional validation.\n", "def p_t__a_5_thru_a_6_HLNZ2017(m1,m2, chi1x,chi1y,chi1z, chi2x,chi2y,chi2z):\n", " q = m2/m1 # It is assumed that q >= 1, so m2 >= m1.\n", " global a_5_HLNZ2017\n", " a_5_HLNZ2017 = (-div(1,16)*(q*(72*q**3 + 116*q**2 + 60*q + 13)*chi1z/(1+q)**4)\n", " -div(1,16)*( (13*q**3 + 60*q**2 +116*q + 72)*chi2z/(1+q)**4))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally, we validate that all 3 expressions for $a_5$ agree. (At the bottom, we confirm that all v2 expressions for $a_i$ match.)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.357989Z", "iopub.status.busy": "2021-03-07T17:37:36.357362Z", "iopub.status.idle": "2021-03-07T17:37:36.775643Z", "shell.execute_reply": "2021-03-07T17:37:36.774946Z" } }, "outputs": [], "source": [ "from NRPyPN_shortcuts import m1,m2, chi1U,chi2U # Import needed input variables\n", "\n", "p_t__a_5_thru_a_6( m1,m2, chi1U[0],chi1U[1],chi1U[2], chi2U[0],chi2U[1],chi2U[2])\n", "p_t__a_5_thru_a_6v2( m1,m2, chi1U[0],chi1U[1],chi1U[2], chi2U[0],chi2U[1],chi2U[2])\n", "# Again, the particle labels are interchanged in Healy, Lousto, Nakano, and Zlochower (2017):\n", "p_t__a_5_thru_a_6_HLNZ2017(m1,m2, chi2U[0],chi2U[1],chi2U[2], chi1U[0],chi1U[1],chi1U[2])\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", "if sp.simplify(a_5 - a_5v2) != 0: error(\"a_5v2\")\n", "if sp.simplify(a_5 - a_5_HLNZ2017) != 0: error(\"a_5_HLNZ2017\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally $a_7$:\n", "\n", "\\begin{align}\n", "a_7 &= \\left[ \\frac{5 (4 q+1) q^3 \\chi _{2 x}^2 \\chi _{2 z}}{2 (q+1)^4}-\\frac{5 (4 q+1) q^3 \\chi _{2 y}^2 \\chi _{2 z}}{8 (q+1)^4}-\\frac{5 (4 q+1) q^3 \\chi _{2 z}^3}{8 (q+1)^4}+\\chi _{1x} \\left(\\frac{15 (2 q+1) q^2 \\chi _{2 x} \\chi _{2 z}}{4 (q+1)^4}+\\frac{15 (q+2) q \\chi _{2 x} \\chi _{1z}}{4 (q+1)^4}\\right)\\right. \\nonumber\n", "\\\\\n", "&\\quad\\quad \\left.+\\chi _{1y} \\left(\\frac{15 q^2 \\chi _{2 y} \\chi _{1z}}{4 (q+1)^4}+\\frac{15 q^2 \\chi _{2 y} \\chi _{2 z}}{4 (q+1)^4}\\right)+\\chi _{1z} \\left(\\frac{15 q^2 (2 q+3) \\chi _{2 x}^2}{4 (q+1)^4}-\\frac{15 q^2 (q+2) \\chi _{2 y}^2}{4 (q+1)^4}-\\frac{15 q^2 \\chi _{2 z}^2}{4 (q+1)^3} \\right.\\right. \\nonumber\n", "\\\\\n", "&\\quad\\quad \\left.\\left. -\\frac{103 q^5+145 q^4-27 q^3+252 q^2+670 q+348}{32 (q+1)^6}\\right)-\\frac{\\left(348 q^5+670 q^4+252 q^3-27 q^2+145 q+103\\right) q \\chi _{2 z}}{32 (q+1)^6}\\right.\\nonumber\n", "\\\\\n", "&\\quad\\quad \\left.+\\chi _{1x}^2 \\left(\\frac{5 (q+4) \\chi _{1z}}{2 (q+1)^4}+\\frac{15 q (3 q+2) \\chi _{2 z}}{4 (q+1)^4}\\right)+\\chi _{1y}^2 \\left(-\\frac{5 (q+4) \\chi _{1z}}{8 (q+1)^4}-\\frac{15 q (2 q+1) \\chi _{2 z}}{4 (q+1)^4}\\right)-\\frac{15 q \\chi _{1z}^2 \\chi _{2 z}}{4 (q+1)^3}-\\frac{5 (q+4) \\chi _{1z}^3}{8 (q+1)^4} \\right]\n", "\\end{align}" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.790006Z", "iopub.status.busy": "2021-03-07T17:37:36.789306Z", "iopub.status.idle": "2021-03-07T17:37:36.792201Z", "shell.execute_reply": "2021-03-07T17:37:36.791642Z" } }, "outputs": [], "source": [ "# Construct term a_7, from Eq A2 of\n", "# Ramos-Buades, Husa, and Pratten (2018)\n", "# https://arxiv.org/abs/1810.00036\n", "def p_t__a_7(m1,m2, chi1x,chi1y,chi1z, chi2x,chi2y,chi2z):\n", " q = m2/m1 # It is assumed that q >= 1, so m2 >= m1.\n", " global a_7\n", " a_7 = (+5*(4*q+1)*q**3*chi2x**2*chi2z/(2*(q+1)**4)\n", " -5*(4*q+1)*q**3*chi2y**2*chi2z/(8*(q+1)**4)\n", " -5*(4*q+1)*q**3*chi2z**3 /(8*(q+1)**4)\n", " +chi1x*(+15*(2*q+1)*q**2*chi2x*chi2z/(4*(q+1)**4)\n", " +15*(1*q+2)*q *chi2x*chi1z/(4*(q+1)**4))\n", " +chi1y*(+15*q**2*chi2y*chi1z/(4*(q+1)**4)\n", " +15*q**2*chi2y*chi2z/(4*(q+1)**4))\n", " +chi1z*(+15*q**2*(2*q+3)*chi2x**2/(4*(q+1)**4)\n", " -15*q**2*( q+2)*chi2y**2/(4*(q+1)**4)\n", " -15*q**2 *chi2z**2/(4*(q+1)**3)\n", " -(103*q**5 + 145*q**4 - 27*q**3 + 252*q**2 + 670*q + 348)/(32*(q+1)**6))\n", " -(+348*q**5 + 670*q**4 + 252*q**3 - 27*q**2 + 145*q + 103)*q*chi2z/(32*(q+1)**6)\n", " +chi1x**2*(+5*(q+4)*chi1z/(2*(q+1)**4)\n", " +15*q*(3*q+2)*chi2z/(4*(q+1)**4))\n", " +chi1y**2*(-5*(q+4)*chi1z/(8*(q+1)**4)\n", " -15*q*(2*q+1)*chi2z/(4*(q+1)**4))\n", " -15*q*chi1z**2*chi2z/(4*(q+1)**3)\n", " -5*(q+4)*chi1z**3/(8*(q+1)**4))" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.805674Z", "iopub.status.busy": "2021-03-07T17:37:36.805025Z", "iopub.status.idle": "2021-03-07T17:37:36.807189Z", "shell.execute_reply": "2021-03-07T17:37:36.807706Z" } }, "outputs": [], "source": [ "# Second version, for validation purposes only.\n", "def p_t__a_7v2(m1,m2, chi1x,chi1y,chi1z, chi2x,chi2y,chi2z):\n", " q = m2/m1 # It is assumed that q >= 1, so m2 >= m1.\n", " global a_7v2\n", " a_7v2 = (+5*(4*q+1)*q**3*chi2x**2*chi2z/(2*(q+1)**4)\n", " -5*(4*q+1)*q**3*chi2y**2*chi2z/(8*(q+1)**4)\n", " -5*(4*q+1)*q**3*chi2z**3/(8*(q+1)**4)\n", " +chi1x*(+(15*(2*q+1)*q**2*chi2x*chi2z)/(4*(q+1)**4)\n", " +(15*( q+2)*q *chi2x*chi1z)/(4*(q+1)**4))\n", " +chi1y*(+(15*q**2*chi2y*chi1z)/(4*(q+1)**4)\n", " +(15*q**2*chi2y*chi2z)/(4*(q+1)**4))\n", " +chi1z*(+(15*q**2*(2*q+3)*chi2x**2)/(4*(q+1)**4)\n", " -(15*q**2*( q+2)*chi2y**2)/(4*(q+1)**4)\n", " -(15*q**2* chi2z**2)/(4*(q+1)**3)\n", " -(103*q**5+145*q**4-27*q**3+252*q**2+670*q+348)/(32*(q+1)**6))\n", " -(348*q**5+670*q**4+252*q**3-27*q**2+145*q+103)*q*chi2z/(32*(q+1)**6)\n", " +chi1x**2*(+5*(q+4)*chi1z/(2*(q+1)**4) + 15*q*(3*q+2)*chi2z/(4*(q+1)**4))\n", " +chi1y**2*(-5*(q+4)*chi1z/(8*(q+1)**4) - 15*q*(2*q+1)*chi2z/(4*(q+1)**4))\n", " -15*q*chi1z**2*chi2z/(4*(q+1)**3) - 5*(q+4)*chi1z**3/(8*(q+1)**4))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Putting it all together, recall that\n", "\n", "$$\n", "p_t = \\frac{q}{(1+q)^2}\\frac{1}{r^{1/2}}\\left(1 + \\sum_{k=2}^7 \\frac{a_k}{r^{k/2}}\\right),\n", "$$\n", "where $k/2$ is the post-Newtonian order." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.817509Z", "iopub.status.busy": "2021-03-07T17:37:36.816638Z", "iopub.status.idle": "2021-03-07T17:37:36.820007Z", "shell.execute_reply": "2021-03-07T17:37:36.819212Z" } }, "outputs": [], "source": [ "# Finally, sum the expressions for a_k to construct p_t as prescribed:\n", "# p_t = q/(sqrt(r)*(1+q)^2) (1 + \\sum_{k=2}^7 (a_k/r^{k/2}))\n", "def f_p_t(m1,m2, chi1U,chi2U, r):\n", " q = m2/m1 # It is assumed that q >= 1, so m2 >= m1.\n", " a = ixp.zerorank1(DIM=10)\n", " p_t__a_2_thru_a_4(m1,m2, chi1U[0],chi1U[1],chi1U[2], chi2U[0],chi2U[1],chi2U[2])\n", " a[2] = a_2\n", " a[3] = a_3\n", " a[4] = a_4\n", " p_t__a_5_thru_a_6(m1,m2, chi1U[0],chi1U[1],chi1U[2], chi2U[0],chi2U[1],chi2U[2])\n", " a[5] = a_5\n", " a[6] = a_6\n", " p_t__a_7( m1,m2, chi1U[0],chi1U[1],chi1U[2], chi2U[0],chi2U[1],chi2U[2])\n", " a[7] = a_7\n", " global p_t\n", " p_t = 1 # Term prior to the sum in parentheses\n", " for k in range(8):\n", " p_t += a[k]/r**div(k,2)\n", " p_t *= q / (1+q)**2 * 1/r**div(1,2)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.832747Z", "iopub.status.busy": "2021-03-07T17:37:36.831778Z", "iopub.status.idle": "2021-03-07T17:37:36.834913Z", "shell.execute_reply": "2021-03-07T17:37:36.835623Z" } }, "outputs": [], "source": [ "# Second version, for validation purposes only.\n", "def f_p_tv2(m1,m2, chi1U,chi2U, r):\n", " q = m2/m1 # It is assumed that q >= 1, so m2 >= m1.\n", " a = ixp.zerorank1(DIM=10)\n", " p_t__a_2_thru_a_4v2(m1,m2, chi1U[0],chi1U[1],chi1U[2], chi2U[0],chi2U[1],chi2U[2])\n", " a[2] = a_2v2\n", " a[3] = a_3v2\n", " a[4] = a_4v2\n", " p_t__a_5_thru_a_6v2(m1,m2, chi1U[0],chi1U[1],chi1U[2], chi2U[0],chi2U[1],chi2U[2])\n", " a[5] = a_5v2\n", " a[6] = a_6v2\n", " p_t__a_7v2( m1,m2, chi1U[0],chi1U[1],chi1U[2], chi2U[0],chi2U[1],chi2U[2])\n", " a[7] = a_7v2\n", " global p_tv2\n", " p_tv2 = 1 # Term prior to the sum in parentheses\n", " for k in range(8):\n", " p_tv2 += a[k]/r**div(k,2)\n", " p_tv2 *= q / (1+q)**2 * 1/r**div(1,2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Part 2: 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": 11, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:36.910554Z", "iopub.status.busy": "2021-03-07T17:37:36.874668Z", "iopub.status.idle": "2021-03-07T17:37:37.273526Z", "shell.execute_reply": "2021-03-07T17:37:37.273984Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ALL TESTS PASS\n" ] } ], "source": [ "from NRPyPN_shortcuts import q, num_eval # Import needed input variable & numerical evaluation routine\n", "\n", "f_p_t(m1,m2, chi1U,chi2U, 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_p_tv2(m1,m2, chi1U,chi2U, q)\n", "if sp.simplify(p_t - p_tv2) != 0: error(\"p_tv2\")\n", "\n", "# Validation against corresponding Python module:\n", "import PN_p_t as pt\n", "pt.f_p_t(m1,m2, chi1U,chi2U, q)\n", "\n", "if sp.simplify(p_t - pt.p_t) != 0: error(\"pt.p_t\")\n", "print(\"ALL TESTS PASS\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Part 3: Validation against trusted numerical values (i.e., in Table V of [Ramos-Buades, Husa, and Pratten (2018)](https://arxiv.org/abs/1810.00036)) \\[Back to [top](#toc)\\]\n", "$$\\label{code_validationv2}$$ " ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:37.281527Z", "iopub.status.busy": "2021-03-07T17:37:37.280626Z", "iopub.status.idle": "2021-03-07T17:37:37.283600Z", "shell.execute_reply": "2021-03-07T17:37:37.284286Z" } }, "outputs": [], "source": [ "# Useful function for comparing published & NRPyPN results\n", "def compare_pub_NPN(desc, pub,NPN,NPN_with_a5_chi1z_sign_error):\n", " print(\"##################################################\")\n", " print(\" \"+desc)\n", " print(\"##################################################\")\n", " print(str(pub) + \" <- Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018)\")\n", " print(str(NPN) + \" <- Result from NRPyPN\")\n", " relerror = abs(pub-NPN)/pub\n", " resultstring = \"Relative error between NRPyPN & published: \"+str(relerror*100)+\"%\"\n", " if relerror > 1e-3:\n", " resultstring += \" <--- NOT GOOD! (see explanation below)\"\n", " else:\n", " resultstring += \" <--- EXCELLENT AGREEMENT!\"\n", " print(resultstring+\"\\n\")\n", " print(str(NPN_with_a5_chi1z_sign_error) + \" <- Result from NRPyPN, with chi1z sign error in a_5 expression.\")" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:37.359536Z", "iopub.status.busy": "2021-03-07T17:37:37.323792Z", "iopub.status.idle": "2021-03-07T17:37:37.512319Z", "shell.execute_reply": "2021-03-07T17:37:37.511808Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "##################################################\n", " Case: q=1, nonspinning, initial separation 12\n", "##################################################\n", "0.0850941 <- Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018)\n", "0.0850940927209620 <- Result from NRPyPN\n", "Relative error between NRPyPN & published: 8.55410421798243e-6% <--- EXCELLENT AGREEMENT!\n", "\n", "0.085094092720962 <- Result from NRPyPN, with chi1z sign error in a_5 expression.\n" ] } ], "source": [ "# 1. Let's consider the case:\n", "# * Mass ratio q=1, chi1=chi2=(0,0,0), radial separation r=12\n", "pub_result = 0.850941e-1 # Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018) https://arxiv.org/abs/1810.00036\n", "NPN_with_a5_chi1z_sign_error = 0.0850940927209620 # should be unaffected by sign error, as chi1z=0.\n", "NPN_result = num_eval(p_t,\n", " qmassratio = 1.0, # must be >= 1\n", " nr = 12.0, # Orbital separation\n", " nchi1x = +0.,\n", " nchi1y = +0.,\n", " nchi1z = +0.,\n", " nchi2x = +0.,\n", " nchi2y = +0.,\n", " nchi2z = +0.)\n", "compare_pub_NPN(\"Case: q=1, nonspinning, initial separation 12\",\n", " pub_result,NPN_result,NPN_with_a5_chi1z_sign_error)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:37.587070Z", "iopub.status.busy": "2021-03-07T17:37:37.551331Z", "iopub.status.idle": "2021-03-07T17:37:37.745641Z", "shell.execute_reply": "2021-03-07T17:37:37.746107Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "##################################################\n", " Case: q=1.5, chi1z=-0.6, chi2z=0.6, initial separation 10.8\n", "##################################################\n", "0.0868557 <- Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018)\n", "0.0868556558764586 <- Result from NRPyPN\n", "Relative error between NRPyPN & published: 5.08009738035946e-5% <--- EXCELLENT AGREEMENT!\n", "\n", "0.0867002374951143 <- Result from NRPyPN, with chi1z sign error in a_5 expression.\n" ] } ], "source": [ "# 2. Let's consider the case:\n", "# * Mass ratio q=1.5, chi1= (0,0,-0.6); chi2=(0,0,0.6), radial separation r=10.8\n", "pub_result = 0.868557e-1 # Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018) https://arxiv.org/abs/1810.00036\n", "NPN_with_a5_chi1z_sign_error = 0.0867002374951143\n", "NPN_result = num_eval(p_t,\n", " qmassratio = 1.5, # must be >= 1\n", " nr = 10.8, # Orbital separation\n", " nchi1x = +0.,\n", " nchi1y = +0.,\n", " nchi1z = -0.6,\n", " nchi2x = +0.,\n", " nchi2y = +0.,\n", " nchi2z = +0.6)\n", "compare_pub_NPN(\"Case: q=1.5, chi1z=-0.6, chi2z=0.6, initial separation 10.8\",\n", " pub_result,NPN_result,NPN_with_a5_chi1z_sign_error)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:37.820529Z", "iopub.status.busy": "2021-03-07T17:37:37.784813Z", "iopub.status.idle": "2021-03-07T17:37:37.978885Z", "shell.execute_reply": "2021-03-07T17:37:37.978312Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "##################################################\n", " Case: q=4.0, chi1z=-0.8, chi2z=0.8, initial separation 11.0\n", "##################################################\n", "0.0559207 <- Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018)\n", "0.0558077537453816 <- Result from NRPyPN\n", "Relative error between NRPyPN & published: 0.201975752482377% <--- NOT GOOD! (see explanation below)\n", "\n", "0.0557629777874552 <- Result from NRPyPN, with chi1z sign error in a_5 expression.\n", "0.0558369 <- Second iteration value in pub result. Note that NRPyPN value is *closer* to this value.\n" ] } ], "source": [ "# 3. Let's consider the case:\n", "# * Mass ratio q=4, chi1= (0,0,-0.8); chi2=(0,0,0.8), radial separation r=11\n", "pub_result = 0.559207e-1 # Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018) https://arxiv.org/abs/1810.00036\n", "NPN_with_a5_chi1z_sign_error = 0.0557629777874552\n", "NPN_result = num_eval(p_t,\n", " qmassratio = 4.0, # must be >= 1\n", " nr = 11.0, # Orbital separation\n", " nchi1x = +0.,\n", " nchi1y = +0.,\n", " nchi1z = -0.8,\n", " nchi2x = +0.,\n", " nchi2y = +0.,\n", " nchi2z = +0.8)\n", "compare_pub_NPN(\"Case: q=4.0, chi1z=-0.8, chi2z=0.8, initial separation 11.0\",\n", " pub_result,NPN_result,NPN_with_a5_chi1z_sign_error)\n", "print(\"0.0558369 <- Second iteration value in pub result. Note that NRPyPN value is *closer* to this value.\")" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:38.052905Z", "iopub.status.busy": "2021-03-07T17:37:38.017119Z", "iopub.status.idle": "2021-03-07T17:37:38.247194Z", "shell.execute_reply": "2021-03-07T17:37:38.246687Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "##################################################\n", " Case: q=2.0, chi2x=-0.3535, chi2y=+0.3535, chi2z=+0.5, initial separation 10.8\n", "##################################################\n", "0.07935 <- Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018)\n", "0.0793500403866190 <- Result from NRPyPN\n", "Relative error between NRPyPN & published: 5.08968103607839e-5% <--- EXCELLENT AGREEMENT!\n", "\n", "0.079350040386619 <- Result from NRPyPN, with chi1z sign error in a_5 expression.\n" ] } ], "source": [ "# 4. Let's consider the case:\n", "# * Mass ratio q=2, chi1= (0,0,0); chi2=(−0.3535, 0.3535, 0.5), radial separation r=10.8\n", "pub_result = 0.7935e-1 # Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018) https://arxiv.org/abs/1810.00036\n", "NPN_with_a5_chi1z_sign_error = 0.0793500403866190 # should be unaffected by sign error, as chi1z=0.\n", "NPN_result = num_eval(p_t,\n", " qmassratio = 2.0, # must be >= 1\n", " nr = 10.8, # Orbital separation\n", " nchi1x = +0.,\n", " nchi1y = +0.,\n", " nchi1z = +0.,\n", " nchi2x = -0.3535,\n", " nchi2y = +0.3535,\n", " nchi2z = +0.5)\n", "compare_pub_NPN(\"Case: q=2.0, chi2x=-0.3535, chi2y=+0.3535, chi2z=+0.5, initial separation 10.8\",\n", " pub_result,NPN_result,NPN_with_a5_chi1z_sign_error)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:38.286187Z", "iopub.status.busy": "2021-03-07T17:37:38.265612Z", "iopub.status.idle": "2021-03-07T17:37:38.486999Z", "shell.execute_reply": "2021-03-07T17:37:38.486493Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "##################################################\n", " \n", "Case: q=8.0, chi1z=chi2z=+0.5, initial separation 11\n", "\n", "Note: This one is weird. Clearly the value in the table\n", " has a typo, such that the p_r and p_t values\n", " should be interchanged; p_t is about 20% the\n", " next smallest value in the table, and the\n", " parameters aren't that different. We therefore\n", " assume that this is the case, and find agreement\n", " with the published result to about 0.07%, which\n", " isn't the best, but given that the table values\n", " seem to be clearly wrong, it's an encouraging\n", " sign.\n", "\n", "##################################################\n", "0.0345755 <- Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018)\n", "0.0345503689803291 <- Result from NRPyPN\n", "Relative error between NRPyPN & published: 0.0726844721578464% <--- EXCELLENT AGREEMENT!\n", "\n", "0.0345584951081129 <- Result from NRPyPN, with chi1z sign error in a_5 expression.\n" ] } ], "source": [ "# 5. Let's consider the case:\n", "# * Mass ratio q=8, chi1= (0, 0, 0.5); chi2=(0, 0, 0.5), radial separation r=11\n", "pub_result = 0.345755e-1 # Expected result, from Table V of Ramos-Buades, Husa, and Pratten (2018) https://arxiv.org/abs/1810.00036\n", "NPN_with_a5_chi1z_sign_error = 0.0345584951081129 # should be unaffected by sign error, as chi1z=0.\n", "NPN_result = num_eval(p_t,\n", " qmassratio = 8.0, # must be >= 1\n", " nr = 11.0, # Orbital separation\n", " nchi1x = +0.,\n", " nchi1y = +0.,\n", " nchi1z = +0.5,\n", " nchi2x = +0.,\n", " nchi2y = +0.,\n", " nchi2z = +0.5)\n", "compare_pub_NPN(\"\"\"\n", "Case: q=8.0, chi1z=chi2z=+0.5, initial separation 11\n", "\n", "Note: This one is weird. Clearly the value in the table\n", " has a typo, such that the p_r and p_t values\n", " should be interchanged; p_t is about 20% the\n", " next smallest value in the table, and the\n", " parameters aren't that different. We therefore\n", " assume that this is the case, and find agreement\n", " with the published result to about 0.07%, which\n", " isn't the best, but given that the table values\n", " seem to be clearly wrong, it's an encouraging\n", " sign.\n", "\"\"\",pub_result,NPN_result,NPN_with_a5_chi1z_sign_error)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Part 4: 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-p_t.pdf](PN-p_t.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": 18, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:37:38.491417Z", "iopub.status.busy": "2021-03-07T17:37:38.490809Z", "iopub.status.idle": "2021-03-07T17:37:42.785164Z", "shell.execute_reply": "2021-03-07T17:37:42.785845Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Created PN-p_t.tex, and compiled LaTeX file to PDF file PN-p_t.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-p_t\")" ] } ], "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 }