From 6b11bbe7963cebf19fb23a34d7269f29e011dbf2 Mon Sep 17 00:00:00 2001 From: utensil Date: Sat, 6 Apr 2024 21:06:02 +0800 Subject: [PATCH] Add `tests of undual, g_invol, ccon, sp, norm2, & norm.ipynb` from #472 as is, as tests, renamed to `test_gsg_undual_etc.ipynb` Co-authored-by: Greg Grunberg --- examples/ipython/test_gsg_undual_etc.ipynb | 4071 ++++++++++++++++++++ 1 file changed, 4071 insertions(+) create mode 100644 examples/ipython/test_gsg_undual_etc.ipynb diff --git a/examples/ipython/test_gsg_undual_etc.ipynb b/examples/ipython/test_gsg_undual_etc.ipynb new file mode 100644 index 00000000..c6a4cda9 --- /dev/null +++ b/examples/ipython/test_gsg_undual_etc.ipynb @@ -0,0 +1,4071 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Testing of undualization, grade involution, Clifford conjugation, scalar product, normsquared, and norm\n", + "\n", + "Author: Greg Grunberg \n", + "Last updated 2021-03-31 " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this notebook I test the operations `undual`, `g_invol`, `ccon`, `sp`, `norm2`, and `norm`, code for which was described in the notebook **Code for undualization, grade involution, Clifford conjugation, scalar product, normsquared, and norm**. The first four of these are operations new to GAlgebra, while the last two are old operations I have newly recoded. \n", + "\n", + "Herein I use SymPy and the latest development version, as of this writing, of PyGAE Galgebra. PyGAE GAlgebra is available from https://github.com/pygae/galgebra, with the latest development version uploaded on 2020-10-18. *The GAlgebra module* **mv.py** *being used by this notebook is the 2020-10-18 version except modified so as to incoporate the `Mv` class methods testing of which is the purpose of this notebook.*\n", + "\n", + "I also use the GAlgebra module **gprinter.py**. That module, not yet available from the GitHub website, was provided directly to me by Alan Bromborsky, the original author of GAlgebra. The functions **`gprint`** and **`gFormat`** used herein come from **gprinter.py**.\n", + "\n", + "\n", + "**References** \n", + "[CAGC]: *Clifford Algebra to Geometric Calculus*, by Hestenes & Sobczyk \n", + "[GACS]: *Geometric Algebra for Computer Science*, by Dorst, Fontijne, & Mann \n", + "[LAGA]: *Linear and Geometric Algebra*, by Alan Macdonald\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 1. Notebook initialization\n", + "\n", + "Execution of the next cell makes SymPy and GAlgebra available within this notebook." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\DeclareMathOperator{\\Tr}{Tr}$$\n", + "$$\\DeclareMathOperator{\\Adj}{Adj}$$\n", + "$$\\newcommand{\\bfrac}[2]{\\displaystyle\\frac{#1}{#2}}$$\n", + "$$\\newcommand{\\lp}{\\left (}$$\n", + "$$\\newcommand{\\rp}{\\right )}$$\n", + "$$\\newcommand{\\paren}[1]{\\lp {#1} \\rp}$$\n", + "$$\\newcommand{\\half}{\\frac{1}{2}}$$\n", + "$$\\newcommand{\\llt}{\\left <}$$\n", + "$$\\newcommand{\\rgt}{\\right >}$$\n", + "$$\\newcommand{\\abs}[1]{\\left |{#1}\\right | }$$\n", + "$$\\newcommand{\\pdiff}[2]{\\bfrac{\\partial {#1}}{\\partial {#2}}}$$\n", + "$$\\newcommand{\\npdiff}[3]{\\bfrac{\\partial^{#3} {#1}}{\\partial {#2}^{#3}}}$$\n", + "$$\\newcommand{\\lbrc}{\\left \\{}$$\n", + "$$\\newcommand{\\rbrc}{\\right \\}}$$\n", + "$$\\newcommand{\\W}{\\wedge}$$\n", + "$$\\newcommand{\\prm}[1]{{#1}^{\\prime}}$$\n", + "$$\\newcommand{\\ddt}[1]{\\bfrac{d{#1}}{dt}}$$\n", + "$$\\newcommand{\\R}{\\dagger}$$\n", + "$$\\newcommand{\\deriv}[3]{\\bfrac{d^{#3}#1}{d{#2}^{#3}}}$$\n", + "$$\\newcommand{\\grade}[2]{\\left < {#1} \\right >_{#2}}$$\n", + "$$\\newcommand{\\f}[2]{{#1}\\lp {#2} \\rp}$$\n", + "$$\\newcommand{\\eval}[2]{\\left . {#1} \\right |_{#2}}$$\n", + "$$\\newcommand{\\bs}[1]{\\boldsymbol{#1}}$$\n", + "$$\\newcommand{\\grad}{\\bs{\\nabla}}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{This notebook is now using} \\\\\\qquad\\bullet~ \\text{Python }3.8.5\\qquad\\bullet~ \\text{SymPy }1.8.dev\\qquad\\bullet~ \\text{GAlgebra }0.5.0.$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from sys import version\n", + "\n", + "import sympy \n", + "from sympy import *\n", + "import galgebra\n", + "from galgebra.ga import * \n", + "from galgebra.mv import *\n", + "from galgebra.printer import Fmt, GaPrinter, Format\n", + " # Fmt: sets display mode of a multivector's basis expansion.\n", + " # GaPrinter: makes GA output a little more readable.\n", + " # Format: turns on latex printer.\n", + "from galgebra.gprinter import gFormat, gprint\n", + "\n", + "gFormat()\n", + "\t# Default `Fmode=True` suppresses display of a multivector fields'\n", + "\t# arguments. Default `Dmode=True` causes partial differentiation\n", + "\t# operators to be displayed in shortened form.\n", + "Ga.dual_mode('Iinv+') \n", + " # Sets dual of a multivector to be the multivector multiplied on \n", + " # its right by the inverse unit pseudoscalar, the convention used\n", + " # in LAGA, VAGC, and GACS.\n", + "gprint(r'\\text{This notebook is now using} \\\\',\n", + " r'\\qquad\\bullet~ \\text{Python }', version[:5],\n", + " r'\\qquad\\bullet~ \\text{SymPy }', sympy.__version__[:7],\n", + " r'\\qquad\\bullet~ \\text{GAlgebra }', \n", + " galgebra.__version__[:], r'.')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 2. Testing environment `g3` for operations `undual`, `g_invol`, `ccon`, and `sp`\n", + "\n", + "For testing purposes we will use the geometric algebra $\\mathbb{G}^{3,0}$ of Euclidean 3-space, which we implement in the next cell as `g3`. Cartesian coordinates $(x,y,z)$ are used.\n", + "\n", + "**Notation:** Unlike [GACS] and [LAGA], where boldface is used to signal that a multivector is a blade, this notebook uses boldface to denote non-scalar multivectors. Doing so allows establishes a visual distinction between a multivector $\\mathbf{A}$ and its grade 0 part, $A = \\left< \\mathbf{A} \\right>_0$. " + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\textbf{model } \\textsf{g3} \\textbf{ of } \\mathbb{R}^{3}:$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{coordinates}~~ \\left[ x, \\ y, \\ z\\right] $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{basis}~~ \\left( \\boldsymbol{\\mathbf{e}}_{x}, \\ \\boldsymbol{\\mathbf{e}}_{y}, \\ \\boldsymbol{\\mathbf{e}}_{z}\\right) $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{metric tensor}~~ [g_{ij}] = \\left[\\begin{array}{ccc}1 & 0 & 0\\\\0 & 1 & 0\\\\0 & 0 & 1\\end{array}\\right] \\text{ is Euclidean}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{unit pseudoscalar}~~ \\mathbf{I} = \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\begin{equation*} \\quad\\text{generic multivectors} \\\\ \\quad\\quad\\mathbf{A} = \\begin{aligned}[t] & A \\\\ & + A^{x} \\boldsymbol{\\mathbf{e}}_{x} + A^{y} \\boldsymbol{\\mathbf{e}}_{y} + A^{z} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} + A^{xz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} + A^{yz} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xyz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} \\end{equation*}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\begin{equation*} \\quad \\quad \\mathbf{B} = \\begin{aligned}[t] & B \\\\ & + B^{x} \\boldsymbol{\\mathbf{e}}_{x} + B^{y} \\boldsymbol{\\mathbf{e}}_{y} + B^{z} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + B^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} + B^{xz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} + B^{yz} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + B^{xyz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} \\end{equation*}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Instantiate Cartesian coordinates.\n", + "# Instantiate the geometric algebra `g3` of Euclidean 3-space:\n", + "x, y, z = symbols('x y z', real=True) \n", + "g3 = Ga('\\mathbf{e}', \n", + " g=[[1,0,0], [0,1,0], [0,0,1]],\n", + " coords=(x,y,z))\n", + "\n", + "# Show various attributes and functions of `g3`:\n", + "gprint(r\"\\textbf{model } \\textsf{g3} \\textbf{ of } \\mathbb{R}^{3}:\")\n", + "gprint(r'\\quad \\text{coordinates}~~', g3.coords)\n", + "gprint(r'\\quad \\text{basis}~~', g3.mv())\n", + "gprint(r'\\quad \\text{metric tensor}~~ [g_{ij}] =', g3.g,\n", + " r'\\text{ is Euclidean}')\n", + "gprint(r'\\quad \\text{unit pseudoscalar}~~ \\mathbf{I} =', g3.I())\n", + "\n", + "# Instantiate and show generic multivectors `A` and `B` of `g3`:\n", + "A = g3.mv('A', 'mv')\n", + "B = g3.mv('B', 'mv')\n", + "gprint(r'\\quad\\text{generic multivectors} \\\\ \\quad\\quad\\mathbf{A} =',\n", + " A.Fmt(2), r'\\\\\\quad \\quad \\mathbf{B} =', B.Fmt(2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 3 Tests of `undual`, `g_invol`, `ccon`, and `sp`" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.1. `undual` (undualization)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A} = \\begin{aligned}[t] & A \\\\ & + A^{x} \\boldsymbol{\\mathbf{e}}_{x} + A^{y} \\boldsymbol{\\mathbf{e}}_{y} + A^{z} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} + A^{xz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} + A^{yz} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xyz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A}^{\\star} = \\begin{aligned}[t] & A^{xyz} \\\\ & + A^{yz} \\boldsymbol{\\mathbf{e}}_{x} - A^{xz} \\boldsymbol{\\mathbf{e}}_{y} + A^{xy} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & - A^{z} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} + A^{y} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} - A^{x} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & - A \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A}^{-\\star} = \\begin{aligned}[t] & - A^{xyz} \\\\ & - A^{yz} \\boldsymbol{\\mathbf{e}}_{x} + A^{xz} \\boldsymbol{\\mathbf{e}}_{y} - A^{xy} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{z} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} - A^{y} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} + A^{x} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A}^{-\\star} = -\\mathbf{A}^{\\star}:~~ \\text{True} \\qquad \\text {(Note: }\\mathbf{I}^2 = -1 )$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle (\\mathbf{A}^{\\star})^{-\\star} = \\mathbf{A}:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle (\\mathbf{A}^{-\\star})^{\\star} = \\mathbf{A}:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Show `A`, its method dual, and its method undual. \n", + "gprint(r'\\mathbf{A} =', A.Fmt(2))\n", + "gprint(r'\\mathbf{A}^{\\star} =', A.dual().Fmt(2))\n", + "gprint(r'\\mathbf{A}^{-\\star} =', A.undual().Fmt(2))\n", + "gprint(r'\\mathbf{A}^{-\\star} = -\\mathbf{A}^{\\star}:~~',\n", + " A.undual() == - A.dual(), \n", + " r'\\qquad \\text {(Note: }\\mathbf{I}^2 =', I**2, ')')\n", + "\n", + "# Check whether method `dual` and method `undual` have inverse actions:\n", + "gprint(r'(\\mathbf{A}^{\\star})^{-\\star} = \\mathbf{A}:~~',\n", + " A.dual().undual() == A)\n", + "gprint(r'(\\mathbf{A}^{-\\star})^{\\star} = \\mathbf{A}:~~',\n", + " A.undual().dual() == A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.2. `g_invol` (grade involution)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A} = \\begin{aligned}[t] & A \\\\ & + A^{x} \\boldsymbol{\\mathbf{e}}_{x} + A^{y} \\boldsymbol{\\mathbf{e}}_{y} + A^{z} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} + A^{xz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} + A^{yz} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xyz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\widehat{\\mathbf{A}} = \\begin{aligned}[t] & A \\\\ & - A^{x} \\boldsymbol{\\mathbf{e}}_{x} - A^{y} \\boldsymbol{\\mathbf{e}}_{y} - A^{z} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} + A^{xz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} + A^{yz} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & - A^{xyz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\widehat{\\left< \\mathbf{A} \\right>_+} = +\\left< \\mathbf{A} \\right>_+:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\widehat{\\left< \\mathbf{A} \\right>_-} = -\\left< \\mathbf{A} \\right>_-:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\widehat{\\widehat{\\mathbf{A}}} = \\mathbf{A}:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Show `A` and its grade involute. \n", + "# Check whether `g_invol` is self-inverse:\n", + "gprint(r'\\mathbf{A} =', A.Fmt(2))\n", + "gprint(r'\\widehat{\\mathbf{A}} =', A.g_invol().Fmt(2))\n", + "gprint(r'\\widehat{\\left< \\mathbf{A} \\right>_+} = '\n", + " + r'+\\left< \\mathbf{A} \\right>_+:~~',\n", + " A.even().g_invol() == A.even())\n", + "gprint(r'\\widehat{\\left< \\mathbf{A} \\right>_-} = '\n", + " + r'-\\left< \\mathbf{A} \\right>_-:~~',\n", + " A.odd().g_invol() == - A.odd())\n", + "gprint(r'\\widehat{\\widehat{\\mathbf{A}}} = \\mathbf{A}:~~',\n", + " A.g_invol().g_invol() == A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.3. `ccon` (Clifford conjugation)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A} = \\begin{aligned}[t] & A \\\\ & + A^{x} \\boldsymbol{\\mathbf{e}}_{x} + A^{y} \\boldsymbol{\\mathbf{e}}_{y} + A^{z} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} + A^{xz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} + A^{yz} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xyz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\overline{\\mathbf{A}} = \\begin{aligned}[t] & A \\\\ & - A^{x} \\boldsymbol{\\mathbf{e}}_{x} - A^{y} \\boldsymbol{\\mathbf{e}}_{y} - A^{z} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & - A^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} - A^{xz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} - A^{yz} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xyz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\overline{\\overline{\\mathbf{A}}} = \\mathbf{A}:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\overline{\\mathbf{A}} = \\widehat{\\mathbf{A}}^\\dagger:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\overline{\\mathbf{A}} = \\widehat{\\mathbf{A^\\dagger}}:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Show `A` and its Clifford conjugate. \n", + "# Check whether `ccon` is self-inverse:\n", + "gprint(r'\\mathbf{A} =', A.Fmt(2))\n", + "gprint(r'\\overline{\\mathbf{A}} =', A.ccon().Fmt(2))\n", + "gprint(r'\\overline{\\overline{\\mathbf{A}}} = \\mathbf{A}:~~',\n", + " A.ccon().ccon() == A)\n", + "gprint(r'\\overline{\\mathbf{A}} = \\widehat{\\mathbf{A}}^\\dagger:~~',\n", + " A.ccon() == (A.g_invol()).rev())\n", + "gprint(r'\\overline{\\mathbf{A}} = \\widehat{\\mathbf{A^\\dagger}}:~~',\n", + " A.ccon() == (A.g_invol()).rev())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.4. `sp` (scalar products)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A} = \\begin{aligned}[t] & A \\\\ & + A^{x} \\boldsymbol{\\mathbf{e}}_{x} + A^{y} \\boldsymbol{\\mathbf{e}}_{y} + A^{z} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} + A^{xz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} + A^{yz} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + A^{xyz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{B} = \\begin{aligned}[t] & B \\\\ & + B^{x} \\boldsymbol{\\mathbf{e}}_{x} + B^{y} \\boldsymbol{\\mathbf{e}}_{y} + B^{z} \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + B^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} + B^{xz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{z} + B^{yz} \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\\\ & + B^{xyz} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y}\\wedge \\boldsymbol{\\mathbf{e}}_{z} \\end{aligned} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A} \\ast \\mathbf{B} = \\left< \\mathbf{A} \\mathbf{B} \\right>_0:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A} \\ast \\mathbf{B} = A B + A^{x} B^{x} - A^{xy} B^{xy} - A^{xyz} B^{xyz} - A^{xz} B^{xz} + A^{y} B^{y} - A^{yz} B^{yz} + A^{z} B^{z} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\Vert \\mathbf{A} \\Vert^2 = A^\\dagger \\ast A:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A} \\circledast \\mathbf{B} = A B + A^{x} B^{x} + A^{xy} B^{xy} + A^{xyz} B^{xyz} + A^{xz} B^{xz} + A^{y} B^{y} + A^{yz} B^{yz} + A^{z} B^{z} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\Vert\\mathbf{A}\\Vert^2 = \\mathbf{A}\\circledast\\mathbf{A}:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A} \\ast \\mathbf{B} =\\mathbf{A}^\\dagger \\circledast \\mathbf{B}:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A} \\circledast \\mathbf{B} =\\mathbf{A}^\\dagger \\ast \\mathbf{B}:~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Show `A`, `B`, their scalar product, and their alternate \n", + "# scalar product.\n", + "gprint(r'\\mathbf{A} =', A.Fmt(2))\n", + "gprint(r'\\mathbf{B} =', B.Fmt(2))\n", + "gprint(r'\\mathbf{A} \\ast \\mathbf{B} = '\n", + " + r'\\left< \\mathbf{A} \\mathbf{B} \\right>_0:~~',\n", + " A.sp(B) == (A*B).scalar()) \n", + "gprint(r'\\mathbf{A} \\ast \\mathbf{B} =', A.sp(B))\n", + "gprint(r'\\Vert \\mathbf{A} \\Vert^2 = A^\\dagger \\ast A:~~',\n", + " A.norm2() == A.rev().sp(A))\n", + "gprint(r'\\mathbf{A} \\circledast \\mathbf{B} =', A.sp(B,'rev'))\n", + "gprint(r'\\Vert\\mathbf{A}\\Vert^2 = \\mathbf{A}\\circledast\\mathbf{A}:~~',\n", + " A.norm2() == A.sp(A,'rev'))\n", + "gprint(r'\\mathbf{A} \\ast \\mathbf{B} ='\n", + " + r'\\mathbf{A}^\\dagger \\circledast \\mathbf{B}:~~',\n", + " A.sp(B) == A.rev().sp(B, 'rev'))\n", + "gprint(r'\\mathbf{A} \\circledast \\mathbf{B} ='\n", + " + r'\\mathbf{A}^\\dagger \\ast \\mathbf{B}:~~',\n", + " A.sp(B,'rev') == A.rev().sp(B))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The above tests include tests of the relationship of the (usual) scalar product $\\ast$ and the alternate scalar product $\\circledast$ to the normsquared operation $\\Vert \\cdot \\Vert^2$." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.5. Conclusions from testing the new operations\n", + "\n", + "The output from each of the executable In[ ] cells of subsections 3.1, 3.2, 3.3, and 3.4 was precisely what was expected from calculations done by hand. That, together with the simplicity of the code, should give confidence that the operations were correctly coded." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 4. Testing environments `e2`, `e2_polar`, `m2`, and `m2_polar` for `norm2` and `norm`\n", + "\n", + "We shall test `norm2` and `norm` in the context of four simple models: \n", + "1. `e2` models $\\mathbb{E}^2$ (Euclidean 2-space) using Cartesian coordinates $(x,y)$. The basis $(\\mathbf{e}_x,\\mathbf{e}_y)$ for the tangent space to $\\mathbb{E}^2$ at location $(x,y)$ is orthonormal. Basis vectors are independent of location, which is to say every tangent space uses the same basis. \n", + "\n", + "2. `e2_polar` models $\\mathbb{E}^2$ using polar coordinates $(r,\\theta)$, which are related to the Cartesian coordinates through the relationship $(x,y) = (r \\cos(\\theta), r \\sin(\\theta))$. The basis $(\\mathbf{b}_r,\\mathbf{b}_\\theta)$ for the tangent space to $\\mathbb{E}^2$ at location $(r,\\theta)$ is orthogonal but not orthonormal. The lengths and directions of the basis vectors depend on location ($(r,\\theta)$) (the point of tangency). The origin $r=0$ is excluded from the coordinate system, so we require $r>0$. \n", + "\n", + "3. `m2` models $\\mathbb{M}^{1,1}$ (Minkowski 2-space) using Cartesian coordinates $(s,t)$. The basis $(\\mathbf{e}_s,\\mathbf{e}_t)$ for the tangent space to $\\mathbb{M}^{1,1}$ at $(s,t)$ is orthonormal. Basis vectors are independent of location $(s,t)$. \n", + "\n", + "4. `m2_polar` models $\\mathbb{M}^{1,1}$ using hyperbolic polar coordinates$^\\ast$ $(\\rho,\\phi)$, which are related to the Cartesian coordinates through the relationship $(s,t) = (\\rho \\cosh(\\phi), \\rho \\sinh(\\phi))$. The basis $(\\mathbf{b}_\\rho,\\mathbf{b}_\\phi)$ for the tangent space to $\\mathbb{E}^2$ at $(\\rho,\\phi)$ is orthogonal but not orthonormal. The lengths and directions of the basis vectors depend on location. Hyperbolic polar coordinates as defined here correspond to the region described in Cartesian coordinates $(s,t)$ as lying between the null lines $t=+s$ and $t=-s$, with $s>0$. In particular this excludes the origin $\\rho=0$, so we require $\\rho>0$. But even were the origin included, the polar coordinates describe only a quarter of the 2-space. More specifically they should be called a coordinates *patch*.\n", + "\n", + "For each of the four models I define a symbolic multivector $\\mathbf{S}$ and a constant (location-independent) numeric multivector $\\mathbf{N}$. The numeric multivector `N2` of model `e2_polar` has been so designed as to represent the same constant multivector $\\mathbf{N}$ as numeric multivector `N1` of model `e2`. Similarly `N4` of `m2_polar` represents the same constant numeric multivector as does `N3` of `m2`. For models `m2` and `m2_polar` of the non-Euclidean space $\\mathbb{M}^{1,1}$, I also define multivector fields $\\mathbf{A}$ and $\\mathbf{B}$, respectively, for which $\\Vert\\mathbf{A}\\Vert^2 > 0$ and $\\Vert\\mathbf{B}\\Vert^2 < 0$.\n", + "\n", + "$^\\ast$ \"Hyperbolic polar\" is a name of my own invention, meant to indicate an analog on the *hyperbolic* plane (Minkowski 2-space) of *polar* coordinates $(r,\\theta)$ on the Euclidean plane. If there's a standard name or standard symbols for these coordinates, I'm unaware of it." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\textbf{model }\\textsf{e2}\\textbf{ of }\\mathbb{E}^2:$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{coordinates}~~ \\left[ x, \\ y\\right] $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{basis}~~ \\left( \\boldsymbol{\\mathbf{e}}_{x}, \\ \\boldsymbol{\\mathbf{e}}_{y}\\right) $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{metric tensor}~~ [g_{ij}] = \\left[\\begin{array}{cc}1 & 0\\\\0 & 1\\end{array}\\right] \\text{ is Euclidean:}~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{multivectors}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{S} = S + S^{x} \\boldsymbol{\\mathbf{e}}_{x} + S^{y} \\boldsymbol{\\mathbf{e}}_{y} + S^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{N} = - 2 \\sqrt{6} - \\frac{3 \\sqrt{3}}{2} \\boldsymbol{\\mathbf{e}}_{x} + \\frac{3}{2} \\boldsymbol{\\mathbf{e}}_{y} -4 \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Model 1 \n", + "# Create Cartesian coordinates model `e2` of Euclidean 2-space.\n", + "x, y = symbols('x y', real=True)\n", + "e2 = Ga('\\mathbf{e}', g=[1,1], coords=(x,y))\n", + "ex, ey = e2.mv()\n", + "# Create symbolic mixed grade multivector `S1`.\n", + "S1 = e2.mv('S', 'mv')\n", + "# Create numeric mixed grade multivector `N1`.\n", + "N1 = -sqrt(24) - (sqrt(27)/2)*ex + Rational(3,2)*ey - 4*(ex^ey)\n", + "\n", + "# Show various attributes and functions of `e2`:\n", + "gprint(r\"\\textbf{model }\\textsf{e2}\\textbf{ of }\\mathbb{E}^2:\")\n", + "gprint(r'\\quad \\text{coordinates}~~', e2.coords)\n", + "gprint(r'\\quad \\text{basis}~~', e2.mv())\n", + "gprint(r'\\quad \\text{metric tensor}~~ [g_{ij}] =', e2.g,\n", + " r'\\text{ is Euclidean:}~~', e2.g.is_positive_definite)\n", + "# Show multivectors `S1` and `N1` of `e2`:\n", + "gprint(r'\\quad \\text{multivectors}')\n", + "gprint(r'\\quad \\quad \\mathbf{S} =', S1)\n", + "gprint(r'\\quad \\quad \\mathbf{N} =', N1)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\textbf{model }\\textsf{e2_polar}\\textbf{ of }\\mathbb{E}^2:$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{coordinates}~~ \\left[ r, \\ \\theta \\right] $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{basis}~~ \\left( \\boldsymbol{\\mathbf{b}}_{r}, \\ \\boldsymbol{\\mathbf{b}}_{\\theta }\\right) $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{metric tensor}~~ [g_{ij}] = \\left[\\begin{array}{cc}1 & 0\\\\0 & r^{2}\\end{array}\\right] \\text{ is Euclidean:}~~ \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{multivectors}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{S} = S + S^{r} \\boldsymbol{\\mathbf{b}}_{r} + S^{\\theta } \\boldsymbol{\\mathbf{b}}_{\\theta } + S^{r\\theta } \\boldsymbol{\\mathbf{b}}_{r}\\wedge \\boldsymbol{\\mathbf{b}}_{\\theta } $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{N} = - 2 \\sqrt{6} - 3 \\cos{\\left (\\theta + \\frac{\\pi}{6} \\right )} \\boldsymbol{\\mathbf{b}}_{r} + \\frac{3 \\sin{\\left (\\theta + \\frac{\\pi}{6} \\right )}}{r} \\boldsymbol{\\mathbf{b}}_{\\theta } - \\frac{4}{r} \\boldsymbol{\\mathbf{b}}_{r}\\wedge \\boldsymbol{\\mathbf{b}}_{\\theta } $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Model 2\n", + "# Create polar coordinates model `e2_polar` of Euclidean 2-space. \n", + "r = symbols('r', positive=True) # origin r=0 NOT included \n", + "theta = symbols('theta', real=True)\n", + "p = (r*cos(theta), r*sin(theta)) \n", + "e2_polar = Ga('\\mathbf{b}', g=[1,r**2], coords=(r,theta))\n", + "br, btheta = e2_polar.mv() # basis vectors NOT normalized\n", + "# Create symbolic mixed grade multivector `S2`.\n", + "# Create numeric mixed grade multivector `N2`.\n", + "S2 = e2_polar.mv('S', 'mv')\n", + "N2 = -sqrt(24) + ((3*sin(theta) - sqrt(27)*cos(theta))/2)*br \\\n", + " + ((3*cos(theta) + sqrt(27)*sin(theta))/(2*r))*btheta \\\n", + " - (4/r)*(br^btheta)\n", + "\n", + "# Show various attributes and functions of `e2_polar`:\n", + "gprint(r\"\\textbf{model }\\textsf{e2_polar}\\textbf{ of }\\mathbb{E}^2:\")\n", + "gprint(r'\\quad \\text{coordinates}~~', e2_polar.coords)\n", + "gprint(r'\\quad \\text{basis}~~', e2_polar.mv())\n", + "gprint(r'\\quad \\text{metric tensor}~~ [g_{ij}] =', e2_polar.g,\n", + " r'\\text{ is Euclidean:}~~', e2_polar.g.is_positive_definite)\n", + "# Show multivectors `S2` and `N2` of `e2_polar`:\n", + "gprint(r'\\quad \\text{multivectors}')\n", + "gprint(r'\\quad \\quad \\mathbf{S} =', S2)\n", + "gprint(r'\\quad \\quad \\mathbf{N} =', N2)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\textbf{model }\\textsf{m2}\\textbf{ of }\\mathbb{M}^{1,1}:$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{coordinates}~~ \\left[ s, \\ t\\right] $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{basis}~~ \\left( \\boldsymbol{\\mathbf{e}}_{s}, \\ \\boldsymbol{\\mathbf{e}}_{t}\\right) $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{metric tensor}~~ [g_{ij}] = \\left[\\begin{array}{cc}1 & 0\\\\0 & -1\\end{array}\\right] \\text{ is Euclidean:}~~ \\text{False} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{multivectors}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{S} = S + S^{s} \\boldsymbol{\\mathbf{e}}_{s} + S^{t} \\boldsymbol{\\mathbf{e}}_{t} + S^{st} \\boldsymbol{\\mathbf{e}}_{s}\\wedge \\boldsymbol{\\mathbf{e}}_{t} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{N} = - 2 \\sqrt{7} + 3 \\boldsymbol{\\mathbf{e}}_{s} + 5 \\boldsymbol{\\mathbf{e}}_{t} - \\sqrt{37} \\boldsymbol{\\mathbf{e}}_{s}\\wedge \\boldsymbol{\\mathbf{e}}_{t} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{A} = 5 + \\left ( s^{2} + t^{2}\\right ) \\boldsymbol{\\mathbf{e}}_{s} + s^{2} \\boldsymbol{\\mathbf{e}}_{t} -5 \\boldsymbol{\\mathbf{e}}_{s}\\wedge \\boldsymbol{\\mathbf{e}}_{t} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Model 3 \n", + "# Create Cartesian coordinates model `m2` of Minkowski 2-space. \n", + "s, t = symbols('s t', real=True)\n", + "m2 = Ga('\\mathbf{e}', g=[1,-1], coords=(s,t))\n", + "es, et = m2.mv()\n", + "# Create symbolic mixed grade multivector `S3`.\n", + "S3 = m2.mv('S', 'mv')\n", + "# Create numeric mixed grade multivector `N3`.\n", + "N3 = -sqrt(28) + 3*es + 5*et - sqrt(37)*(es^et)\n", + "# Create position-dependent multivector `A3` with a nonnegative\n", + "# normsquared. `A3` will be used to test Case 3(a) in the execution\n", + "# of `norm`'s code.\n", + "A3 = 5 + (s**2 + t**2)*es + (s**2)*et - 5*(es^et) \n", + "\n", + "# Show various attributes and functions of `m2`:\n", + "gprint(r\"\\textbf{model }\\textsf{m2}\\textbf{ of }\\mathbb{M}^{1,1}:\")\n", + "gprint(r'\\quad \\text{coordinates}~~', m2.coords)\n", + "gprint(r'\\quad \\text{basis}~~', m2.mv())\n", + "gprint(r'\\quad \\text{metric tensor}~~ [g_{ij}] =', m2.g,\n", + " r'\\text{ is Euclidean:}~~', m2.g.is_positive_definite)\n", + "# Show multivectors `S3`,`N3`, and `A3` of `m2`:\n", + "gprint(r'\\quad \\text{multivectors}')\n", + "gprint(r'\\quad \\quad \\mathbf{S} =', S3)\n", + "gprint(r'\\quad \\quad \\mathbf{N} =', N3)\n", + "gprint(r'\\quad \\quad \\mathbf{A} =', A3)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\textbf{model }\\textsf{m2_polar}\\textbf{ of }\\mathbb{M}^{1,1}:$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{coordinates}~~ \\left[ \\rho , \\ \\phi \\right] $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{basis}~~ \\left( \\boldsymbol{\\mathbf{b}}_{\\rho }, \\ \\boldsymbol{\\mathbf{b}}_{\\phi }\\right) $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{metric tensor}~~ [g_{ij}] = \\left[\\begin{array}{cc}1 & 0\\\\0 & - \\rho ^{2}\\end{array}\\right] \\text{ is Euclidean:}~~ \\text{False} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\text{multivectors}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{S} = S + S^{\\rho } \\boldsymbol{\\mathbf{b}}_{\\rho } + S^{\\phi } \\boldsymbol{\\mathbf{b}}_{\\phi } + S^{\\rho \\phi } \\boldsymbol{\\mathbf{b}}_{\\rho }\\wedge \\boldsymbol{\\mathbf{b}}_{\\phi } $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{N} = - 2 \\sqrt{7} + \\left ( - e^{\\phi } + 4 e^{- \\phi }\\right ) \\boldsymbol{\\mathbf{b}}_{\\rho } + \\frac{e^{\\phi } + 4 e^{- \\phi }}{\\rho } \\boldsymbol{\\mathbf{b}}_{\\phi } - \\frac{\\sqrt{37}}{\\rho } \\boldsymbol{\\mathbf{b}}_{\\rho }\\wedge \\boldsymbol{\\mathbf{b}}_{\\phi } $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\quad \\quad \\mathbf{B} = \\rho ^{2} -16 \\boldsymbol{\\mathbf{b}}_{\\rho } + \\frac{16}{\\rho } \\boldsymbol{\\mathbf{b}}_{\\phi } - \\sqrt{\\phi ^{2} + \\rho ^{2}} \\boldsymbol{\\mathbf{b}}_{\\rho }\\wedge \\boldsymbol{\\mathbf{b}}_{\\phi } $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Model 4 \n", + "# Create hyperbolic polar coordinates model `m2_polar` of\n", + "# Minkowski 2-space.\n", + "rho = symbols('rho', positive=True) # origin rho=0 NOT included\n", + "phi = symbols('phi', real=True)\n", + "m2_polar = Ga('\\mathbf{b}', g=[1,-rho**2], coords=(rho, phi))\n", + "brho, bphi = m2_polar.mv() # basis vectors NOT normalized\n", + "# Create symbolic mixed grade multivector `S4`.\n", + "S4 = m2_polar.mv('S', 'mv')\n", + "# Create numeric mixed grade multivector `N3`.\n", + "N4 = -sqrt(28) + (3*cosh(phi) - 5*sinh(phi))*brho \\\n", + " + ((5*cosh(phi) - 3*sinh(phi))/rho)*bphi \\\n", + " - (sqrt(37)/rho)*(brho^bphi)\n", + "# Create position-dependent multivector `B4` with a nonpositive\n", + "# normsquared. `B4` will be used to test Case 3(b) in the execution\n", + "# of `norm`'s code.\n", + "B4 = rho**2 - 16*brho + (16/rho)*bphi - sqrt(rho**2 \\\n", + " + phi**2)*(brho^bphi)\n", + "\n", + "# Show various attributes and functions of `m2_polar`:\n", + "gprint(r\"\\textbf{model }\\textsf{m2_polar}\\textbf{ of }\\mathbb{M}^{1,1}:\")\n", + "gprint(r'\\quad \\text{coordinates}~~', m2_polar.coords)\n", + "gprint(r'\\quad \\text{basis}~~', m2_polar.mv())\n", + "gprint(r'\\quad \\text{metric tensor}~~ [g_{ij}] =', m2_polar.g,\n", + " r'\\text{ is Euclidean:}~~', m2_polar.g.is_positive_definite)\n", + "# Show multivectors `S4`,`N4`, and `B4` of `m2_polar`:\n", + "gprint(r'\\quad \\text{multivectors}')\n", + "gprint(r'\\quad \\quad \\mathbf{S} =', S4)\n", + "gprint(r'\\quad \\quad \\mathbf{N} =', N4)\n", + "gprint(r'\\quad \\quad \\mathbf{B} =', B4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "*Remark:* The above reports as to whether the model's metric tensor `g` is Euclidean use the same test `g.is_positive_definite` as is used in Case 2 of `norm`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 5. The test program for `norm2` and `norm` \n", + "The next cell defines a program that displays the multivector `M` which is its argument, indicates the geometric algebra to which `M` belongs, shows the normsquared of `M`, and then shows for each of the three possible `hint` values the norm of `M`.\n", + "\n", + "Only multivectors defined in Section 4 (i.e. `S1`, `S2`, `S3`, `S4`, `N1`, `N2`, `N3`, `N4`, `A3`, and `B4`) are allowed values of `M`." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [], + "source": [ + "def test_with(M):\n", + " \"\"\"\n", + " Computes and displays the multivector `M`, its normsquared, \n", + " and its norm as computed with each of the allowed hint values.\n", + " Does the same for each grade part of `M`.\n", + " \"\"\"\n", + " ga_str = \\\n", + " {e2:r'\\mathbb{G}(\\mathbb{E}^2)',\n", + " e2_polar:r'\\mathbb{G}(\\mathbb{E}^2)',\n", + " m2:r'\\mathbb{G}(\\mathbb{M}^{1,1})',\n", + " m2_polar:r'\\mathbb{G}(\\mathbb{M}^{1,1})'}\n", + " model_str = {e2:r'\\textsf{e2}', e2_polar:r'\\textsf{e2_polar}',\n", + " m2:r'\\testsf{m2}', m2_polar:r'\\textsf{m2_polar}'}\n", + " M_str = {S1:r'\\mathbf{S}', S2:r'\\mathbf{S}',\n", + " S3:r'\\mathbf{S}', S4:r'\\mathbf{S}',\n", + " N1:r'\\mathbf{N}', N2:r'\\mathbf{N}',\n", + " N3:r'\\mathbf{N}', N4:r'\\mathbf{N}',\n", + " A3:r'\\mathbf{A}', B4:r'\\mathbf{B}'}\n", + " # Display multivector `M`, its normsquared, and its norm:\n", + " gprint(M_str[M] + r'=', M, r'\\in', ga_str[M.Ga])\n", + " gprint(r'\\qquad \\implies \\Vert'+M_str[M]+r'\\Vert^2 =', \n", + " M.norm2())\n", + " gprint(r'\\qquad \\implies \\vert'+M_str[M]+r'\\vert =',\n", + " M.norm('0'), r\"\\quad \\text{ when hint is '0'}\")\n", + " gprint(r'\\qquad \\qquad\\; \\vert'+M_str[M]+r'\\vert =', \n", + " M.norm('+'), r\"\\quad \\text{ when hint is '+'}\")\n", + " gprint(r'\\qquad \\qquad\\; \\vert'+M_str[M]+r'\\vert =', \n", + " M.norm('-'), r\"\\quad \\text{ when hint is '-'}\")\n", + " # Display grade parts of multivector `M`, their normsquareds,\n", + " # and their norms:\n", + " for g in range(3):\n", + " gprint(r'\\left<' +M_str[M]+r'\\right>_'+str(g)+r' =',\n", + " M.grade(g), r'\\in ', ga_str[M.grade(g).Ga]) \n", + " gprint(r'\\qquad \\implies \\Vert\\left<'+M_str[M]+r'\\right>_'\n", + " +str(g)+r'\\Vert^2 =', M.grade(g).norm2())\n", + " gprint(r'\\qquad \\implies \\vert\\left<'+M_str[M]+r'\\right>_'\n", + " +str(g)+r'\\vert =', M.grade(g).norm('0'),\n", + " r\"\\quad \\text{ when hint is '0'}\")\n", + " gprint(r'\\qquad \\qquad\\; \\vert\\left<'+M_str[M]+r'\\right>_'\n", + " +str(g)+r'\\vert =', M.grade(g).norm('+'),\n", + " r\"\\quad \\text{ when hint is '+'}\")\n", + " gprint(r'\\qquad \\qquad\\; \\vert\\left<'+M_str[M]+r'\\right>_'\n", + " +str(g)+r'\\vert =', M.grade(g).norm('-'),\n", + " r\"\\quad \\text{ when hint is '-'}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 6. Tests of `norm2` and `norm`" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 6.1 Testing within `e2` \n", + "The next two In[ ] cells test `norm2` and `norm` with the multivectors `S1` and `N1` from `e2`. \n", + "- Since `e2` has a Euclidean metric, the value of `S1.norm(hint)` should not and does not depend on the `hint` given.\n", + "- Since `N1` is a location-independent numeric multivector, the value of `N1.norm(hint)` should not and does not depend on the `hint` given. Neither does it depend on location." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{S}= S + S^{x} \\boldsymbol{\\mathbf{e}}_{x} + S^{y} \\boldsymbol{\\mathbf{e}}_{y} + S^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} \\in\\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{S}\\Vert^2 = S^{2} + {\\left ( S^{x} \\right )}^{2} + {\\left ( S^{xy} \\right )}^{2} + {\\left ( S^{y} \\right )}^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{S}\\vert = \\sqrt{S^{2} + {\\left ( S^{x} \\right )}^{2} + {\\left ( S^{xy} \\right )}^{2} + {\\left ( S^{y} \\right )}^{2}} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{S}\\vert = \\sqrt{S^{2} + {\\left ( S^{x} \\right )}^{2} + {\\left ( S^{xy} \\right )}^{2} + {\\left ( S^{y} \\right )}^{2}} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{S}\\vert = \\sqrt{S^{2} + {\\left ( S^{x} \\right )}^{2} + {\\left ( S^{xy} \\right )}^{2} + {\\left ( S^{y} \\right )}^{2}} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_0 = S \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_0\\Vert^2 = S^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_1 = S^{x} \\boldsymbol{\\mathbf{e}}_{x} + S^{y} \\boldsymbol{\\mathbf{e}}_{y} \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_1\\Vert^2 = {\\left ( S^{x} \\right )}^{2} + {\\left ( S^{y} \\right )}^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{{\\left ( S^{x} \\right )}^{2} + {\\left ( S^{y} \\right )}^{2}} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{{\\left ( S^{x} \\right )}^{2} + {\\left ( S^{y} \\right )}^{2}} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{{\\left ( S^{x} \\right )}^{2} + {\\left ( S^{y} \\right )}^{2}} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_2 = S^{xy} \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_2\\Vert^2 = {\\left ( S^{xy} \\right )}^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_2\\vert = \\left|{S^{xy}}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_2\\vert = \\left|{S^{xy}}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_2\\vert = \\left|{S^{xy}}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(S1)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{N}= - 2 \\sqrt{6} - \\frac{3 \\sqrt{3}}{2} \\boldsymbol{\\mathbf{e}}_{x} + \\frac{3}{2} \\boldsymbol{\\mathbf{e}}_{y} -4 \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} \\in\\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{N}\\Vert^2 = 49 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{N}\\vert = 7 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{N}\\vert = 7 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{N}\\vert = 7 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_0 = - 2 \\sqrt{6} \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_0\\Vert^2 = 24 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{6} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{6} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{6} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_1 = - \\frac{3 \\sqrt{3}}{2} \\boldsymbol{\\mathbf{e}}_{x} + \\frac{3}{2} \\boldsymbol{\\mathbf{e}}_{y} \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_1\\Vert^2 = 9 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_1\\vert = 3 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_1\\vert = 3 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_1\\vert = 3 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_2 = -4 \\boldsymbol{\\mathbf{e}}_{x}\\wedge \\boldsymbol{\\mathbf{e}}_{y} \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_2\\Vert^2 = 16 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_2\\vert = 4 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_2\\vert = 4 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_2\\vert = 4 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(N1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 6.2 Testing within `e2_polar` \n", + "The next two In[ ] cells test `norm2` and `norm` with the multivectors `S2` and `N2` from `e2_polar`. \n", + "- Since `e2_polar` has a Euclidean metric, the value of `S2.norm(hint)` should not and does not depend on the `hint` given.\n", + "- Since `N2` is a location-independent numeric multivector, the value of `N2.norm(hint)` should not and does not depend on the `hint` given. Neither does it depend on location.\n", + "- Notice the results for `N2` should and do agree with those for `N1` above, which is as desired since `N1` and `N2` represent the same position-independent numeric multivector in $\\mathbb{G}(\\mathbb{E}^2)$." + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{S}= S + S^{r} \\boldsymbol{\\mathbf{b}}_{r} + S^{\\theta } \\boldsymbol{\\mathbf{b}}_{\\theta } + S^{r\\theta } \\boldsymbol{\\mathbf{b}}_{r}\\wedge \\boldsymbol{\\mathbf{b}}_{\\theta } \\in\\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{S}\\Vert^2 = S^{2} + {\\left ( S^{r} \\right )}^{2} + {\\left ( S^{r\\theta } \\right )}^{2} r^{2} + {\\left ( S^{\\theta } \\right )}^{2} r^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{S}\\vert = \\sqrt{S^{2} + {\\left ( S^{r} \\right )}^{2} + {\\left ( S^{r\\theta } \\right )}^{2} r^{2} + {\\left ( S^{\\theta } \\right )}^{2} r^{2}} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{S}\\vert = \\sqrt{S^{2} + {\\left ( S^{r} \\right )}^{2} + {\\left ( S^{r\\theta } \\right )}^{2} r^{2} + {\\left ( S^{\\theta } \\right )}^{2} r^{2}} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{S}\\vert = \\sqrt{S^{2} + {\\left ( S^{r} \\right )}^{2} + {\\left ( S^{r\\theta } \\right )}^{2} r^{2} + {\\left ( S^{\\theta } \\right )}^{2} r^{2}} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_0 = S \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_0\\Vert^2 = S^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_1 = S^{r} \\boldsymbol{\\mathbf{b}}_{r} + S^{\\theta } \\boldsymbol{\\mathbf{b}}_{\\theta } \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_1\\Vert^2 = {\\left ( S^{r} \\right )}^{2} + {\\left ( S^{\\theta } \\right )}^{2} r^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{{\\left ( S^{r} \\right )}^{2} + {\\left ( S^{\\theta } \\right )}^{2} r^{2}} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{{\\left ( S^{r} \\right )}^{2} + {\\left ( S^{\\theta } \\right )}^{2} r^{2}} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{{\\left ( S^{r} \\right )}^{2} + {\\left ( S^{\\theta } \\right )}^{2} r^{2}} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_2 = S^{r\\theta } \\boldsymbol{\\mathbf{b}}_{r}\\wedge \\boldsymbol{\\mathbf{b}}_{\\theta } \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_2\\Vert^2 = {\\left ( S^{r\\theta } \\right )}^{2} r^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_2\\vert = r \\left|{S^{r\\theta }}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_2\\vert = r \\left|{S^{r\\theta }}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_2\\vert = r \\left|{S^{r\\theta }}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(S2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "*Remark:* SymPy was able to take a factor of $r^2$ out from under the radical as $r$ rather than $\\vert r \\vert$ because `r` was instantiated with condition `positive=True`. SymPy does not know whether basis blade coefficients $S$ and $S^{r\\theta}$ are nonnegative, so it takes their squares out from under the radical as $\\vert S \\vert$ and $\\vert S^{r\\theta} \\vert$." + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{N}= - 2 \\sqrt{6} - 3 \\cos{\\left (\\theta + \\frac{\\pi}{6} \\right )} \\boldsymbol{\\mathbf{b}}_{r} + \\frac{3 \\sin{\\left (\\theta + \\frac{\\pi}{6} \\right )}}{r} \\boldsymbol{\\mathbf{b}}_{\\theta } - \\frac{4}{r} \\boldsymbol{\\mathbf{b}}_{r}\\wedge \\boldsymbol{\\mathbf{b}}_{\\theta } \\in\\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{N}\\Vert^2 = 49 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{N}\\vert = 7 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{N}\\vert = 7 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{N}\\vert = 7 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_0 = - 2 \\sqrt{6} \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_0\\Vert^2 = 24 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{6} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{6} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{6} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_1 = - 3 \\cos{\\left (\\theta + \\frac{\\pi}{6} \\right )} \\boldsymbol{\\mathbf{b}}_{r} + \\frac{3 \\sin{\\left (\\theta + \\frac{\\pi}{6} \\right )}}{r} \\boldsymbol{\\mathbf{b}}_{\\theta } \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_1\\Vert^2 = 9 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_1\\vert = 3 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_1\\vert = 3 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_1\\vert = 3 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_2 = - \\frac{4}{r} \\boldsymbol{\\mathbf{b}}_{r}\\wedge \\boldsymbol{\\mathbf{b}}_{\\theta } \\in \\mathbb{G}(\\mathbb{E}^2)$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_2\\Vert^2 = 16 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_2\\vert = 4 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_2\\vert = 4 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_2\\vert = 4 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(N2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 6.3 Testing within `m2` \n", + "The next three In[ ] cells test `norm2` and `norm` using the `m2` multivectors `S3`, `N3`, and `A3. \n", + "- Since `m2` has a non-Euclidean metric, the value of `S3.norm(hint)` should be expected to and does depend on the `hint` given.\n", + "- Since `N3` is a location-independent numeric multivector, the value of `N3.norm(hint)` should not and does not depend on the `hint` given. Neither does it depend on location.\n", + "- `A3` has a nonnegative normsquared, discernible as such by SymPy, so it should and does trigger Case 3(a) of `norm`'s code, leading to a `A3.norm(hint)` which is `hint` independent." + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{S}= S + S^{s} \\boldsymbol{\\mathbf{e}}_{s} + S^{t} \\boldsymbol{\\mathbf{e}}_{t} + S^{st} \\boldsymbol{\\mathbf{e}}_{s}\\wedge \\boldsymbol{\\mathbf{e}}_{t} \\in\\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{S}\\Vert^2 = S^{2} + {\\left ( S^{s} \\right )}^{2} - {\\left ( S^{st} \\right )}^{2} - {\\left ( S^{t} \\right )}^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{S}\\vert = \\sqrt{\\left|{S^{2} + {\\left ( S^{s} \\right )}^{2} - {\\left ( S^{st} \\right )}^{2} - {\\left ( S^{t} \\right )}^{2}}\\right|} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{S}\\vert = \\sqrt{S^{2} + {\\left ( S^{s} \\right )}^{2} - {\\left ( S^{st} \\right )}^{2} - {\\left ( S^{t} \\right )}^{2}} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{S}\\vert = \\sqrt{- S^{2} - {\\left ( S^{s} \\right )}^{2} + {\\left ( S^{st} \\right )}^{2} + {\\left ( S^{t} \\right )}^{2}} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_0 = S \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_0\\Vert^2 = S^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_1 = S^{s} \\boldsymbol{\\mathbf{e}}_{s} + S^{t} \\boldsymbol{\\mathbf{e}}_{t} \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_1\\Vert^2 = {\\left ( S^{s} \\right )}^{2} - {\\left ( S^{t} \\right )}^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{\\left|{{\\left ( S^{s} \\right )}^{2} - {\\left ( S^{t} \\right )}^{2}}\\right|} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{{\\left ( S^{s} \\right )}^{2} - {\\left ( S^{t} \\right )}^{2}} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{- {\\left ( S^{s} \\right )}^{2} + {\\left ( S^{t} \\right )}^{2}} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_2 = S^{st} \\boldsymbol{\\mathbf{e}}_{s}\\wedge \\boldsymbol{\\mathbf{e}}_{t} \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_2\\Vert^2 = - {\\left ( S^{st} \\right )}^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_2\\vert = \\left|{S^{st}}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_2\\vert = \\left|{S^{st}}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_2\\vert = \\left|{S^{st}}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(S3)" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{N}= - 2 \\sqrt{7} + 3 \\boldsymbol{\\mathbf{e}}_{s} + 5 \\boldsymbol{\\mathbf{e}}_{t} - \\sqrt{37} \\boldsymbol{\\mathbf{e}}_{s}\\wedge \\boldsymbol{\\mathbf{e}}_{t} \\in\\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{N}\\Vert^2 = -25 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{N}\\vert = 5 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{N}\\vert = 5 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{N}\\vert = 5 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_0 = - 2 \\sqrt{7} \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_0\\Vert^2 = 28 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{7} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{7} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{7} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_1 = 3 \\boldsymbol{\\mathbf{e}}_{s} + 5 \\boldsymbol{\\mathbf{e}}_{t} \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_1\\Vert^2 = -16 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_1\\vert = 4 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_1\\vert = 4 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_1\\vert = 4 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_2 = - \\sqrt{37} \\boldsymbol{\\mathbf{e}}_{s}\\wedge \\boldsymbol{\\mathbf{e}}_{t} \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_2\\Vert^2 = -37 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_2\\vert = \\sqrt{37} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_2\\vert = \\sqrt{37} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_2\\vert = \\sqrt{37} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(N3)" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{A}= 5 + \\left ( s^{2} + t^{2}\\right ) \\boldsymbol{\\mathbf{e}}_{s} + s^{2} \\boldsymbol{\\mathbf{e}}_{t} -5 \\boldsymbol{\\mathbf{e}}_{s}\\wedge \\boldsymbol{\\mathbf{e}}_{t} \\in\\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{A}\\Vert^2 = t^{2} \\left(2 s^{2} + t^{2}\\right) $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{A}\\vert = \\sqrt{2 s^{2} + t^{2}} \\left|{t}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{A}\\vert = \\sqrt{2 s^{2} + t^{2}} \\left|{t}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{A}\\vert = \\sqrt{2 s^{2} + t^{2}} \\left|{t}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{A}\\right>_0 = 5 \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{A}\\right>_0\\Vert^2 = 25 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{A}\\right>_0\\vert = 5 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{A}\\right>_0\\vert = 5 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{A}\\right>_0\\vert = 5 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{A}\\right>_1 = \\left ( s^{2} + t^{2}\\right ) \\boldsymbol{\\mathbf{e}}_{s} + s^{2} \\boldsymbol{\\mathbf{e}}_{t} \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{A}\\right>_1\\Vert^2 = t^{2} \\left(2 s^{2} + t^{2}\\right) $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{A}\\right>_1\\vert = \\sqrt{2 s^{2} + t^{2}} \\left|{t}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{A}\\right>_1\\vert = \\sqrt{2 s^{2} + t^{2}} \\left|{t}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{A}\\right>_1\\vert = \\sqrt{2 s^{2} + t^{2}} \\left|{t}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{A}\\right>_2 = -5 \\boldsymbol{\\mathbf{e}}_{s}\\wedge \\boldsymbol{\\mathbf{e}}_{t} \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{A}\\right>_2\\Vert^2 = -25 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{A}\\right>_2\\vert = 5 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{A}\\right>_2\\vert = 5 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{A}\\right>_2\\vert = 5 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{A3.norm2() >= 0}: \\quad \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{(A3.norm2() >= 0) == 0}: \\quad \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{A3.norm2() <= 0}: \\quad t^{2} \\left(2 s^{2} + t^{2}\\right) \\leq 0 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{(A3.norm2() <= 0) == 0}: \\quad \\text{False} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{A3.norm2() < 0}: \\quad \\text{False} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{(A3.norm2() < 0) == 0}: \\quad \\text{False} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(A3)\n", + "# Is `normsquared` nonnegative? Show values of relational and \n", + "# conditional in Case 3(a) of `norm`'s code:\n", + "gprint(r'\\text{A3.norm2() >= 0}: \\quad', A3.norm2() >= 0)\n", + "gprint(r'\\text{(A3.norm2() >= 0) == 0}: \\quad',\n", + " (A3.norm2() >= 0) == True)\n", + "# Is `normsquared` nonpositive? Show values of relational and \n", + "# conditional in Case 3(b):\n", + "gprint(r'\\text{A3.norm2() <= 0}: \\quad', A3.norm2() <= 0)\n", + "gprint(r'\\text{(A3.norm2() <= 0) == 0}: \\quad',\n", + " (A3.norm2() <= 0) == True)\n", + "# Is `normsquared` negative? Show values of relational and \n", + "# conditional complementary to Case 3(a):\n", + "gprint(r'\\text{A3.norm2() < 0}: \\quad', A3.norm2() < 0)\n", + "gprint(r'\\text{(A3.norm2() < 0) == 0}: \\quad',\n", + " (A3.norm2() < 0) == True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "So as to provide a test of Case 3(a) in the execution of `norm`, the multivector `A3` from `m2` was designed to have a nonnegative `normsquared`. (The various cases are described in the notebook **Code for undualization, grade involution, Clifford conjugation, scalar product, normsquared, and norm**.) The relational `normsquared >= 0` within Case 3(a)'s conditional evaluates to `True`; hence the conditional itself, `(normsquared >= 0) == True`, also evaluates to `True`. The consequent of the `if` statement then executes, returning the `hint`-independent expression `\\sqrt(+normsquared)`.\n", + "\n", + "As an experiment as to how SymPy would handle other relationals, the above cell also showed how SymPy would evaluate the nonpositivity relational `normsquared <= 0` of Case 3(b)'s conditional. SymPy wasn't able to assign a `True` or `False` value to `normsquared <= 0`, possibly because some of the possible values of `normsquared` are positive.\n", + "\n", + "Not unexpectedly, the complementary relational `normsquared < 0` (negativity) to Case 3(a)'s `normsquared >= 0` relational returns `False` when the 3(a) relational (nonnegativity) returns `True`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 6.4 Testing within `m2_polar` \n", + "The next three In[ ] cells test `norm2` and `norm` with the multivectors `S4`, `N4`, and `B4` from `m2_polar`. \n", + "- Since `m2_polar` has a non-Euclidean metric, the value of `S4.norm(hint)` should be expected to and does depend on the `hint` given.\n", + "- Since `N4` is a location-independent numeric multivector, the value of `N43.norm(hint)` should not and does not depend on the `hint` given. Neither does it depend on location.\n", + "- Notice the results for `N4` should and do agree with those for `N3` above, which is as desired since `N3` and `N4` represent the same position-independent numeric multivector in $\\mathbb{G}(\\mathbb{M}^{1,1})$." + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{S}= S + S^{\\rho } \\boldsymbol{\\mathbf{b}}_{\\rho } + S^{\\phi } \\boldsymbol{\\mathbf{b}}_{\\phi } + S^{\\rho \\phi } \\boldsymbol{\\mathbf{b}}_{\\rho }\\wedge \\boldsymbol{\\mathbf{b}}_{\\phi } \\in\\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{S}\\Vert^2 = S^{2} - {\\left ( S^{\\phi } \\right )}^{2} \\rho ^{2} + {\\left ( S^{\\rho } \\right )}^{2} - {\\left ( S^{\\rho \\phi } \\right )}^{2} \\rho ^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{S}\\vert = \\sqrt{\\left|{S^{2} - {\\left ( S^{\\phi } \\right )}^{2} \\rho ^{2} + {\\left ( S^{\\rho } \\right )}^{2} - {\\left ( S^{\\rho \\phi } \\right )}^{2} \\rho ^{2}}\\right|} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{S}\\vert = \\sqrt{S^{2} - {\\left ( S^{\\phi } \\right )}^{2} \\rho ^{2} + {\\left ( S^{\\rho } \\right )}^{2} - {\\left ( S^{\\rho \\phi } \\right )}^{2} \\rho ^{2}} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{S}\\vert = \\sqrt{- S^{2} + {\\left ( S^{\\phi } \\right )}^{2} \\rho ^{2} - {\\left ( S^{\\rho } \\right )}^{2} + {\\left ( S^{\\rho \\phi } \\right )}^{2} \\rho ^{2}} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_0 = S \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_0\\Vert^2 = S^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_0\\vert = \\left|{S}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_1 = S^{\\rho } \\boldsymbol{\\mathbf{b}}_{\\rho } + S^{\\phi } \\boldsymbol{\\mathbf{b}}_{\\phi } \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_1\\Vert^2 = - {\\left ( S^{\\phi } \\right )}^{2} \\rho ^{2} + {\\left ( S^{\\rho } \\right )}^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{\\left|{{\\left ( S^{\\phi } \\right )}^{2} \\rho ^{2} - {\\left ( S^{\\rho } \\right )}^{2}}\\right|} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{- {\\left ( S^{\\phi } \\right )}^{2} \\rho ^{2} + {\\left ( S^{\\rho } \\right )}^{2}} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_1\\vert = \\sqrt{{\\left ( S^{\\phi } \\right )}^{2} \\rho ^{2} - {\\left ( S^{\\rho } \\right )}^{2}} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{S}\\right>_2 = S^{\\rho \\phi } \\boldsymbol{\\mathbf{b}}_{\\rho }\\wedge \\boldsymbol{\\mathbf{b}}_{\\phi } \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{S}\\right>_2\\Vert^2 = - {\\left ( S^{\\rho \\phi } \\right )}^{2} \\rho ^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{S}\\right>_2\\vert = \\rho \\left|{S^{\\rho \\phi }}\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_2\\vert = \\rho \\left|{S^{\\rho \\phi }}\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{S}\\right>_2\\vert = \\rho \\left|{S^{\\rho \\phi }}\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(S4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "*Remark:* SymPy was able to take a factor of $\\rho^2$ out from under the radical as $\\rho$ rather than $\\vert \\rho \\vert$ because `rho` was instantiated with condition `positive=True`. SymPy does not know whether basis blade coefficients $S$ and $S^{\\rho\\phi}$ are nonnegative, so it takes their squares out from under the radical as $\\vert S \\vert$ and $\\vert S^{\\rho\\phi} \\vert$." + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{N}= - 2 \\sqrt{7} + \\left ( - e^{\\phi } + 4 e^{- \\phi }\\right ) \\boldsymbol{\\mathbf{b}}_{\\rho } + \\frac{e^{\\phi } + 4 e^{- \\phi }}{\\rho } \\boldsymbol{\\mathbf{b}}_{\\phi } - \\frac{\\sqrt{37}}{\\rho } \\boldsymbol{\\mathbf{b}}_{\\rho }\\wedge \\boldsymbol{\\mathbf{b}}_{\\phi } \\in\\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{N}\\Vert^2 = -25 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{N}\\vert = 5 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{N}\\vert = 5 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{N}\\vert = 5 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_0 = - 2 \\sqrt{7} \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_0\\Vert^2 = 28 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{7} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{7} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_0\\vert = 2 \\sqrt{7} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_1 = \\left ( - e^{\\phi } + 4 e^{- \\phi }\\right ) \\boldsymbol{\\mathbf{b}}_{\\rho } + \\frac{e^{\\phi } + 4 e^{- \\phi }}{\\rho } \\boldsymbol{\\mathbf{b}}_{\\phi } \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_1\\Vert^2 = -16 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_1\\vert = 4 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_1\\vert = 4 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_1\\vert = 4 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{N}\\right>_2 = - \\frac{\\sqrt{37}}{\\rho } \\boldsymbol{\\mathbf{b}}_{\\rho }\\wedge \\boldsymbol{\\mathbf{b}}_{\\phi } \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{N}\\right>_2\\Vert^2 = -37 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{N}\\right>_2\\vert = \\sqrt{37} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_2\\vert = \\sqrt{37} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{N}\\right>_2\\vert = \\sqrt{37} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(N4)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "text/latex": [ + "$\\displaystyle \\mathbf{B}= \\rho ^{2} -16 \\boldsymbol{\\mathbf{b}}_{\\rho } + \\frac{16}{\\rho } \\boldsymbol{\\mathbf{b}}_{\\phi } - \\sqrt{\\phi ^{2} + \\rho ^{2}} \\boldsymbol{\\mathbf{b}}_{\\rho }\\wedge \\boldsymbol{\\mathbf{b}}_{\\phi } \\in\\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\mathbf{B}\\Vert^2 = - \\phi ^{2} \\rho ^{2} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\mathbf{B}\\vert = \\rho \\left|{\\phi }\\right| \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{B}\\vert = \\rho \\left|{\\phi }\\right| \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\mathbf{B}\\vert = \\rho \\left|{\\phi }\\right| \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{B}\\right>_0 = \\rho ^{2} \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{B}\\right>_0\\Vert^2 = \\rho ^{4} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{B}\\right>_0\\vert = \\rho ^{2} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{B}\\right>_0\\vert = \\rho ^{2} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{B}\\right>_0\\vert = \\rho ^{2} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{B}\\right>_1 = -16 \\boldsymbol{\\mathbf{b}}_{\\rho } + \\frac{16}{\\rho } \\boldsymbol{\\mathbf{b}}_{\\phi } \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{B}\\right>_1\\Vert^2 = 0 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{B}\\right>_1\\vert = 0 \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{B}\\right>_1\\vert = 0 \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{B}\\right>_1\\vert = 0 \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\left<\\mathbf{B}\\right>_2 = - \\sqrt{\\phi ^{2} + \\rho ^{2}} \\boldsymbol{\\mathbf{b}}_{\\rho }\\wedge \\boldsymbol{\\mathbf{b}}_{\\phi } \\in \\mathbb{G}(\\mathbb{M}^{1,1})$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\Vert\\left<\\mathbf{B}\\right>_2\\Vert^2 = - \\rho ^{2} \\left(\\phi ^{2} + \\rho ^{2}\\right) $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\implies \\vert\\left<\\mathbf{B}\\right>_2\\vert = \\rho \\sqrt{\\phi ^{2} + \\rho ^{2}} \\quad \\text{ when hint is '0'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{B}\\right>_2\\vert = \\rho \\sqrt{\\phi ^{2} + \\rho ^{2}} \\quad \\text{ when hint is '+'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\qquad \\qquad\\; \\vert\\left<\\mathbf{B}\\right>_2\\vert = \\rho \\sqrt{\\phi ^{2} + \\rho ^{2}} \\quad \\text{ when hint is '-'}$" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{B4.norm2() >= 0}: \\quad - \\phi ^{2} \\rho ^{2} \\geq 0 $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{(B4.norm2() >= 0) == 0}: \\quad \\text{False} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{B4.norm2() <= 0}: \\quad \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{(B4.norm2() <= 0) == 0}: \\quad \\text{True} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{B4.norm2() > 0}: \\quad \\text{False} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/latex": [ + "$\\displaystyle \\text{(B4.norm2() > 0) == 0}: \\quad \\text{False} $" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "test_with(B4)\n", + "# Is `normsquared` nonnegative? Show values of relational and \n", + "# conditional in Case 3(a) of `norm`'s code:\n", + "gprint(r'\\text{B4.norm2() >= 0}: \\quad', B4.norm2() >= 0)\n", + "gprint(r'\\text{(B4.norm2() >= 0) == 0}: \\quad',\n", + " (B4.norm2() >= 0) == True)\n", + "# Is `normsquared` nonpositive? Show values of relational and \n", + "# conditional in Case 3(b):\n", + "gprint(r'\\text{B4.norm2() <= 0}: \\quad', B4.norm2() <= 0)\n", + "gprint(r'\\text{(B4.norm2() <= 0) == 0}: \\quad',\n", + " (B4.norm2() <= 0) == True)\n", + "# Is `normsquared` positive? Show values of relational and \n", + "# conditional complementary to Case 3(b):\n", + "gprint(r'\\text{B4.norm2() > 0}: \\quad', B4.norm2() > 0)\n", + "gprint(r'\\text{(B4.norm2() > 0) == 0}: \\quad',\n", + " (B4.norm2() > 0) == True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "So as to provide a test of Case 3(b) in the execution of `norm`, the multivector `B4` from `m2_polar` was designed to have a nonpositive `normsquared`. (The various cases are described in the notebook **Code for undualization, grade involution, Clifford conjugation, scalar product, normsquared, and norm**.) The relational `normsquared <= 0` within Case 3(b)'s conditional evaluates to `True`; hence the conditional itself, `(normsquared <= 0) == True`, also evaluates to `True`. The consequent of the `if` statement then executes, returning the `hint`-independent expression `\\sqrt(-normsquared)`.\n", + "\n", + "As an experiment as to how SymPy would handle other relationals, the above cell also showed how SymPy would evaluate the nonnegativity relational `normsquared >= 0` of Case 3(a)'s conditional. SymPy wasn't able to assign a `True` or `False` value to `normsquared >= 0`, possibly because some of the possible values of `normsquared` are negative.\n", + "\n", + "Not unexpectedly, the complementary relational `normsquared > 0` (positivity) to Case 3(b)'s `normsquared <= 0` relational returns `False` when the 3(b) relational (nonnegativity) returns `True`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 6.5. Conclusions from testing the recoded old operations\n", + "\n", + "The output from each of the executable In[ ] cells of subsections 6.1, 6.2, 6.3, and 6.4 was precisely as was desired and expected. I am confident of the implementation of `norm2`. But while the tests of `norm` gave correct results, I still suspect weaknesses in that method, weaknesses that were explicated at the end of Section 6 of the notebook **Code for undualization, grade involution, Clifford conjugation, scalar product, normsquared, and norm**. Further testing, with more complex geometric algebras and multivectors therefrom, is needed." + ] + } + ], + "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.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}