Shortcut For Markdown In Jupyter Notebook

Posted on  by admin
  • Jupyter Tutorial
  • IPython
  • Jupyter
  • QtConsole
  • JupyterLab

Shortcut For Markdown In Jupyter Notebook Free

Beautiful graphs in notebooks are great, but I want my explanatory text to look good too! Somehow I can’t remember all the Markdown tags, so I created this cheatsheet. Headings: Use #s followed by a. Jupyter Notebook is a powerful tool for data analysis. Here are 28 tips, tricks, and shortcuts to turn you into a Jupyter notebooks power user! Command Mode (press Esc to enable) 2. Edit Mode (press Enter to enable).

  • Jupyter Resources
  • Selected Reading

Markdown cell displays text which can be formatted using markdown language. In order to enter a text which should not be treated as code by Notebook server, it must be first converted as markdown cell either from cell menu or by using keyboard shortcut M while in command mode. The In[] prompt before cell disappears.

Header cell

A markdown cell can display header text of 6 sizes, similar to HTML headers. Start the text in markdown cell by # symbol. Use as many # symbols corresponding to level of header you want. It means single # will render biggest header line, and six # symbols renders header of smallest font size. The rendering will take place when you run the cell either from cell menu or run button of toolbar.

Following screenshot shows markdown cells in edit mode with headers of three different levels.

When cells are run, the output is as follows −

Note that Jupyter notebook markdown doesn’t support WYSWYG feature. The effect of formatting will be rendered only after the markdown cell is run.

Ordered Lists

To render a numbered list as is done by <ol> tag of HTML, the First item in the list should be numbered as 1. Subsequent items may be given any number. It will be rendered serially when the markdown cell is run. To show an indented list, press tab key and start first item in each sublist with 1.

If you give the following data for markdown −

It will display the following list −

Bullet lists

Each item in the list will display a solid circle if it starts with – symbol where as solid square symbol will be displayed if list starts with * symbol. The following example explains this feature −

The rendered markdown shows up as below −

Hyperlinks

Markdown text starting with http or https automatically renders hyperlink. To attach link to text, place text in square brackets [] and link in parentheses () optionally including hovering text. Following screenshot will explain this.

The rendered markdown appears as shown below −

Bold and Italics

To show a text in bold face, put it in between double underscores or two asterisks. To show in italics, put it between single underscores or single asterisks.

The result is as shown below −

Images

To display image in a markdown cell, choose ‘Insert image’ option from Edit menu and browse to desired image file. The markdown cell shows its syntax as follows −

Image will be rendered on the notebook as shown below −

Table

In a markdown cell, a table can be constructed using (pipe symbol) and – (dash) to mark columns and rows. Note that the symbols need not be exactly aligned while typing. It should only take respective place of column borders and row border. Notebook will automatically resize according to content. A table is constructed as shown below −

The output table will be rendered as shown below −

a) reading data and checking sizes

  • We have correct spacing, 0.5 mm
  • y represents the whole diameter of the tube
  • the shapes are right, i.e the rows and columns have correct sizes

b) contour of velocity field

conclusions

  • the water velocity is significantly lower than air velocity
  • water velocity is higher at the left part of the image
  • lower parts of the water are almost not moving
  • one can almost observe the interface between water and air, solely from the velocity distribution

c) quiver and rectangles plot

d) divergence of vector field

divergence is the flux into a volume

The gas is incompressible, for the divergence, this means that its absolute value has to be zero

The sum of the acceleration for the u and v components are thus the negative of the acceleration in the w component. The reason that the code does not compute the real divergence is because we do not take the w-component into account

above I use the gradient operator to solve the problem:

The components of the above equations contains what we need to compute the divergence.

conclusions

  • the divergence is high in the middle, that makes sense, since a wavefront is rushing towards the area
  • other areas has low divergence, not much net volume rusing into area
  • from the plot, one can conclude that the fluids are incompressible under the current environment

e) curl z-component

to get the component of curl normal to the xy-plane:

$gamma$ contains a list of the list containing the partial derivatives for each component.

The difference of the second from the first gives us the result we want.

We have the necessary variables dvdx and dudy from the previous exercise

conclusions

main take-away is again that there is something intersting happening where the wavefront is headed.

to take the curve integral, we can do the following $int_lambda vec{v} cdot dvec{r}$

since we have a constant spacing in the grid of 5mm, we can calculate the curve integral for each side numerically as follows:

where $x_i$ is the points in the rectangle grid in x-direction, and $x_0$ and $x_1$ etc. are constant levels that are not changing because we are doing summations vertically or horizontally in the grid, thus either x or y is constant.

stokes theorem tells us that there is a relation between the line integral and the area-integral:

$int_lambda vec{v} cdot dvec{r} = int_sigma nabla times vec{v} cdot vec{n} quad dsigma$

Shortcut For Markdown In Jupyter Notebook Software

where $times$ is the cross product operator:

and $nabla$ is:

Our area is $0.25mm^2$, since the cells in the grid are squares with $s=0.5$

we have the z-component of the curl from previous exercise. The curl is different for each cell in our grid.

calculation is done with a sum as the direct calculation over

conclusions

  • There is greater circulation around the middle rectangle, which is consistent with the velocity field
  • the high z-components of the curl in previous exercises hinted to high circulation around middle area. Confirmed.
  • low circulations around other rectangles as expected

g ) Gauss’s theorm

Shortcut for markdown in jupyter notebook 2016

calculation of flux through the sides of the rectangle is similar numerically to the circulation, only that u and v are interchanged for each side. example: the flux through r2(green) is decided by u and not v like in the circulation calculation

gauss theorem is a relation between area and volume integrals

numerically, the calculation is similar to the above examples.

Shortcut For Markdown In Jupyter Notebook Example

conclusions

Shortcut For Markdown In Jupyter Notebook Example

  • high flux into middle rectangle makes sense, since the wavefront is heading into the area.