Lecture NotesIPython Notebook
Topics
IPython notebook
Material
NBviewer
- You can nicely view those notebooks at http://nbviewer.jupyter.org/
- Use the icons in the right upper corner:
- present/book: switch to slides and back (if notebook is a slideshow)
- download the raw notebook
- You cannot run the notebook!
- If you want that, download it, and open it from IPython notebook
Markdown
LateX
- LateX is used in notebooks to create good looking math and other high level typesetting.
- LateX is the choice for writing a thesis or scientific paper, _well, if MarkDown is not sufficient for you.....
- LateX is ideal for
- bibliography
- changing look and feel of your thesis (two column, like a book, like a paper, etc)
- There are many editors available
- TexMaker works on all platforms and seems to work well.
- But note that unless you want to write your thesis or your reports in LateX there is no need to install this editor
- Latex on Dutch Wikipedia
- Math symbols cheat sheet
- In order to generate PDF's from your notebooks (maybe to print them....), you use LateX, and then you need to have pdflatex installed.
nbconvert
Conversion to slides
- Slides based on notebooks are easy to make and there are really cool options and possibilities.
- There is a 'Cell Toolbar' option 'Slideshow'. This allows you to edit each cell as either a new slide, or something that is revealed after a click, and other options.
- This is added to the metadata for the notebook, and doesn't change the way the notebooks look in anyway.
- After annotating the cells, there is two ways to create the slideshow. See Making slides
- Tutorial and example: http://www.damian.oquanta.info/posts/make-your-slides-with-ipython.html
Making slides
Method 1
Method 2
- Run the command
ipython nbconvert SetTheory.ipynb --to slides --reveal-prefix "http://maartenmarx.nl/reveal.js"
from the terminal
- Make sure Pandoc is installed
- Make sure the https://github.com/hakimel/reveal.js/downloads reveal.js directory is installed at the right place (here thus "http://maartenmarx.nl/reveal.js" )
- if you add
--post serve
as an option the result is shown in the browser, as a slideshow!
- You can't run the code though!
Note
- Latex only works well from Ipython 2.3
Handy Linux/Unix Stuff
These things are handy when you have a mac and use the command line. Or of course when you use a linux terminal.
Assignment
Make this assignment to get really comfortable with all aspects of the notebook. Really, you will become so happy when you get fluent in it.
Note book Assignment
Abstract
You will create a complete lesson about a theoretical Information Science topic. You will create a notebook, use LateX for formulas, use bibliographic references, use inline pictures, use inline iframes, have small pieces of code, etc.
You will also create slides and a HTML version from your notebook.
Finally you make a set of exercises in a notebook, together with model answers.
Goals
- Learn how to use and integrate all techniques we learned this week.
- Having a template/workflow for more complex tasks.
The topic
The topic of the lesson is Sets), in Dutch Verzamelingen) Note: in some markdown editors, this link is broken, as the last parenthesis is not parsed as being part of the URL
The lesson follows the order and the topics in http://en.wikipedia.org/wiki/Set_(mathematics). For each topic (a section in the wikipedia article), you create a section in your notebook too. In the accompanying sideshow, you go down in the slides when you enter a topic. You do all sections up to (and including) http://en.wikipedia.org/wiki/Set_(mathematics)#Basic_operations.
You end with a section on Boolean Logic, described below.
Form
Each topic consists of the following items:
- Definition
- Illustration of the definition
- Implementation of the topic in Python
- Construction
- often involving Python code
- Application and examples
- also often involving code
- Exercises
Boolean Logic
End with a section on Boolean Logic in which you explain the meaning of the connectives and,or,xor and not using sets. http://en.wikipedia.org/wiki/Boolean_algebra#Venn_diagrams is a good place to start.
Notebook to get you started.
Use this notebook as the basis for your assignment. In particular make the programming exercises in them.