cosc 490 computational topology - salisbury...

7
8/28/18 1 COSC 490 Computational Topology Dr. Joe Anderson Fall 2018 Salisbury University Course Structure Weeks 1-2: Python and Basic Data Processing Python commonly used in industry & academia Weeks 3-6: Group theory, topology of simple structures Graphs are a natural tool to study the structure of spatial data Group theory generalizes many algebraic notions and can formally capture geometric intuition Weeks 7-14: Algebraic topology, algorithms Deep mathematical modeling of data Usually people use statistics, but we will use geometry! How to write programs to use topological models to make inference

Upload: others

Post on 07-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COSC 490 Computational Topology - Salisbury Universityfaculty.salisbury.edu/~jtanderson/teaching/cosc490/fa18/files/intro.pdfComputational Topology Dr. Joe Anderson Fall 2018 Salisbury

8/28/18

1

COSC 490Computational Topology

Dr. Joe AndersonFall 2018

Salisbury University

Course Structure

• Weeks 1-2: Python and Basic Data Processing• Python commonly used in industry & academia

• Weeks 3-6: Group theory, topology of simple structures• Graphs are a natural tool to study the structure of spatial data • Group theory generalizes many algebraic notions and can formally capture

geometric intuition

• Weeks 7-14: Algebraic topology, algorithms• Deep mathematical modeling of data

• Usually people use statistics, but we will use geometry!• How to write programs to use topological models to make inference

Page 2: COSC 490 Computational Topology - Salisbury Universityfaculty.salisbury.edu/~jtanderson/teaching/cosc490/fa18/files/intro.pdfComputational Topology Dr. Joe Anderson Fall 2018 Salisbury

8/28/18

2

Course Materials

• Main point of reference: http://faculty.salisbury.edu/~jtanderson/

• Helpful textbooks• “Computational Topology” by Edelsbrunner and Harer• “Topology for Computing” by Zomorodian• “A Short Course in Computation Geometry and Topology” by Edelsbrunner• “Elementary Applied Topology” by Ghrist

• Technology• Python w/ scientific computing libraries (via the Anaconda distribution

manager - www.anaconda.com/download)• GNU/Linux and C++ with graphics libraries (e.g. “trimesh”)

Homework 0

• Find my office (DH 140) and come say hello• Install Python, verify that the example script on the course webpage

(pytest.py) runs without error• (using the system-provided Python is not recommended)

• Familiarize with Python 3 functionality, syntax• https://docs.python.org/3/tutorial/

Page 3: COSC 490 Computational Topology - Salisbury Universityfaculty.salisbury.edu/~jtanderson/teaching/cosc490/fa18/files/intro.pdfComputational Topology Dr. Joe Anderson Fall 2018 Salisbury

8/28/18

3

Getting Python

• Highly recommended: the Anaconda Python environment manager• https://www.anaconda.com/download/• On COSC Linux, use install script to install to your own home directory• Why?

• Python is maturing and the community is quite large• Has had far more growing pains than a language like C++ because of its widespread

usage• New and different libraries have come along that do not always interact well

together• What is Anaconda?

• A single install that brings along Python, some important libraries (numpy and scipy) for scientific computing

• A package manager to easily add more Python libraries and tools

Python Overview

• High-level language• Many common built-in types, but also uses more abstraction than, e.g. C++• Example: an array in Python is automatically of flexible size, and can hold

mixed data values• Dynamic• Variables are not created with a fixed type, can be re-assigned to any type• Everything is (usually) a pointer automatically, no “->” notation needed

• Interpreted• Programs are read and executed line-by-line, not compiled• Can be programmed “interactively” – see the results of each line before you

type the next one

Page 4: COSC 490 Computational Topology - Salisbury Universityfaculty.salisbury.edu/~jtanderson/teaching/cosc490/fa18/files/intro.pdfComputational Topology Dr. Joe Anderson Fall 2018 Salisbury

8/28/18

4

Python

• To open the interpreter (on Linux) on the command-line, type “python” and press Enter• You can now type Python code and when you press “Enter”, the line

will be either executed or continued on the next line (in the case of control-flow, like if-statements and for-loops)• Some “big” syntactic differences• No semi-colons to end statements, need newlines• No brackets to designate blocks, instead blocks are determined by indentation• No explicit variable types, return types, or parameter types

Python

• Example highlights:

Page 5: COSC 490 Computational Topology - Salisbury Universityfaculty.salisbury.edu/~jtanderson/teaching/cosc490/fa18/files/intro.pdfComputational Topology Dr. Joe Anderson Fall 2018 Salisbury

8/28/18

5

Get in and practice!

• Consult the Python and Numpy documentation frequently!• https://docs.python.org/3/• https://docs.scipy.org/doc/numpy-1.13.0/reference/

• Homework 1• On webpage, practice writing some Python scripts for numerical manipulation• Program speed and efficiency count!• Solutions should not need more than a few seconds to complete

• (Computational topology will be much more difficult to solve computationally, better get fast now!)

Python for Numerical Manipulation

• Check out: https://realpython.com/numpy-array-programming/• Key topics:• Vectorizing• Broadcasting• Shaping• Slicing• Plots

Page 6: COSC 490 Computational Topology - Salisbury Universityfaculty.salisbury.edu/~jtanderson/teaching/cosc490/fa18/files/intro.pdfComputational Topology Dr. Joe Anderson Fall 2018 Salisbury

8/28/18

6

More Python tools: iPython

• Very similar environment to Mathematica• But Python driven!• Can save as Python script easily• Comes installed with the Anaconda (hooray!)• To access: open a terminal and execute• jupyter notebook

• Errors? Make sure your anaconda folder is added to your “PATH” environment variable

Example: Graph algorithms

• Graph is a pair G = (V,E) of vertices and edges

Questions: 1. How do we represent a graph programmatically?2. What are the structural properties of the graph?3. How can we represent and compute the structure?

Page 7: COSC 490 Computational Topology - Salisbury Universityfaculty.salisbury.edu/~jtanderson/teaching/cosc490/fa18/files/intro.pdfComputational Topology Dr. Joe Anderson Fall 2018 Salisbury

8/28/18

7

Using iPython + Jupyter

• For graphs:• (Sigh) install the “graphviz” library with “pip install graphviz”• Https://pypi.org/project/graphviz/ for documentation

• Computations happen in individual “cells” like Mathematica

• To execute a cell, press Shift+Enter

• The results will be displayed below

• The environment is persistent across cells!

• To clear your environment (variables and functions) use the “restart the kernel” button