Cheat Sheet Jupyter Notebook

broken image


Jupyter (IPython) Notebook Cheatsheet 2 About Jupyter Notebooks The Jupyter Notebook is a web application that allows you to create and share documents that contain executable code, equations, visualizations and explanatory text. Holoviews cheatsheet. In 7: import pandas as pd import numpy as np import holoviews as hv from holoviews import opts from.

IPython / Jupyter¶

  • Using IPython makes interactive work easy.
    • Better shell
    • Notebook interface
    • Embeddable kernel
    • Parallel python

Jupyter Notebook Cheat Sheet This Jupyter Notebook cheat sheet will help you to find your way around the well-known Notebook App, a subproject of Project Jupyter. You'll probably know the Jupyter notebooks pretty well - it's one of the most well-known parts of the Jupyter ecosystem! JUPYTER NOTEBOOKS CHEATSHEET Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and explanatory text. See full documentation for Jupyter Notebooks Installing Anaconda Distribution installs Jupyter Notebook Windows.

IPython shell shortcuts¶

  • TAB expansion to complete python names and file paths
  • ~ and * directory / file expansion
  • many 'magic' methods:

Help¶

%pdoc%pdef%psource Capture one pro 20.1. for docstring, function definition, source code only.

Run¶

To run a program directly from the IPython console:

%run has special flags for timing the execution of your scripts (-t) or for running them under the control of either Python's pdb debugger (-d) or profiler (-p):

Other Commands¶

  • %reset is not a kernel restart
  • Restart with Ctrl+. in 'qtconsole'
  • import module ; reload(module) to reload a module from disk

Debugging¶

OS Commands¶

History¶

GUI integration¶

Start with ipython --gui=qt or at the IPython prompt:

Arguments can be wx, qt, gtk and tk.

Matplotlib / pylab graphics in an iPython shell¶

Start with: ipython --matplotlib ( or --matplotlib=qt etc..)

At the IPython prompt:

%pylab makes the following imports:

At the command prompt:

alternative: --matplotlib inlineor within IPython:

To embed plots, SVG or HTML in qtconsole, call display:

IPython Notebook web-based interface¶

  • Start with: ipython notebook and switch to browser
  • Keyboard shortcuts:
    • Enter to edit a cell
    • Shift + Enter to evaluate
    • Ctrl + m or Esc for the 'command mode'
Jupyter notebook cheat sheet github

In command mode:

Papermill is a tool for parameterizing and executing Jupyter Notebooks.

This document will be available to you during tests and exams

7.1. Table of Contents¶

Notebook

7.2. Numeric¶

7.3. Basic plotting functions¶

7.4. Symbolic manipulation¶

7.4.1. Imports¶

Capture 1 free download. Symbol definitions

Example controller and system

7.4.2. Working with rational functions and polynomials¶

We often want nice rational functions, but sympy doesn't make expressions rational by default

$$frac{5 K_{c} left(s tau + 1right)}{s tau left(10 s + 1right)^{2}} + 1$$

The cancel function forces this to be a fraction. collect collects terms.

Cheat Sheet Jupyter Notebook
$$frac{5 K_{c} + 100 s^{3} tau + 20 s^{2} tau + s left(5 K_{c} tau + tauright)}{100 s^{3} tau + 20 s^{2} tau + s tau}$$
Lab

In command mode:

Papermill is a tool for parameterizing and executing Jupyter Notebooks.

This document will be available to you during tests and exams

7.1. Table of Contents¶

7.2. Numeric¶

7.3. Basic plotting functions¶

7.4. Symbolic manipulation¶

7.4.1. Imports¶

Capture 1 free download. Symbol definitions

Example controller and system

7.4.2. Working with rational functions and polynomials¶

We often want nice rational functions, but sympy doesn't make expressions rational by default

$$frac{5 K_{c} left(s tau + 1right)}{s tau left(10 s + 1right)^{2}} + 1$$

