{ "cells": [ { "cell_type": "markdown", "id": "ongoing-billy", "metadata": {}, "source": [ "# Computing the fiber body of a zonotope" ] }, { "cell_type": "code", "execution_count": 1, "id": "beautiful-girlfriend", "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " ----- ----- ----- - ----- \n", "| | | | | | | | | | \n", "| | | | | | | | \n", "| | ----- | | | |----- \n", "| | | | |-----| | | \n", "| | | | | | | | | | \n", " ----- ----- ----- - - - - \n", "\n", "...combining (and extending) ANTIC, GAP, Polymake and Singular\n", "Version\u001b[32m 0.8.2-DEV \u001b[39m... \n", " ... which comes with absolutely no warranty whatsoever\n", "Type: '?Oscar' for more information\n", "(c) 2019-2022 by The Oscar Development Team\n" ] } ], "source": [ "using Oscar\n", "using IterTools\n", "using LinearAlgebra" ] }, { "cell_type": "markdown", "id": "consistent-officer", "metadata": {}, "source": [ "Given a list $L = \\{z_1,\\ldots ,z_s\\}$ of points in $\\mathbb{R}^N$, we can associate to it a zonotope, namely\n", "$$\n", "Z = \\sum_{i = 1}^s [-z_i, z_i]\n", "$$\n", "where $[-z_i, z_i]$ is the segment between $-z_i$ and $z_i$." ] }, { "cell_type": "code", "execution_count": 2, "id": "caring-aerospace", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "zonotope (generic function with 1 method)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# the following function computes the zonotope sum_i([-L[i],L[i]])\n", "\n", "function zonotope(L)\n", " \"\"\"\n", " Input: list L\n", " Output: zonotope associated to L\n", " \"\"\"\n", " sum(convex_hull([-ℓ; ℓ]) for ℓ in L)\n", "end" ] }, { "cell_type": "code", "execution_count": 3, "id": "independent-phenomenon", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "A polyhedron in ambient dimension 4" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# for example: \n", "\n", "L1 = [[1 0 1], [1 1 0], [1 -1 0]]\n", "L2 = [[1 2 -3 1],[1 0 -1 0],[0 2 2 -1],[3 -2 1 2],[0 0 0 1],[1 1 1 1]]\n", "\n", "Z1 = zonotope(L1)\n", "Z2 = zonotope(L2)" ] }, { "cell_type": "code", "execution_count": 4, "id": "acting-tactics", "metadata": { "scrolled": false }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\tunnamed\n", "\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\t4\n", "\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\t0\n", "\t\t\n", "\t\t1\n", "\t\t\n", "\t\t2\n", "\t\t\n", "\t\t3\n", "\t\t\n", "\t\t5\n", "\t\t\n", "\t\t6\n", "\t\t\n", "\t\t7\n", "\t\n", "\t\n", "" ], "text/html": [ "\n", "\n", "\n", "\n", " \n", " \n", " unnamed\n", " \n", " \n", "\n", "
\n", "\t\t
\n", "\t\t\t
\n", "\t\t\t\tTransparency\n", "\t\t\t\t\n", "\t\t\t
\n", "\t\t\t\n", "\t\t\t
\n", "\t\t\t\tRotation\n", "\t\t\t\t
\n", "\t\t\t\t\t
x-axis
\n", "\t\t\t\t\t
y-axis
\n", "\t\t\t\t\t
z-axis
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\n", "\t\t\t\t
Rotation speed
\n", "\t\t\t\t\n", "\t\t\t
\n", "\n", "\n", "\t\t\t
\n", "\t\t\t\tDisplay\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t\t
Objects
\n", "\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t
\n", " \n", "
\n", " Camera\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "\n", "\t\t\t
\n", "\t\t\t\tSVG\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\t Download
\n", "\t\t\t\t\t\t New tab
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\t\t\t
\n", "\n", "\t\t
\t\n", "\t\t\n", "\t\t\n", "
\n", "
\n", " \n", " \n", "\n" ], "text/plain": [] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "visualize(Z1)" ] }, { "cell_type": "code", "execution_count": 5, "id": "collectible-kidney", "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\tSchlegel diagram of on facet 0\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t\n", "\t0\n", "\t\n", "\t1\n", "\t\n", "\t2\n", "\t\n", "\t3\n", "\t\n", "\t4\n", "\t\n", "\t5\n", "\t\n", "\t6\n", "\t\n", "\t7\n", "\t\n", "\t8\n", "\t\n", "\t9\n", "\t\n", "\t10\n", "\t\n", "\t11\n", "\t\n", "\t12\n", "\t\n", "\t13\n", "\t\n", "\t14\n", "\t\n", "\t15\n", "\t\n", "\t16\n", "\t\n", "\t17\n", "\t\n", "\t18\n", "\t\n", "\t19\n", "\t\n", "\t20\n", "\t\n", "\t21\n", "\t\n", "\t22\n", "\t\n", "\t23\n", "\t\n", "\t24\n", "\t\n", "\t25\n", "\t\n", "\t26\n", "\t\n", "\t27\n", "\t\n", "\t28\n", "\t\n", "\t29\n", "\t\n", "\t30\n", "\t\n", "\t31\n", "\t\n", "\t32\n", "\t\n", "\t33\n", "\t\n", "\t34\n", "\t\n", "\t35\n", "\t\n", "\t36\n", "\t\n", "\t37\n", "\t\n", "\t38\n", "\t\n", "\t39\n", "\t\n", "\t40\n", "\t\n", "\t41\n", "\t\n", "\t42\n", "\t\n", "\t43\n", "\t\n", "\t44\n", "\t\n", "\t45\n", "\t\n", "\t46\n", "\t\n", "\t47\n", "\t\n", "\t48\n", "\t\n", "\t49\n", "\t\n", "\t50\n", "\t\n", "\t51\n", "\t\n", "" ], "text/html": [ "\n", "\n", "\n", "\n", " \n", " \n", " Schlegel diagram of on facet 0\n", " \n", " \n", "\n", "
\n", "\t\t
\n", "\t\t\t
\n", "\t\t\t\tTransparency\n", "\t\t\t\t\n", "\t\t\t
\n", "\t\t\t\n", "\t\t\t
\n", "\t\t\t\tRotation\n", "\t\t\t\t
\n", "\t\t\t\t\t
x-axis
\n", "\t\t\t\t\t
y-axis
\n", "\t\t\t\t\t
z-axis
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\n", "\t\t\t\t
Rotation speed
\n", "\t\t\t\t\n", "\t\t\t
\n", "\n", "\n", "\t\t\t
\n", "\t\t\t\tDisplay\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t\t
Objects
\n", "\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t
\n", " \n", "
\n", " Camera\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "\n", "\t\t\t
\n", "\t\t\t\tSVG\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\t Download
\n", "\t\t\t\t\t\t New tab
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\t\t\t
\n", "\n", "\t\t
\t\n", "\t\t\n", "\t\t\n", "
\n", "
\n", " \n", " \n", "\n" ], "text/plain": [] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "visualize(Z2) # gives the Schlegel diagram of this four dimensional polytope" ] }, { "cell_type": "markdown", "id": "handled-character", "metadata": {}, "source": [ "The fiber body of the zonotope $Z$ with respect to the projection $\\pi : \\mathbb{R}^N\\to \\mathbb{R}^n$ onto the first $n$ coordinates is the Minkowski sum\n", "$$\n", "(n+1)!\\sum_{1\\leq i_1<\\cdots\n", "\n", "\n", "\tunnamed\n", "\t\n", "\t\n", "\t0\n", "\t\n", "\t1\n", "\t\n", "\t2\n", "\t\n", "\t3\n", "\t\n", "\t4\n", "\t\n", "\t5\n", "\t\n", "" ], "text/html": [ "\n", "\n", "\n", "\n", " \n", " \n", " unnamed\n", " \n", " \n", "\n", "
\n", "\t\t
\n", "\t\t\t
\n", "\t\t\t\tTransparency\n", "\t\t\t\t\n", "\t\t\t
\n", "\t\t\t\n", "\t\t\t
\n", "\t\t\t\tRotation\n", "\t\t\t\t
\n", "\t\t\t\t\t
x-axis
\n", "\t\t\t\t\t
y-axis
\n", "\t\t\t\t\t
z-axis
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\n", "\t\t\t\t
Rotation speed
\n", "\t\t\t\t\n", "\t\t\t
\n", "\n", "\n", "\t\t\t
\n", "\t\t\t\tDisplay\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t\t
Objects
\n", "\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t
\n", " \n", "
\n", " Camera\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "\n", "\t\t\t
\n", "\t\t\t\tSVG\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\t Download
\n", "\t\t\t\t\t\t New tab
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\t\t\t
\n", "\n", "\t\t
\t\n", "\t\t\n", "\t\t\n", "
\n", "
\n", " \n", " \n", "\n" ], "text/plain": [] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "visualize(zonotope(ΣZ1))" ] }, { "cell_type": "code", "execution_count": 9, "id": "civic-contrast", "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\tunnamed\n", "\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\t4\n", "\t\t\n", "\t\t5\n", "\t\t\n", "\t\t6\n", "\t\t\n", "\t\t7\n", "\t\t\n", "\t\t8\n", "\t\t\n", "\t\t9\n", "\t\t\n", "\t\t10\n", "\t\t\n", "\t\t11\n", "\t\t\n", "\t\t12\n", "\t\t\n", "\t\t20\n", "\t\t\n", "\t\t36\n", "\t\n", "\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\t\n", "\t\n", "\t\n", "\t\t\n", "\t\t0\n", "\t\t\n", "\t\t1\n", "\t\t\n", "\t\t2\n", "\t\t\n", "\t\t3\n", "\t\t\n", "\t\t13\n", "\t\t\n", "\t\t14\n", "\t\t\n", "\t\t15\n", "\t\t\n", "\t\t16\n", "\t\t\n", "\t\t17\n", "\t\t\n", "\t\t18\n", "\t\t\n", "\t\t19\n", "\t\t\n", "\t\t21\n", "\t\t\n", "\t\t22\n", "\t\t\n", "\t\t23\n", "\t\t\n", "\t\t24\n", "\t\t\n", "\t\t25\n", "\t\t\n", "\t\t26\n", "\t\t\n", "\t\t27\n", "\t\t\n", "\t\t28\n", "\t\t\n", "\t\t29\n", "\t\t\n", "\t\t30\n", "\t\t\n", "\t\t31\n", "\t\t\n", "\t\t32\n", "\t\t\n", "\t\t33\n", "\t\t\n", "\t\t34\n", "\t\t\n", "\t\t35\n", "\t\t\n", "\t\t37\n", "\t\t\n", "\t\t38\n", "\t\t\n", "\t\t39\n", "\t\t\n", "\t\t40\n", "\t\t\n", "\t\t41\n", "\t\t\n", "\t\t42\n", "\t\t\n", "\t\t43\n", "\t\t\n", "\t\t44\n", "\t\t\n", "\t\t45\n", "\t\t\n", "\t\t46\n", "\t\t\n", "\t\t47\n", "\t\t\n", "\t\t48\n", "\t\t\n", "\t\t49\n", "\t\n", "\t\n", "" ], "text/html": [ "\n", "\n", "\n", "\n", " \n", " \n", " unnamed\n", " \n", " \n", "\n", "
\n", "\t\t
\n", "\t\t\t
\n", "\t\t\t\tTransparency\n", "\t\t\t\t\n", "\t\t\t
\n", "\t\t\t\n", "\t\t\t
\n", "\t\t\t\tRotation\n", "\t\t\t\t
\n", "\t\t\t\t\t
x-axis
\n", "\t\t\t\t\t
y-axis
\n", "\t\t\t\t\t
z-axis
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\n", "\t\t\t\t
Rotation speed
\n", "\t\t\t\t\n", "\t\t\t
\n", "\n", "\n", "\t\t\t
\n", "\t\t\t\tDisplay\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t\t
Objects
\n", "\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t\t
\n", "\t\t\t
\n", " \n", "
\n", " Camera\n", "
\n", "
\n", " \n", "
\n", "
\n", "
\n", "\n", "\t\t\t
\n", "\t\t\t\tSVG\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\t Download
\n", "\t\t\t\t\t\t New tab
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\t\t\t
\n", "\n", "\t\t
\t\n", "\t\t\n", "\t\t\n", "
\n", "
\n", " \n", " \n", "\n" ], "text/plain": [] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "visualize(zonotope(ΣZ2))" ] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.7.1", "language": "julia", "name": "julia-1.7" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.7.1" } }, "nbformat": 4, "nbformat_minor": 5 }