My Math Notes
  • Home
  • Calculus Notebooks
    • Backpropagation
    • Optimizing Functions of One Variable: Cost Minimization
    • Differentiation in Python: Symbolic, Numerical and Automatic
    • Optimization Using Gradient Descent: Linear Regression
    • Optimization Using Gradient Descent in One Variable
    • Optimization Using Gradient Descent in Two Variables
    • Neural Network with Two Layers
    • Regression with Perceptron
    • Classification with Perceptron
    • Optimization Using Newton's Method
    • Fitting the distribution of heights data
    • Gradient descent in a sandpit
    • The Sandpit - Part 2
    • The Sandpit
  • Deeplearning.ai
    • Calculus
    • Linear Algebra
    • Probability and Statistics
  • Imperial College
    • Linear Algebra
    • Multivariate Calculus
    • PCA
  • Linear Algebra Notebooks
    • Single Perceptron Neural Networks for Linear Regression
    • Single Perceptron Neural Networks for Linear Regression
    • Eigenvalues and Eigenvectors
    • Gram-Schmidt process
    • Identifying special matrices
    • PageRank
    • Reflecting Bear
    • Linear Transformations
    • Matrix Multiplication
    • Solving Linear Systems: 2 variables
    • Vector Operations: Scalar Multiplication, Sum and Dot Product of Vectors
  • PCA notebooks
    • Distances and Angles between Images
    • K nearest Neighbors Algorithm
    • Week 1: Mean/Covariance of a data set and effect of a linear transformation
    • Orthogonal Projections
    • Principal Component Analysis (PCA)
    • Demonstration of PCA
  • Previous
  • Next
  • The Sandpit
    • Jacobian
    • Depth Only
    • More Sandpits

The Sandpit¶

Jacobian¶

The supervisor of a building site has dropped their mobile phone into a pit with an uneven floor, and it has rolled to the lowest point. To make matters worse, the pit has subsequently been filled with sand such that the phone is covered and cannot be seen. To find where in the pit their phone is, the supervisor has crafted a ‘dip-stick’ with a head designed to measure the slope of the floor if it is poked straight down through the sand.

By clicking on any point in the sandpit, and thereby measuring the negative of the Jacobian, $-\mathbf{J} = -\nabla f(\mathbf{x})$, at that point, try and find the supervisor's phone. Try to do this with as few dips as possible - the supervisor has calls to make!

There is no grading for this exercise, when you are finished, close this tab to return to the course.

Run the following cell to start the example.

In [4]:
Copied!
# Click into this cell and press [Shift-Enter] to start.
%run "readonly/sandpit-exercises.ipynb"
sandpit_intro()
# Click into this cell and press [Shift-Enter] to start. %run "readonly/sandpit-exercises.ipynb" sandpit_intro()
/opt/conda/lib/python3.6/site-packages/IPython/core/magics/pylab.py:160: UserWarning: pylab import has clobbered these variables: ['imread']
`%matplotlib` prevents importing * from pylab and numpy
  "\n`%matplotlib` prevents importing * from pylab and numpy"
No description has been provided for this image
A Jupyter Widget

Depth Only¶

Before trying the dip-stick that measures the Jacobian, the supervisor had contructed a dip-stick that can only measure the depth on each dip.

Without information about the Jacobian, try and find the supervisor's phone. This should certainly be more difficult!

In [5]:
Copied!
# Click into this cell and press [Shift-Enter] to continue.
%run "readonly/sandpit-exercises.ipynb"
sandpit_depth_only()
# Click into this cell and press [Shift-Enter] to continue. %run "readonly/sandpit-exercises.ipynb" sandpit_depth_only()
/opt/conda/lib/python3.6/site-packages/IPython/core/magics/pylab.py:160: UserWarning: pylab import has clobbered these variables: ['imread']
`%matplotlib` prevents importing * from pylab and numpy
  "\n`%matplotlib` prevents importing * from pylab and numpy"
No description has been provided for this image
A Jupyter Widget

More Sandpits¶

In a nearby building site, another phone has been dropped into a pit. Use the gradient dip-stick and help out the supervisor.

You can run this example as many times as you like for a randomly generated sandpit.

In [3]:
Copied!
# Click into this cell and press [Shift-Enter] to continue.
%run "readonly/sandpit-exercises.ipynb"
sandpit_random()
# Click into this cell and press [Shift-Enter] to continue. %run "readonly/sandpit-exercises.ipynb" sandpit_random()
/opt/conda/lib/python3.6/site-packages/IPython/core/magics/pylab.py:160: UserWarning: pylab import has clobbered these variables: ['imread']
`%matplotlib` prevents importing * from pylab and numpy
  "\n`%matplotlib` prevents importing * from pylab and numpy"
No description has been provided for this image
A Jupyter Widget
In [ ]:
Copied!


Documentation built with MkDocs.

Keyboard Shortcuts

Keys Action
? Open this help
n Next page
p Previous page
s Search