import numpy as np
import theano
import theano.tensor as T
Create an expression for the logistic function $s(x) = \frac{1}{1+exp(-x)}$. Plot the function and its derivative, and verify that $\frac{ds}{dx} = s(x)(1-s(x))$.
# Uncomment and run this cell for one solution
#%load spoilers/logistic.py
Calculate the 3rd to 10th terms of the sequence, defined by the recurrance relation $F_n = F_{n-2} + F_{n-1}$, with $F_1=1$ and $F_2=1$.
# Uncomment and run this cell for one solution
#%load spoilers/fib.py
board = theano.shared(np.zeros((100, 100), dtype='uint8'))
initial = np.random.binomial(1, 0.1, size=(100, 100)).astype('uint8')
board.set_value(initial)
# Create a function f that updates board with new values and return the current state
# Uncomment the line below and run for a solution
#%load spoilers/life.py
# After creating your f function, run this cell to animate the output
%matplotlib notebook
import matplotlib.pyplot as plt
from IPython import display
import time
for i in range(50):
plt.gca().cla()
current = f()
plt.imshow(current, interpolation='nearest', cmap='gray')
display.clear_output(wait=True)
display.display(plt.gcf())
time.sleep(0.1)