The cancel function forces this to be a fraction. collect collects terms.

$$frac{5 K_{c} + 100 s^{3} tau + 20 s^{2} tau + s left(5 K_{c} tau + tauright)}{100 s^{3} tau + 20 s^{2} tau + s tau}$$

In some cases we can factor equations:

$$frac{5 K_{c} + 100 s^{3} tau + 20 s^{2} tau + s left(5 K_{c} tau + tauright)}{s tau left(10 s + 1right)^{2}}$$

Obtain the numerator and denominator:

$$left ( 5 K_{c} + 100 s^{3} tau + 20 s^{2} tau + s left(5 K_{c} tau + tauright), quad 100 s^{3} tau + 20 s^{2} tau + s tauright )$$

If you want them both, you can use

$$left ( 5 K_{c} + 100 s^{3} tau + 20 s^{2} tau + s left(5 K_{c} tau + tauright), quad 100 s^{3} tau + 20 s^{2} tau + s tauright )$$

Convert to polynomial in s

Once we have a polynomial, it is easy to obtain coefficients:

$$left [ 100 tau, quad 20 tau, quad 5 K_{c} tau + tau, quad 5 K_{c}right ]$$

Calculate the Routh Array

$$left[begin{matrix}100 tau & 5 K_{c} tau + tau20 tau & 5 K_{c}- 25 K_{c} + tau left(5 K_{c} + 1right) & 05 K_{c} & 0end{matrix}right]$$

To get a function which can be used numerically, use lambdify:

7.4.3. Functions useful for discrete systems¶

Write in terms of positive powers of (z):

Write in terms of negative powers of (z):

Inversion of the (z) transform

$$left [ 0, quad 1, quad 1, quad 1, quad 1, quad 1, quad 1, quad 1, quad 1, quad 1right ]$$

7.5. Equation solving¶

7.5.1. Symbolic¶

$$left { x : - a, quad y : a + 2, quad z : -2right }$$

7.5.2. Numeric sympy¶

$$left[begin{matrix}-2.219107148913752.21910714891375end{matrix}right]$$

7.5.3. Numeric¶

7.6. Matrix math¶

Cheat Sheet Jupiter Notebooks

7.6.1. Symbolic¶

Creation

$$left[begin{matrix}G_{11} & G_{12}G_{21} & G_{22}end{matrix}right]$$

Determinant, inverse, transpose

$$left ( G_{11} G_{22} - G_{12} G_{21}, quad left[begin{matrix}frac{G_{22}}{G_{11} G_{22} - G_{12} G_{21}} & - frac{G_{12}}{G_{11} G_{22} - G_{12} G_{21}}- frac{G_{21}}{G_{11} G_{22} - G_{12} G_{21}} & frac{G_{11}}{G_{11} G_{22} - G_{12} G_{21}}end{matrix}right], quad left[begin{matrix}G_{11} & G_{21}G_{12} & G_{22}end{matrix}right]right )$$

Math operations: Multiplication, addition, elementwise multiplication:

$$left ( left[begin{matrix}G_{11}^{2} + G_{12} G_{21} & G_{11} G_{12} + G_{12} G_{22}G_{11} G_{21} + G_{21} G_{22} & G_{12} G_{21} + G_{22}^{2}end{matrix}right], quad left[begin{matrix}2 G_{11} & 2 G_{12}2 G_{21} & 2 G_{22}end{matrix}right], quad left[begin{matrix}G_{11}^{2} & G_{12}^{2}G_{21}^{2} & G_{22}^{2}end{matrix}right]right )$$

Cheat Sheet Jupiter Notebook Download

7.6.2. Numeric¶

Jupyter Notebook Tutorial

Creation

Jupyter Lab Cheat Sheet

Determinant, inverse, transpose

Jupyter Notebook Markdown Cheat Sheet

Math operations: Multiplication, addition, elementwise multiplication:





broken image