{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "%run ./Web-CongruenceOfNormalLinesToTriangularSurfaces(1).ipynb" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(u, v)\n", "Homogeneous parametrization\n", "[w^2, -0.267401245151827*u^2 - 0.746885618998610*u*v - 0.609296116652131*v^2 + 0.750045371458435*u*w + 0.0888474128531533*v*w + 0.821928297671713*w^2, -0.963095133716788*u^2 + 0.531288979750148*u*v - 0.743832422906394*v^2 + 0.772593543442066*u*w + 0.874712704439343*v*w - 0.577124646383663*w^2, 0.0577196078872979*u^2 + 0.619198131104453*u*v + 0.690171642272860*v^2 - 0.169179617655805*u*w - 0.400026487942551*v*w - 0.412686181562397*w^2] \n", "\n", "random element: 0.766263374716805\n", "degree of the given non homogeneous parameterization : 2 \n", "\n", "Homogeneous normal vectors :\n", "[-2.50804999383700*u^2 - 4.97413787454641*u*v + 3.30904093517668*v^2 + 2.47564544764718*u*w + 0.121223206129704*v*w - 0.322148641788994*w^2, 0.489857624751015*u^2 + 1.19507538857464*u*v + 0.552817030136210*v^2 - 1.08349511014307*u*w - 2.14583800511835*v*w + 0.570013688811760*w^2, -3.44555695928499*u^2 - 3.10326727096587*u*v + 3.51708020718206*v^2 + 1.35773667277304*u*w - 1.74970726274622*v*w + 1.17486255559748*w^2] \n", "\n", "Homogeneous parameterization of normal lines :\n", "[w^2*mu, -2.50804999383700*u^2*la - 4.97413787454641*u*v*la + 3.30904093517668*v^2*la + 2.47564544764718*u*w*la + 0.121223206129704*v*w*la - 0.322148641788994*w^2*la - 0.267401245151827*u^2*mu - 0.746885618998610*u*v*mu - 0.609296116652131*v^2*mu + 0.750045371458435*u*w*mu + 0.0888474128531533*v*w*mu + 0.821928297671713*w^2*mu, 0.489857624751015*u^2*la + 1.19507538857464*u*v*la + 0.552817030136210*v^2*la - 1.08349511014307*u*w*la - 2.14583800511835*v*w*la + 0.570013688811760*w^2*la - 0.963095133716788*u^2*mu + 0.531288979750148*u*v*mu - 0.743832422906394*v^2*mu + 0.772593543442066*u*w*mu + 0.874712704439343*v*w*mu - 0.577124646383663*w^2*mu, -3.44555695928499*u^2*la - 3.10326727096587*u*v*la + 3.51708020718206*v^2*la + 1.35773667277304*u*w*la - 1.74970726274622*v*w*la + 1.17486255559748*w^2*la + 0.0577196078872979*u^2*mu + 0.619198131104453*u*v*mu + 0.690171642272860*v^2*mu - 0.169179617655805*u*w*mu - 0.400026487942551*v*w*mu - 0.412686181562397*w^2*mu] \n", "\n", "Degree of Psi is : 2 \n", "\n", "Regularity is : 4 \n", "\n", "Snu is of size: 56 60\n", "SNu is of rank: 53\n", "Kernel of SNu is of size : 60 7\n", "Size of M-rep is: 15 7\n", "Time to compute the kernel of Snu is : 0:00:00.002043\n", "Time to compute the Mrep, without computing the kernel of Snu is : 0:00:00.000245\n", "TotalComputationTime is: 0:00:00.002288\n", "Size of M-rep is: 15 7\n", "Rank/CoRank of Mrep is at a randomly choosen point is : 6 9\n" ] }, { "ename": "NameError", "evalue": "name 'kk' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mrankMrep\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mcoRankMrep\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrankCorankViaNorm2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmrep\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[0mcoord\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minversion\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmrep\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mNu\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mrankMrep\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mwriteDetails\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 42\u001b[0;31m \u001b[0mkk\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPlot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcoord\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mcoord\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mcoord\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 43\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0;34m\"Inversion computation time:\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mcoord\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\"\\n\"\u001b[0m\u001b[0;34m;\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mNameError\u001b[0m: name 'kk' is not defined" ] } ], "source": [ "import sympy \n", "import numpy\n", "import numpy as np\n", "from scipy import linalg\n", "from scipy.linalg import eig\n", "\n", "from sage.rings.polynomial.polydict import PolyDict\n", "from time import gmtime,strftime,time\n", "from datetime import datetime, date, time,timedelta\n", "\n", "\n", "#k=Zmod(11);\n", "#k = IntegerModRing(11, is_field=True); #this makes field.\n", "#k=QQ;\n", "field=RR;\n", "R.= field['u','v'];\n", "print R.gens();\n", "k=SurfP2P1(2,[],\"nonrational\",field);\n", "\n", "Fi=k.HomogeneousParametrization()\n", "print \"Homogeneous parametrization\\n\", Fi,\"\\n\";\n", "print \"random element:\",k.randomElement();\n", "Deg=k.uvDegree();\n", "print \"degree of the given non homogeneous parameterization :\",Deg,\"\\n\";\n", "J=k.NormalVectorsViaJacobian(Fi);\n", "print \"Homogeneous normal vectors :\\n\",J,\"\\n\";\n", "Psi=k.HomogeneousCongruenceOfNormalLines(False,\"jacobian\");\n", "print \"Homogeneous parameterization of normal lines :\\n\",Psi,\"\\n\";\n", "degreePsi=k.uvwDegree(Psi);\n", "print \"Degree of Psi is :\",degreePsi,\"\\n\";\n", "Nu=k.regularity(Deg);\n", "print \"Regularity is :\",Nu,\"\\n\";\n", "\n", "#intermediary matrices, of which nullspace is the matrix representation of normal lines to the surface\n", "snu=k.SNu(Nu,degreePsi,False,\"jacobian\");\n", "print \"Snu is of size:\",snu.nrows(),snu.ncols();\n", "(mrepG,time1)=k.foncMrepG(snu,True);\n", "mrep=k.foncMrepEval(mrepG,True);\n", "#print \"matrix representation of normal lines to the surface is :\\n\",mrep[1],\\n at a random point;\n", "(rankMrep,coRankMrep)=k.rankCorankViaNorm2(mrep[0]);\n", "coord=k.inversion(mrep,Nu,rankMrep,writeDetails=False);\n", "kk.Plot(coord[0],coord[1],coord[4]);\n", "print \"Inversion computation time:\",coord[10],\"\\n\";" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SageMath 8.6", "language": "", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.15" } }, "nbformat": 4, "nbformat_minor": 2 }