43. More on Python and using Jupyter notebooks#
43.1. Guides in this Jupyter Book#
The following guides are available in this Jupyter Book as notebooks:
43.2. What you should know about Python and using Jupyter notebooks#
Know how to switch between
CodeandMarkdowncells and how to run them (shift-ReturnorRunbutton)Basics of Python evaluation and printing
string concatenation
exponentiation with
**use of fstrings
Importing numpy and basic functions (sqrt, exp, sin, \(\ldots\))
numpy arrays using
arange(min, max, step)
Getting help via Google (or alternative): StackOverflow and manuals
Defining functions in Python
def my_function(x):\(\longleftarrow\) semicolon and then indented linesposition vs. keyword argument and defaults
shift + tab + tabto reveal definitions
Plotting with Matplotlib
Standard sequence for plot: data \(\longrightarrow\) make figure \(\longrightarrow\) add subplots \(\longrightarrow\) make plot
dressing up and saving a plot
names for the figure and axis objects are our choice
Numpy linear algebra
defining a matrix and finding its shape or particular elements
matrix (or vector) operations: multiplying them with @, transpose, trace, inverse, eigensolution