notebook2.ipynb @master — view markup · raw · history · blame
NumPy and Matplotlib examples¶
First import NumPy and Matplotlib:
In [1]:
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
print(matplotlib.backends.backend)
In [2]:
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')
matplotlib.rcParams['figure.figsize'] = (2,1)
In [3]:
ip.display_formatter.formatters['application/pdf'].type_printers
Out[3]:
In [4]:
import numpy as np
Now we show some very basic examples of how they can be used.
In [5]:
a = np.random.uniform(size=(100,100))
In [6]:
a.shape
Out[6]:
In [7]:
evs = np.linalg.eigvals(a)
In [8]:
evs.shape
Out[8]:
Here is a very long heading that pandoc will wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap and wrap¶
Here is a cell that has both text and PNG output:
In [9]:
plt.hist(evs.real)
Out[9]:
import math
import numpy as np
def matrix_calc(L=None):
"""docstring"""
if L is None: L = np.random.random(size=(1,1)) raise Exception("message")
This string contains a strikethrough, struckthrough.
This string contains a '
single tick inside backticks, leading to a \textquotesingle
in latex.