Learning Resources

Learning by doing!

Online

Reading (in the future)

  • Al Sweigart, "Automate the Boring Stuff with Python", https://automatetheboringstuff.com
  • Mark Lutz, "Python Pocket Reference" (250 pages)
  • Mark Lutz, "Learning Python" (1600 pages!)

Ecosystem

Nbviewer

  • can render any ipython/jupyter notebook from public github repository

Course assignments will be distributed through: http://nbviewer.ipython.org/github/oseledets/nla2015/blob/master/table_of_contents.ipynb

Github

Our course repository - NLA 2015: https://github.com/oseledets/nla2015 (clone it to stay updated on new materials)

IDE

  • notebook (REPL)
  • IDLE (terminal, shipped with python distribution)
  • qtconsole (terminal, shipped with anaconda)
  • Spyder (IDE, shipped with anaconda)
  • Python Tools for Visual Studio
  • PyCharm
  • Atom, Sublime Text, Vim, Notepad++, etc.

IPython vs Jupyter

"IPython 3 was the last major monolithic release of IPython"

  • Idea: separate language-agnostic components, independent lifecycles
  • IPython.kernel ⇒ jupyter_client, ipykernel
  • Code is basically the same

More details at:

Jupyter / IPython

Key components:

  • kernels (ipython is default)
  • notebook
  • console, qtconsole

"IPython is the reference Jupyter kernel, providing a powerful environment for interactive computing in Python"

Using ipython/jupyter

  • notebook runs on top of ipython kernel
  • notebook is divided into code cells
  • cell can be of different type (code cell, markdown cell, etc.)
  • edit mode (inside cell) / command mode (outside cell)
  • for quick navigation and hotkeys see Help - Keyboard Shortcuts
    • you might want to remember at least these: a, b, c, x, y, z, v, m, l
    • CTRL+/ or Command+/ for commenting
    • CTRL+[] or Command+[] for indentation
    • CTRL+SHIFT+"-" for splitting, SHIFT+M for merging cells
  • examples of markdown and tex can be found in any lecture notebook (just double-click any cell)

Markdown text with formulas inline : $a_{ij} = g_{i+j}$

Centered formula: $$ a_{ij} = \frac{g_{i+j}}{L^2} $$

How to work with home assignments

  • divide into blocks
  • each block - separate task
  • use sub-heading and markdown to explain things

Assignments must be submitted to Stellar http://stellar.mit.edu/.

Our course page: https://stellar.mit.edu/S/project/numericallinalg/

Programming in python

writing code

Understanding the code

Usually code in python is slef-explanatory. However, if you don't understand something it might be helpful to vizualize it with Python Tutor:

In [1]:
from IPython.display import HTML
HTML("<iframe src=http://pythontutor.com/visualize.html#code=%23assigning+numbers%0Aa+%3D+b+%3D+c+%3D+3%0Ab+%3D+4%0A%0A%23list+(un-hashable+type%29%0Amy_own_list+%3D+%5B1,+3,+5,+6%5D%0Anew_list+%3D+my_own_list%0Anew_list%5B1%5D+%3D+10%0A%0A%23tuple%0Amy_own_tuple+%3D+(1,+2,+4,+5%29%0Anew_tuple+%3D+my_own_tuple%0A%0Anew_tuple%5B1%5D+%3D+3&mode=display&origin=opt-frontend.js&cumulative=false&heapPrimitives=false&textReferences=false&py=2&rawInputLstJSON=%5B%5D&curInstr=0 width=990 height=600></iframe>")
Out[1]: