{ "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", "" ], "text/html": [ "\n", "\n", "\n", "\n", "
\n", " \n", "