
This notebook is part of the IPython NB Example; the content is available on GitHub.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
IPynb Example 1¶
Purpose: The purpose of this workbook is to help you get comfortable with the topics below.
Recomended Usage
- Run each of the cells (Shift+Enter) and edit them as necessary to solidify your understanding
- Do any of the exercises that are relevant to helping you understand the material
Topics Covered
- Test Display Functions
- Test Display Video
Introduction¶
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Test Display Functions¶
Functions are ... Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
def function_name(arg_1, arg_2): pass
Write the functions like this
def my_function(arg_1):
print("arg_1 is: {}".format(arg_1))
Then call them like this
my_function("test")
Test Display Matplotlib¶
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
x = np.linspace(0, 5, 100)
len(x)
# Linear Function (f(x) = y = x)
x1 = x
y1 = x1
# Quadratic Function (f(x) = y = x^2)
x2 = x
y2 = x**2
# Cubic Function (f(x) = y = x^3)
x3 = x
y3 = x**3
Then plot each of the functions
# A figure with one axes and three functions (MATLAB-style)
plt.plot(x1, y1, label='linear')
plt.plot(x2, y2, label='quadratic')
plt.plot(x3, y3, label='cubic')
plt.xlabel('x values')
plt.ylabel('y values')
plt.title("Three Function Plot")
plt.legend()
print('Current Axes: {}'.format(plt.gca()))
print('Current Figure: {}'.format(plt.gcf()))
img_fox = mpimg.imread('img/fox.png')
print('Image Shape: {}'.format(img_fox.shape))
plt.imshow(img_fox)
Test Display YTVideo¶
from IPython.display import YouTubeVideo
# Video: Vectors, what even are they?
# https://www.youtube.com/watch?v=fNk_zzaMoSs&list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab&index=2&t=0s
YouTubeVideo("fNk_zzaMoSs", width=600, height=350, start=0)