--- title: NumPy and Matplotlib examples keywords: fastai sidebar: home_sidebar nb_path: "venv/Lib/site-packages/nbconvert/tests/files/notebook2.ipynb" ---
First import NumPy and Matplotlib:
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
print(matplotlib.backends.backend)
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')
matplotlib.rcParams['figure.figsize'] = (2,1)
ip.display_formatter.formatters['application/pdf'].type_printers
import numpy as np
Now we show some very basic examples of how they can be used.
a = np.random.uniform(size=(100,100))
a.shape
evs = np.linalg.eigvals(a)
evs.shape
Here is a cell that has both text and PNG output:
plt.hist(evs.real)
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.