Packaging Python code and Sphinx
|
|
- Claud Brown
- 6 years ago
- Views:
Transcription
1 Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for phcpy 4 Interface Design PHCpack as a state machine MCS 507 Lecture 18 Mathematical, Statistical and Scientific Software Jan Verschelde, 7 October 2013 Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
2 Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for phcpy 4 Interface Design PHCpack as a state machine Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
3 extending Python with your own package A package is a directory containing an init.py file; and also modules or other packages. The code in a Python package can be a pure Python module, defined in a single.py file; or a shared object.so file with compiled C code. The directory site-packages contains installed packages, such as numpy, scipy, sympy, etc. On Mac OS X, the directory site-packages can be found in the subdirectory lib/python2.7/site-packages of /Library/Frameworks/Python.framework/Versions/2.7/. On Red Hat Linux: /usr/lib/python2.6/site-packages. The Hitchiker s Guide to Packaging 1.0 documentation is at Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
4 preparing a package for distribution Distutils is a standard and basic package in the Python standard library, used for creating distributions, imported in the setup.py file. Following the Hitchhiker s Guide to Packaging: 1 Define the directory structure: Make a directory with LICENSE.txt, MANIFEST.in, README.txt, setup.py. The name for this directory could be the package name, followed by the version number, e.g.: ourfirstpackage In this directory is a subdirectory with the package name. The directory with the package name contains the init.py and the module with the code. 2 python setup.py sdist makes a file MANIFEST and a directory dist with a gzipped tar file. 3 As superuser we install with python setup.py install. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
5 Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for phcpy 4 Interface Design PHCpack as a state machine Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
6 making ourfirstpackage We use ourfirstmodule.py of Lecture 7. 1 New directory: mkdir ourfirstpackage In ourfirstpackage-0.0.1, do mkdir ourfirstpackage and copy ourfirstmodule.py into ourfirstpackage. 3 As LICENSE.txt, we copy the text of GNU GPL version 3. 4 The content of README.txt (start documenting in rest): =========================== Welcome to ourfirstpackage! =========================== It contains ourfirstmodule of lecture 7 of MCS 507. ourfirstmodule This module exports x**2*cos(y) + 4*exp(z)*sin(x). Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
7 the file MANIFEST and init.py The contents of the file MANIFEST: include *.txt So all.txt files are included in the distribution. The contents of the file init.py: """ ourfirstpackage =============== Exports the function x**2*cos(y) + 4*exp(z)*sin(x) in the module ourfirstmodule. """ # Definition of the version number version = Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
8 the file setup.py from distutils.core import setup from distutils.sysconfig import get_python_lib setup( name = ourfirstpackage, author = MCS 507, author_ = jan@math.uic.edu, description = our first package, url = version = 0.0.1, packages = [ ourfirstpackage ], py_modules = [ ourfirstpackage/ourfirstmodule ], license = GNU GENERAL PUBLIC LICENSE version 3, platforms = [ linux2 ], long_description=open( README.txt ).read() ) Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
9 preparing the distribution $ python setup.py sdist running sdist running check reading manifest template MANIFEST.in writing manifest file MANIFEST creating ourfirstpackage creating ourfirstpackage-0.0.1/ourfirstpackage making hard links in ourfirstpackage hard linking LICENSE.txt -> ourfirstpackage hard linking README.txt -> ourfirstpackage hard linking setup.py -> ourfirstpackage hard linking ourfirstpackage/ init.py -> ourfirstpackage hard linking ourfirstpackage/ourfirstmodule.py -> ourfirstp creating dist Creating tar archive removing ourfirstpackage (and everything under it) $ ls dist ourfirstpackage tar.gz $ Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
10 installing the package $ sudo python setup.py install running install running build running build_py creating build creating build/lib creating build/lib/ourfirstpackage copying ourfirstpackage/ourfirstmodule.py -> build/lib/\ ourfirstpackage copying ourfirstpackage/ init.py -> build/lib/\ ourfirstpackage running install_lib running install_egg_info Removing /Library/Frameworks/Python.framework/Versions/\ 2.7/lib/python2.7/site-packages/ourfirstpackage py2.7 Writing /Library/Frameworks/Python.framework/Versions/2.7/\ lib/python2.7/site-packages/\ ourfirstpackage py2.7.egg-info $ Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
11 using ourfirstpackage $ python Python (v2.7.3:70274d53c1dd, Apr , 20:52:43) [GCC (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more i >>> import ourfirstpackage >>> help(ourfirstpackage) >>> from ourfirstpackage import ourfirstmodule >>> help(ourfirstmodule) >>> from ourfirstpackage.ourfirstmodule import main >>> main() v = x**2*cos(y) + 4*exp(z)*sin(x) give x : 1 give y : 2 give z : 3 v = >>> Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
12 help on ourfirstpackage Help on package ourfirstpackage: NAME ourfirstpackage FILE /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-pa DESCRIPTION ourfirstpackage =============== Exports the function x**2*cos(y) + 4*exp(z)*sin(x) in the module ourfirstmodule. PACKAGE CONTENTS ourfirstmodule DATA version = VERSION Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
13 Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for phcpy 4 Interface Design PHCpack as a state machine Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
14 PHCpack PHCpack is a software package to solve polynomial systems with polyhedral and numerical methods. PHCpack consists of 1 open source code in Ada with interfaces to C and Python, compiles with gcc, available as a software package; 2 an executable program phc for various platforms with interfaces for Maple, MATLAB (Octave), Macaulay 2, and Sage (PHCpack is one of the optional packages). ACM TOMS archived version 1.0 of PHCpack as Algorithm 795. The current version is , available at: jan/download.html and at Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
15 symbolic-numeric view on polynomial homotopies Our goal is to solve a polynomial system f(x) = 0. A polynomial homotopy continuation method consists in two parts: 1 definition of a family of systems, a homotopy, e.g.: h(x, t) = (1 t) g(x) + t f(x) = 0, t [0, 1], where g(x) = 0 is a generic system with known solutions; 2 path tracking or continuation methods using predictor-corrector to approximate solution paths x(t) defined by h(x(t), t) = 0. A homotopy is optimal if no paths diverge. We have optimal homotopies for several classes of systems, e.g.: polyhedral homotopies for sparse systems with fixed supports. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
16 software integrated in PHCpack To compute mixed volumes fast: T. Gao, T.Y. Li, and M. Wu: Algorithm 846: MixedVol: A software package for mixed volume computation. ACM Trans. Math. Softw. 31(4): , For fast extended multiprecision arithmetic: Y. Hida, X.S. Li, and D.H. Bailey: Algorithms for quad-double precision floating point arithmetic. In 15th IEEE Symposium on Computer Arithmetic pages IEEE, Software at dhbailey/mpdist/qd tar.gz. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
17 Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for phcpy 4 Interface Design PHCpack as a state machine Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
18 Newton polytopes The support A of a polynomial f is a finite set of exponent vectors which models the sparse structure of f : f(x) = a A c a x a, c a C, x a = x a 1 1 x a 2 2 x an n. The convex hull of A is the Newton polytope of f, denoted by Q = conv(a). Mostly we work in the plane (n = 2) and stick to polygons. Today we consider systems f(x) = 0 where the equations all share the same support A, or the same Newton polytope Q. For generic choices of the coefficients, the monomials whose exponent vector is not a vertex do not have an influence on the volume of Q and may be omitted. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
19 regular triangulations With a triangulation, we compute the volume: vol(q) = S vol(s) S = conv(c), #C = n + 1. The cells C in a triangulation span simplices S. For Newton polytopes, the unit simplex has volume 1. Our triangulations are induced by a lifting function ω: ω : Z n Z : a ω(a), which embeds the support A into Z n+1, Â = ω(a). Accordingly: Q = conv(â). A triangulation is regular if there is a lifting function so there is a 1-to-1 mapping of the facets of the lower hull of the lifted point configuration and the simplices in the triangulation. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
20 polyhedral homotopy To construct the homotopy that starts at system supported at the other cell of the triangulation, we look at the inner normal of the lifted cell, i.e.: v = ( 1, 1,+1). This inner normal defines the change of coordinates x 1 = y 1 t 1 and x 2 = y 2 t 1. After multiplication by t, this change of coordinates yields { c1,11 y ĝ(y, t) = 1 y 2 t 0 + c 1,10 y 1 t 0 + c 1,01 y 2 t 0 + c 1,00 t 1 = 0 c 2,11 y 1 y 2 t 0 + c 2,10 y 1 t 0 + c 2,01 y 2 t 0 + c 2,00 t 1 = 0. At ĝ(y, t = 0) = 0 there is another solution which contributes one path. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
21 Kushnirenko s theorem Theorem (Kushnirenko (1976)) Consider the system f(x) = 0 and let A be the support of every polynomial in f. Then the number of isolated solutions of f(x) = 0 in (C ) n cannot exceed the volume of the polytope spanned by A. Polyhedral homotopies provide a constructive proof: 1 Any regular triangulation defines a polyhedral homotopy with exactly as many paths as the volume. 2 There are no more solutions than the volume of the Newton polytope, following a refined concept of. Kushnirenko s theorem was generalized by Bernshteǐn who showed that the mixed volume of Newton polytopes of the system provide a generically share upper bound for the isolated solutions. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
22 Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for phcpy 4 Interface Design PHCpack as a state machine Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
23 a session with phcpy >>> import phcpy >>> p = [ x*y + 2*x - 3;, x**2 + y; ] >>> phcpy.mixed_volume(p) 3 >>> s = phcpy.solve(p) ROOT COUNTS : total degree : 4 2-homogeneous Bezout number : 3 with partition : {x }{y } general linear-product Bezout number : 3 based on the set structure : { x }{ y } { x y }{ x } mixed volume : 3 stable mixed volume : 3 Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
24 the solutions >>> print s[0] t : E E+00 m : 1 the solution for t : x : E E-01 y : E E+00 == err : 4.154E-16 = rco : 1.496E-01 = res : 1.665E-16 = >>> print s[1] t : E E+00 m : 1 the solution for t : x : E E-122 y : E E+00 == err : 2.428E-16 = rco : 2.059E-01 = res : 2.220E-16 = >>> print s[2] s[2] is the complex conjugate of s[1]. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
25 representations of polynomials and solutions Polynomials are mapped to file similar to plain string conversion in computer algebra and can be parsed in a direct manner. Symbols not to use as variable names: i, I, e, E. A solution is represented by 1 a value for the continuation parameter t; 2 a multiplicity flag; 3 real and imaginary parts as values for the variables; 4 three numerical attributes for an approximate zero z: 1 err z, or estimate for forward error; 2 rco: estimate for the inverse of the condition number; 3 res: f(z), or estimate for backward error. Newton s method with extended precision refines a regular solution. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
26 Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for phcpy 4 Interface Design PHCpack as a state machine Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
27 Sphinx generates documentation What is Sphinx? From Sphinx is a tool that makes it easy to create intelligent and beautiful documentation, written by Georg Brandl and licensed under the BSD license. It was originally created for the new Python documentation, and it has excellent facilities for the documentation of Python projects, but C/C++ is already supported as well, and it is planned to add special support for other languages as well. Sphinx uses restructuredtext as its markup language, and many of its strengths come from the power and straightforwardness of restructuredtext and its parsing and translating suite, the Docutils. The same documentation is generated in several formats, including latex, pdf, html. Why Sphinx? Used for the python language, numpy, sympy, matplotlib. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
28 step-by-step documentation generation Given Python code with documentation strings, generate documentation with Sphinx. There are a few steps to take: 1 Make a new directory doc and do "cd doc". 2 Run sphinx-quickstart in the doc directory. Following default options, doc contains a "Makefile" and two directories: "build" and "source". 3 Edit conf.py in source as follows: sys.path.insert(0, os.path.abspath( <path> )) where <path> is the directory where our Python code is. 4 Edit index.rst with ".. automodule::" lines. 5 Type "make latexpdf" or "make html" to generate. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
29 Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for phcpy 4 Interface Design PHCpack as a state machine Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
30 running sphinx-quickstart The doc directory is in PHCv2/Python. Running sphinx-quickstart, some items: The root path is the current directory [.] if we run sphinx-quickstart in the doc directory. We want separate source and build directories. We can enter project name, author, version, and release numbers. Source files have suffix.rst. The master document is "index". We answer y to "autodoc" because we want automatically insert docstrings from modules. We answer y to "viewcode" to include links to the source code of documented Python objects. We also answer y to "Create Makefile?" Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
31 editing conf.py The source directory contains a file "conf.py" which we have to edit. On Mac OS X: sys.path.insert(0, \ os.path.abspath( /Users/jan/PHCv2/Python/PHCpy/phcpy )) On Linux: sys.path.insert(0, \ os.path.abspath( /home/jan/phcv2/python/phcpy/phcpy )) Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
32 editing index.rst Downloading PHCpack The source for PHCpack can be downloaded from < The Python interface phcpy to PHCpack is a programmer s interface. You will need to compile the source code of PHCpack with the GNU Ada compiler, available at < Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
33 use of automodule in index.rst the functions of phcpy The module phcpy depends on the shared object file phcpy2c.so. It exports the blackbox solver of PHCpack, a fast mixed volume calculator, and a path tracker. The test function of the module generates two trinomials (a polynomial with three monomials) with randomly generated complex coefficients... automodule:: phcpy :members: Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
34 documenting examples some important examples PHCpack has been tested on many examples of polynomial systems taken from the research literature. The module examples exports some of those examples... automodule:: examples :members: Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
35 documenting phcwulf the module phcwulf The file phcwulf defines a simple client/server interaction to solve many random trinomials... automodule:: phcwulf :members: Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
36 documenting phcsols the module phcsols Solutions of phcpy.solve are returned as lists of PHCpack solution strings. The phcsols module contains functions to parse a PHCpack solution string into a dictionary... automodule:: phcsols :members: Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
37 Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for phcpy 4 Interface Design PHCpack as a state machine Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
38 PHCpack as a state machine phcpy is build on top of the C interface to PHCpack. The C interface was developed for the parallel versions of the path trackers in PHCpack. The main program, written in C, does the scheduling of the path tracking jobs, using the Message Passing Interface (MPI). Every job makes calls to the path trackers of PHCpack, the code written in Ada. The C interface should remain light, without having to duplicate the data structures for polynomials and solutions. Idea: we can build up a polynomial adding one term at a time, with calls to an interface routine. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
39 code of phcpy.solver.solve def solve(pols, silent=false): """ Calls the blackbox solver of PHCpack. On input in pols is a list of strings. By default, the solver will print to screen the computed root counts. To make the solver silent, set the flag silent to True. """ from phcpy.phcpy2c \ import py2c_syscon_clear_laurent_system from phcpy.phcpy2c \ import py2c_syscon_initialize_number_of_laurentials from phcpy.phcpy2c import py2c_syscon_store_laurential from phcpy.phcpy2c import py2c_solcon_clear_solutions from phcpy.phcpy2c import py2c_solve_laurent_system py2c_syscon_clear_laurent_system() py2c_solcon_clear_solutions() Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
40 code of phcpy.solver.solve continued dim = len(pols) py2c_syscon_initialize_number_of_laurentials(dim) for ind in range(0, dim): pol = pols[ind] nchar = len(pol) py2c_syscon_store_laurential(nchar, dim, ind+1, \ pol) py2c_solve_laurent_system(silent) return load_solutions() Advantage: the Python code deals only with strings. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
41 Summary and Exercises We do not release source code without documentation. Sphinx generates documention automatically. Exercises: Use Sphinx in your computer projects! Take the Python scripts you used in your first computer project and make a Python package. Document your Python package with restructured text and use Sphinx to generate documentation in html and latex-pdf formats. Scientific Software (MCS 507 L-18) Packaging Python code and Sphinx 7 October / 41
PHCpack, phcpy, and Sphinx
PHCpack, phcpy, and Sphinx 1 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 2 Documenting Software with Sphinx Sphinx generates documentation
More informationphcpy: an API for PHCpack
phcpy: an API for PHCpack Jan Verschelde University of Illinois at Chicago Department of Mathematics, Statistics, and Computer Science http://www.math.uic.edu/ jan jan@math.uic.edu Graduate Computational
More informationturning expressions into functions symbolic substitution, series, and lambdify
Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where
More informationSolving Polynomial Systems with PHCpack and phcpy
Solving Polynomial Systems with PHCpack and phcpy Jan Verschelde University of Illinois at Chicago Department of Mathematics, Statistics, and Computer Science http://www.math.uic.edu/ jan jan@math.uic.edu
More informationsolving polynomial systems in the cloud with phc
solving polynomial systems in the cloud with phc Jan Verschelde University of Illinois at Chicago Department of Mathematics, Statistics, and Computer Science http://www.math.uic.edu/ jan jan@math.uic.edu
More informationPolynomial Homotopy Continuation on Graphics Processing Units
Polynomial Homotopy Continuation on Graphics Processing Units Jan Verschelde joint work with Xiangcheng Yu University of Illinois at Chicago Department of Mathematics, Statistics, and Computer Science
More informationAccelerating Polynomial Homotopy Continuation on a Graphics Processing Unit with Double Double and Quad Double Arithmetic
Accelerating Polynomial Homotopy Continuation on a Graphics Processing Unit with Double Double and Quad Double Arithmetic Jan Verschelde joint work with Xiangcheng Yu University of Illinois at Chicago
More informationGift Wrapping for Pretropisms
Gift Wrapping for Pretropisms Jan Verschelde University of Illinois at Chicago Department of Mathematics, Statistics, and Computer Science http://www.math.uic.edu/ jan jan@math.uic.edu Graduate Computational
More informationPolyhedral Homotopies
Polyhedral Homotopies Polyhedral homotopies provide proof that mixed volumes count the roots of random coefficient polynomial systems. Mixed-cell configurations store the supports of all start systems
More informationThe Gift Wrapping Method in PHCpack
The Gift Wrapping Method in PHCpack Jan Verschelde University of Illinois at Chicago Department of Mathematics, Statistics, and Computer Science http://www.math.uic.edu/ jan jan@math.uic.edu Graduate Computational
More informationLECTURE 26. Documenting Python
LECTURE 26 Documenting Python DOCUMENTATION Being able to properly document code, especially large projects with multiple contributors, is incredibly important. Code that is poorly-documented is sooner
More informationTropical Implicitization
Tropical Implicitization Jan Verschelde University of Illinois at Chicago Department of Mathematics Statistics and Computer Science http://www.math.uic.edu/ jan jan@math.uic.edu Graduate Computational
More informationComputing all Space Curve Solutions of Polynomial Systems by Polyhedral Methods
Computing all Space Curve Solutions of Polynomial Systems by Polyhedral Methods Nathan Bliss Jan Verschelde University of Illinois at Chicago Department of Mathematics, Statistics, and Computer Science
More informationHow to Contribute to a Sphinx Doc Documentation
How to Contribute to a Sphinx Doc Documentation Release 1.0 Haoxi Zhan December 18, 2013 Contents 1 Install Sphinx 3 1.1 Linux................................................... 3 1.2 Mac OS X................................................
More informationdocs-python2readthedocs Documentation
docs-python2readthedocs Documentation Release 0.1.0 Matthew John Hayes Dec 01, 2017 Contents 1 Introduction 3 2 Install Sphinx 5 2.1 Pre-Work................................................. 5 2.2 Sphinx
More informationRoot Finding Methods. sympy and Sage. MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011
wrap Root Finding Methods 1 2 wrap MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011 Root Finding Methods 1 wrap 2 wrap wrap octave-3.4.0:1> p = [1,0,2,-1]
More informationOn Massively Parallel Algorithms to Track One Path of a Polynomial Homotopy
On Massively Parallel Algorithms to Track One Path of a Polynomial Homotopy Jan Verschelde joint with Genady Yoffe and Xiangcheng Yu University of Illinois at Chicago Department of Mathematics, Statistics,
More informationRunning Cython. overview hello world with Cython. experimental setup adding type declarations cdef functions & calling external functions
Running Cython 1 Getting Started with Cython overview hello world with Cython 2 Numerical Integration experimental setup adding type declarations cdef functions & calling external functions 3 Using Cython
More informationInterval Arithmetic. MCS 507 Lecture 29 Mathematical, Statistical and Scientific Software Jan Verschelde, 28 October 2011
Naive Arithmetic 1 2 Naive 3 MCS 507 Lecture 29 Mathematical, Statistical and Scientific Software Jan Verschelde, 28 October 2011 Naive Arithmetic 1 2 Naive 3 an expression Naive Problem: Evaluate f(x,
More informationFloating-Point Arithmetic
Floating-Point Arithmetic 1 Numerical Analysis a definition sources of error 2 Floating-Point Numbers floating-point representation of a real number machine precision 3 Floating-Point Arithmetic adding
More informationCNRS ANF PYTHON Packaging & Life Cycle
CNRS ANF PYTHON Packaging & Life Cycle Marc Poinot Numerical Simulation Dept. Outline Package management with Python Concepts Software life cycle Package services Pragmatic approach Practical works Source
More informationFROM SCRIPT TO PACKAGES. good practices for hassle-free code reuse
FROM SCRIPT TO PACKAGES good practices for hassle-free code reuse WHAT S THIS TUTORIAL IS ABOUT How to make your code usable by someone else WHO AM I? Contributor to numpy/scipy since 2007 Windows, Mac
More informationphcpy Documentation Release Jan Verschelde
phcpy Documentation Release 0.8.7 Jan Verschelde Sep 27, 2018 Contents 1 Getting Started 1 1.1 what is phcpy?.............................................. 1 1.2 installing phcpy.............................................
More informationSphinxTutorial Documentation
SphinxTutorial Documentation Release 1.0 Anthony Scemama April 12, 2013 CONTENTS 1 Introduction 3 2 Creating a new Sphinx project 5 3 restructuredtext 9 3.1 Sections..................................................
More informationExact Gift Wrapping to Prune the Tree of Edges of Newton Polytopes to Compute Pretropisms
Exact Gift Wrapping to Prune the Tree of Edges of Newton Polytopes to Compute Pretropisms Jeff Sommars Jan Verschelde University of Illinois at Chicago Department of Mathematics, Statistics, and Computer
More informationAMath 483/583 Lecture 2
AMath 483/583 Lecture 2 Outline: Binary storage, floating point numbers Version control main ideas Client-server version control, e.g., CVS, Subversion Distributed version control, e.g., git, Mercurial
More informationAMath 483/583 Lecture 2. Notes: Notes: Homework #1. Class Virtual Machine. Notes: Outline:
AMath 483/583 Lecture 2 Outline: Binary storage, floating point numbers Version control main ideas Client-server version control, e.g., CVS, Subversion Distributed version control, e.g., git, Mercurial
More informationA NEW VIEW ON THE CAYLEY TRICK
A NEW VIEW ON THE CAYLEY TRICK KONRAD-ZUSE-ZENTRUM FÜR INFORMATIONSTECHNIK (ZIB) TAKUSTR. 7 D-14195 BERLIN GERMANY email: rambau@zib.de joint work with: BIRKETT HUBER, FRANCISCO SANTOS, Mathematical Sciences
More informationPython Project Documentation
Python Project Documentation Release 1.0 Tim Diels Jan 10, 2018 Contents 1 Simple project structure 3 1.1 Code repository usage.......................................... 3 1.2 Versioning................................................
More informationPython Packaging. Jakub Wasielak
Python Packaging Jakub Wasielak http://blog.pykonik.org/ http://koderek.edu.pl/ facebook.com/startechkrk https://pl.pycon.org/2017/ What? Why? Architecture https://packaging.python.org/current/ Installation
More informationPython Programming Exercises 1
Python Programming Exercises 1 Notes: throughout these exercises >>> preceeds code that should be typed directly into the Python interpreter. To get the most out of these exercises, don t just follow them
More informationMATH 890 HOMEWORK 2 DAVID MEREDITH
MATH 890 HOMEWORK 2 DAVID MEREDITH (1) Suppose P and Q are polyhedra. Then P Q is a polyhedron. Moreover if P and Q are polytopes then P Q is a polytope. The facets of P Q are either F Q where F is a facet
More informationDistil Documentation. Release Vinay Sajip
Distil Documentation Release 0.1.2 Vinay Sajip September 18, 2014 Contents 1 Overview 3 1.1 Why distil?.............................................. 3 1.2 Features..................................................
More informationThe Cantor Handbook. Alexander Rieder
Alexander Rieder 2 Contents 1 Introduction 5 2 Using Cantor 6 2.1 Cantor features....................................... 6 2.2 The Cantor backends.................................... 7 2.3 The Cantor Workspace...................................
More informationModule 7 Highlights. Mastered Reviewed. Sections ,
Sections 5.3 5.6, 6.1 6.6 Module 7 Highlights Andrea Hendricks Math 0098 Pre-college Algebra Topics Degree & leading coeff. of a univariate polynomial (5.3, Obj. 1) Simplifying a sum/diff. of two univariate
More informationoperator overloading algorithmic differentiation the class DifferentialNumber operator overloading
operator overloading 1 Computing with Differential Numbers algorithmic differentiation the class DifferentialNumber operator overloading 2 Computing with Double Doubles the class DoubleDouble defining
More informationMonotone Paths in Geometric Triangulations
Monotone Paths in Geometric Triangulations Adrian Dumitrescu Ritankar Mandal Csaba D. Tóth November 19, 2017 Abstract (I) We prove that the (maximum) number of monotone paths in a geometric triangulation
More informationApplied Informatics POCO PRO C++ Frameworks
Applied Informatics POCO PRO C++ Frameworks Getting Started Guide Version 1.10 Purpose of This Document This document guides developers interested in the POCO PRO C++ Frameworks by Applied Informatics
More informationThe RestructuredText Book Documentation
The RestructuredText Book Documentation Release 0.1 Daniel Greenfeld, Eric Holscher Sep 27, 2017 Contents 1 RestructuredText Tutorial 3 2 RestructuredText Guide 5 2.1 Basics...................................................
More informationCOMBINATORIAL COMMUTATIVE ALGEBRA. Fatemeh Mohammadi (University of Bristol)
COMBINATORIAL COMMUTATIVE ALGEBRA Fatemeh Mohammadi (University of Bristol) Abstract. In this lecture we focus on the ideals associated to graphs. We see many interesting examples in which the Betti numbers
More informationLess known packaging features and tricks
Less known packaging features and tricks Who Ionel Cristian Mărieș ionel is read like yonel, @ionelmc, blog.ionelmc.ro Did PyPI releases of 40 something distinct packages, since 2007 Working on a project
More informationDefining Functions. turning expressions into functions. writing a function definition defining and using modules
Defining Functions 1 Lambda Functions turning expressions into functions 2 Functions and Modules writing a function definition defining and using modules 3 Computing Series Developments exploring an example
More informationDirected acyclic decomposition of Kuramoto equations
Directed acyclic decomposition of Kuramoto equations Tianran Chen Abstract. The Kuramoto model is one of the most widely studied model for describing synchronization behaviors in a network of coupled oscillators,
More informationAlgebraic Methods for Counting Euclidean Embeddings of Rigid Graphs
Algebraic Methods for Counting Euclidean Embeddings of Rigid Graphs Ioannis Z. Emiris 1, Elias P. Tsigaridas 2, and Antonios E. Varvitsiotis 3 1 University of Athens, Athens, Greece 2 INRIA Méditerranée,
More informationRunning Cython and Vectorization
Running Cython and Vectorization 1 Getting Started with Cython overview hello world with Cython 2 Numerical Integration experimental setup adding type declarations cdef functions & calling external functions
More informationOutline. software testing: search bugs black-box and white-box testing static and dynamic testing
Outline 1 Verification Techniques software testing: search bugs black-box and white-box testing static and dynamic testing 2 Programming by Contract assert statements in Python using preconditions and
More informationEffective Programming Practices for Economists. 13. Documenting (the code of) research projects
Effective Programming Practices for Economists 13. Documenting (the code of) research projects Hans-Martin von Gaudecker Department of Economics, Universität Bonn At the end of this lecture you are able
More informationDocumentation. David Grellscheid
Documentation David Grellscheid 2015-04-22 Documentation is communication Need to consider all levels, they have different audiences: Code annotations: formatting, comments Structure-level documentation
More informationNumerical Integration
Numerical Integration 1 Functions using Functions functions as arguments of other functions the one-line if-else statement functions returning multiple values 2 Constructing Integration Rules with sympy
More informationConvex Geometry arising in Optimization
Convex Geometry arising in Optimization Jesús A. De Loera University of California, Davis Berlin Mathematical School Summer 2015 WHAT IS THIS COURSE ABOUT? Combinatorial Convexity and Optimization PLAN
More informationWeb Interfaces. the web server Apache processing forms with Python scripts Python code to write HTML
Web Interfaces 1 Python Scripts in Browsers the web server Apache processing forms with Python scripts Python code to write HTML 2 Web Interfaces for the Determinant dynamic interactive forms passing data
More informationRunning Cython and Vectorization
Running Cython and Vectorization 1 Getting Started with Cython overview hello world with Cython 2 Numerical Integration experimental setup adding type declarations cdef functions & calling external functions
More informationOpen source software and Sage 1
Open source software and Sage 1 http://www.sagemath.org/ David Joyner Math Dept USNA, Annapolis, MD May, 2009 1 Presentation for NSF CDI workshop David Joyner Open source software and Sage http://www.sagemath.org/
More informationPolytopes With Large Signature
Polytopes With Large Signature Joint work with Michael Joswig Nikolaus Witte TU-Berlin / TU-Darmstadt witte@math.tu-berlin.de Algebraic and Geometric Combinatorics, Anogia 2005 Outline 1 Introduction Motivation
More informationIntroduction to Scientific Computing with Python, part two.
Introduction to Scientific Computing with Python, part two. M. Emmett Department of Mathematics University of North Carolina at Chapel Hill June 20 2012 The Zen of Python zen of python... fire up python
More informationPython Scripting for Computational Science
Hans Petter Langtangen Python Scripting for Computational Science Third Edition With 62 Figures 43 Springer Table of Contents 1 Introduction... 1 1.1 Scripting versus Traditional Programming... 1 1.1.1
More informationIntroduction to Python for Scientific Computing
1 Introduction to Python for Scientific Computing http://tinyurl.com/cq-intro-python-20151022 By: Bart Oldeman, Calcul Québec McGill HPC Bart.Oldeman@calculquebec.ca, Bart.Oldeman@mcgill.ca Partners and
More informationPyPI to 0install Documentation
PyPI to 0install Documentation Release 0.1.0 Tim Diels Mar 14, 2017 Contents 1 User documentation 3 1.1 Installation................................................ 3 1.2 Running.................................................
More informationCore Python is small by design
Core Python is small by design One of the key features of Python is that the actual core language is fairly small. This is an intentional design feature to maintain simplicity. Much of the powerful functionality
More informationOutline. evolution of the web IP addresses and URLs client/server and HTTP. HTML, XML, MathML MathML generated by Maple. the weather forecast
Outline 1 Internet Basics evolution of the web IP addresses and URLs client/server and HTTP 2 Markup Languages HTML, XML, MathML MathML generated by Maple 3 Retrieving Data the weather forecast 4 CGI Programming
More informationBrandon Rhodes Python Atlanta, July 2009
The Sphinx Documentation System Brandon Rhodes Python Atlanta, July 2009 Three application models 1. Monolithic Big App Plain text PDF output HTML Special Format 1. Monolithic Big App Plain text PDF output
More informationLECTURE 19. Numerical and Scientific Packages
LECTURE 19 Numerical and Scientific Packages NUMERICAL AND SCIENTIFIC APPLICATIONS As you might expect, there are a number of third-party packages available for numerical and scientific computing that
More informationTable of Contents EVALUATION COPY
Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...
More informationRecommonmark Documentation
Recommonmark Documentation Release 0.5.0 Lu Zero, Eric Holscher, and contributors Jan 22, 2019 Contents 1 Contents 3 2 Getting Started 11 3 Development 13 4 Why a bridge? 15 5 Why another bridge to docutils?
More informationGeometric Algorithms in Three Dimensions Tutorial. FSP Seminar, Strobl,
Geometric Algorithms in Three Dimensions Tutorial FSP Seminar, Strobl, 22.06.2006 Why Algorithms in Three and Higher Dimensions Which algorithms (convex hulls, triangulations etc.) can be generalized to
More informationHigh Level Parallel Processing
High Level Parallel Processing 1 GPU computing with Maple enabling CUDA in Maple 15 stochastic processes and Markov chains 2 Multiprocessing in Python scripting in computational science the multiprocessing
More informationA combinatorial proof of a formula for Betti numbers of a stacked polytope
A combinatorial proof of a formula for Betti numbers of a staced polytope Suyoung Choi Department of Mathematical Sciences KAIST, Republic of Korea choisy@aistacr (Current Department of Mathematics Osaa
More informationScientific Python. 1 of 10 23/11/ :00
Scientific Python Neelofer Banglawala Kevin Stratford nbanglaw@epcc.ed.ac.uk kevin@epcc.ed.ac.uk Original course authors: Andy Turner Arno Proeme 1 of 10 23/11/2015 00:00 www.archer.ac.uk support@archer.ac.uk
More information60 2 Convex sets. {x a T x b} {x ã T x b}
60 2 Convex sets Exercises Definition of convexity 21 Let C R n be a convex set, with x 1,, x k C, and let θ 1,, θ k R satisfy θ i 0, θ 1 + + θ k = 1 Show that θ 1x 1 + + θ k x k C (The definition of convexity
More informationConvex Hull Representation Conversion (cddlib, lrslib)
Convex Hull Representation Conversion (cddlib, lrslib) Student Seminar in Combinatorics: Mathematical Software Niklas Pfister October 31, 2014 1 Introduction In this report we try to give a short overview
More informationNbconvert Refactor Final 1.0
Nbconvert Refactor Final 1.0 Jonathan Frederic June 20, 2013 Part I Introduction IPython is an interactive Python computing environment[1]. It provides an enhanced interactive Python shell. The IPython
More information1. How many white tiles will be in Design 5 of the pattern? Explain your reasoning.
Algebra 2 Semester 1 Review Answer the question for each pattern. 1. How many white tiles will be in Design 5 of the pattern Explain your reasoning. 2. What is another way to represent the expression 3.
More informationCompiling Software on UNIX. System Administration Decal Spring 2009 Lecture #4 George Wu Slides prepared by Joshua Kwan
Compiling Software on UNIX System Administration Decal Spring 2009 Lecture #4 George Wu Slides prepared by Joshua Kwan Today How to turn source code into programs that run on Linux? What if that software
More informationNewton Polygons of L-Functions
Newton Polygons of L-Functions Phong Le Department of Mathematics University of California, Irvine June 2009/Ph.D. Defense Phong Le Newton Polygons of L-Functions 1/33 Laurent Polynomials Let q = p a where
More informationThe important function we will work with is the omega map ω, which we now describe.
20 MARGARET A. READDY 3. Lecture III: Hyperplane arrangements & zonotopes; Inequalities: a first look 3.1. Zonotopes. Recall that a zonotope Z can be described as the Minkowski sum of line segments: Z
More informationMechanism and Robot Kinematics, Part II: Numerical Algebraic Geometry
Mechanism and Robot Kinematics, Part II: Numerical Algebraic Geometry Charles Wampler General Motors R&D Center Including joint work with Andrew Sommese, University of Notre Dame Jan Verschelde, Univ.
More informationScientific Computing: Lecture 1
Scientific Computing: Lecture 1 Introduction to course, syllabus, software Getting started Enthought Canopy, TextWrangler editor, python environment, ipython, unix shell Data structures in Python Integers,
More informationPython Scripting for Computational Science
Hans Petter Langtangen Python Scripting for Computational Science Third Edition With 62 Figures Sprin ger Table of Contents 1 Introduction 1 1.1 Scripting versus Traditional Programming 1 1.1.1 Why Scripting
More informationS1-IV-Question-Pool Documentation
S1-IV-Question-Pool Documentation Release 0.1.0 Section-I Sep 25, 2017 Contents 1 How to contribute 3 2 The Prologue 7 3 C Language Questions 9 4 C Language Solutions 11 5 Linux Usage Questions 13 6 Linux
More informationJDEP 384H: Numerical Methods in Business
Instructor: Thomas Shores Department of Mathematics Lecture 1, January 9, 2007 110 Kaufmann Center Outline 1 2 3 Solving Systems Matrix and Vector Algebra Welcome to Matlab! Rational File Management File
More informationConstrained and Unconstrained Optimization
Constrained and Unconstrained Optimization Carlos Hurtado Department of Economics University of Illinois at Urbana-Champaign hrtdmrt2@illinois.edu Oct 10th, 2017 C. Hurtado (UIUC - Economics) Numerical
More informationarxiv: v1 [math.co] 27 Feb 2015
Mode Poset Probability Polytopes Guido Montúfar 1 and Johannes Rauh 2 arxiv:1503.00572v1 [math.co] 27 Feb 2015 1 Max Planck Institute for Mathematics in the Sciences, Inselstraße 22, 04103 Leipzig, Germany,
More informationLECTURE 9. Development Tools
LECTURE 9 Development Tools DEVELOPMENT TOOLS Since you are all still in the earlier stages of your semester-long projects, now is a good time to cover some useful modules and tools for managing larger
More informationLECTURE 9. Development Tools
LECTURE 9 Development Tools DEVELOPMENT TOOLS Since you are all still in the earlier stages of your semester-long projects, now is a good time to cover some useful modules and tools for managing larger
More informationbe a polytope. has such a representation iff it contains the origin in its interior. For a generic, sort the inequalities so that
( Shelling (Bruggesser-Mani 1971) and Ranking Let be a polytope. has such a representation iff it contains the origin in its interior. For a generic, sort the inequalities so that. a ranking of vertices
More informationPulp Python Support Documentation
Pulp Python Support Documentation Release 1.0.1 Pulp Project October 20, 2015 Contents 1 Release Notes 3 1.1 1.0 Release Notes............................................ 3 2 Administrator Documentation
More informationh-polynomials of triangulations of flow polytopes (Cornell University)
h-polynomials of triangulations of flow polytopes Karola Mészáros (Cornell University) h-polynomials of triangulations of flow polytopes (and of reduction trees) Karola Mészáros (Cornell University) Plan
More informationWelcome to Bootcamp2015 s documentation!
Welcome to Bootcamp2015 s documentation! This website (or pdf) will be home to some resources that will be useful for boot campers and instructors. Lecture notes and assignments for the econ course associated
More informationPOLYHEDRAL GEOMETRY. Convex functions and sets. Mathematical Programming Niels Lauritzen Recall that a subset C R n is convex if
POLYHEDRAL GEOMETRY Mathematical Programming Niels Lauritzen 7.9.2007 Convex functions and sets Recall that a subset C R n is convex if {λx + (1 λ)y 0 λ 1} C for every x, y C and 0 λ 1. A function f :
More informationConvex Hulls in Three Dimensions. Polyhedra
Convex Hulls in Three Dimensions Polyhedra Polyhedron 1.A polyhedron is the generalization of a 2- D polygon to 3-D A finite number of flat polygonal faces The boundary or surface of a polyhedron - Zero-dimensional
More informationGUT. GUT Installation Guide
Date : 17 Mar 2011 1/6 GUT Contents 1 Introduction...2 2 Installing GUT...2 2.1 Optional Extensions...2 2.2 Installation using the Binary package...2 2.2.1 Linux or Mac OS X...2 2.2.2 Windows...4 2.3 Installing
More informationChapter 8. Voronoi Diagrams. 8.1 Post Oce Problem
Chapter 8 Voronoi Diagrams 8.1 Post Oce Problem Suppose there are n post oces p 1,... p n in a city. Someone who is located at a position q within the city would like to know which post oce is closest
More informationUser-Defined Function
ENGR 102-213 (Socolofsky) Week 11 Python scripts In the lecture this week, we are continuing to learn powerful things that can be done with userdefined functions. In several of the examples, we consider
More informationComputing Tropical Resultants. A. Jensen and J. Yu. REPORT No. 44, 2010/2011, spring ISSN X ISRN IML-R /11- -SE+spring
Computing Tropical Resultants A. Jensen and J. Yu REPORT No. 44, 2010/2011, spring ISSN 1103-467X ISRN IML-R- -44-10/11- -SE+spring COMPUTING TROPICAL RESULTANTS arxiv:1109.2368v2 [math.ag] 24 Mar 2013
More informationInteger Programming Theory
Integer Programming Theory Laura Galli October 24, 2016 In the following we assume all functions are linear, hence we often drop the term linear. In discrete optimization, we seek to find a solution x
More informationCS599: Convex and Combinatorial Optimization Fall 2013 Lecture 4: Convex Sets. Instructor: Shaddin Dughmi
CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 4: Convex Sets Instructor: Shaddin Dughmi Announcements New room: KAP 158 Today: Convex Sets Mostly from Boyd and Vandenberghe. Read all of
More informationTriangulations Of Point Sets
Triangulations Of Point Sets Applications, Structures, Algorithms. Jesús A. De Loera Jörg Rambau Francisco Santos MSRI Summer school July 21 31, 2003 (Book under construction) Triangulations Of Point Sets
More informationdifferentiation techniques
differentiation techniques 1 Callable Objects delayed execution of stored code 2 Numerical and Symbolic Differentiation numerical approximations for the derivative storing common code in a parent class
More informationAmphitheater School District End Of Year Algebra II Performance Assessment Review
Amphitheater School District End Of Year Algebra II Performance Assessment Review This packet is intended to support student preparation and review for the Algebra II course concepts for the district common
More informationFACES OF CONVEX SETS
FACES OF CONVEX SETS VERA ROSHCHINA Abstract. We remind the basic definitions of faces of convex sets and their basic properties. For more details see the classic references [1, 2] and [4] for polytopes.
More information