"Hello IPython notebook!"
# Only the last statement will be shown
L = ['red', 'blue', 'green', 'black', 'white']
type(L)
#sorted(L) # uncomment this line to show the sorted list instead of the type
# An example code cell using stuff from pylab
# numpy's linspace and pi
x = linspace(0, 3*pi, 500)
# matplotlib's plot and title
plot(x, sin(x**2))
title('A simple chirp');
# Errors lead to detailed tracebacks
x = "Hello IPython!"
y = 42
z = x + y
# Echo the version of IPython
import IPython
IPython.__version__
ipython notebook --pylab=inline
to launch the notebookYou can:
Using:
Markdown basics: lists, markup and code
list item
list item
italics
bold
fixed_font
Code examples:
def hello_ipython():
print "Hello IPython!"
Markdown cells can also contain HTML
Markdown basics: lists, markup and code
list item
italics
fixed_font
Code examples:
def hello_ipython():
print "Hello IPython!"
Using math mode (anything between two $
s or two $$
s) is interpreted as $LaTeX$ math:
Modify or create a markdown cell and use:
Use either $
or $$
for the math expressions. What is the difference?
Look at the markdown syntax page (or this cell) to find out how to create hyperlinks
# Help on python objects using the '?'
import IPython
IPython?
# Using the built-in help
help(IPython)
Double click on the divider to close the help console
# Tab completion is available
IPython. # press TAB after the period
The Help menu item has links to IPython and the scientific packages
.ipynb
extension*.ipynb
file*.py
file with the markdown as comments*.py
file can also be imported*.ipynb
file. Can you decipher it at least somewhat.*.py
file. What does this look like in the editor?from IPython.display import Image
Image(filename='images/logo.png')
from IPython.display import YouTubeVideo
YouTubeVideo('F4rFuIb1Ie4')
# Alternatively, load an image from a URL
Image(url='http://octodex.github.com/images/pythocat.png')
Hiding output
Debugging by attaching a QTConsole
Restarting the kernel in case of crashes
Cython magic