Python
Submodules
Intro to Jupyter Notebook and Pynamics
import pynamics from pynamics.system import System from pynamics.frame import Frame import sympy system = System() pynamics.
Go to Intro to Jupyter Notebook and PynamicsTutorials
Course-specific Python Packages
Install additional software packages. In Windows, go to the search bar and type “anaconda”.
Go to Course-specific Python PackagesDownload and Link to Python Packages
Say you want to run a python package from source using a git repository.
Go to Download and Link to Python PackagesGoogle Colab Documentation
Resources Introduction to Colab and Python Getting Started with Google Colab External data: Local Files, Drive, Sheets, and Cloud Storage How to Connect Google Colab with Google Drive Embedding your image in google colab markdown What is Google Colab “Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud.
Go to Google Colab DocumentationInstalling Anaconda
Introduction Anaconda is a distribution of Python that includes the ability to manage packages using the conda package manager as well as the ability to create and manage environments, or collections of packages that work together.
Go to Installing AnacondaSympy Example
import sympy a = sympy.Symbol('a') b = sympy.Symbol('b') x = sympy.
Go to Sympy ExampleUsing Jupyter Notebook
About Jupyter Jupyter notebook is a useful browser-based IPython editor that provides inline documentation via markdown and inline plotting functionality for a one-stop-shop coding and documentation experience.
Go to Using Jupyter NotebookOthers
Advanced Data Types
There are a number of advanced data types native to Python.
Go to Advanced Data TypesConditional Statements
Conditional Statements use the keywords if, then, and else to perform different logic depending on the statements that are evaluated.
Go to Conditional Statementsfunctions and arguments
Functions The structure of a function is: def my_function_1(my_variable_1,my_variable_2): result = my_variable_1+my_variable_2 return result Where my_function_1 is the function, and my_variable_1 and my_variable_2 are the “arguments”.
Go to functions and argumentsIntro to Python
One thing I really like about python is that it is based on good programming practice .
Go to Intro to PythonLoops
Introduction Loops are used to repeat code over a fixed number of cycles, or indefinitely based on logic.
Go to LoopsOperators & Operations
Basic Operators Operators in Python are just symbols that “operate” on one or more values.
Go to Operators & OperationsPackages in Python
Introduction The most important packages that I use when creating python code are those packages which make a python more Matlab-like.
Go to Packages in PythonPlotting in 3D
%matplotlib inline Visit this matplotlib tutorial on 3d Plotting Another useful reference import matplotlib.
Go to Plotting in 3DPython Development
Now What? More Python Making your programs for others Releasing your code Licensing Collaborating Testing / Building Imports Imports should always be written at the top of the file, after any module comments and docstrings.
Go to Python DevelopmentUpdating Python Packages
There are several Python packages that are in active development for the purposes of this class.
Go to Updating Python PackagesMain Python References
The Hitchiker’s guide to Python
Important Topics for This Class
- Python Style: https://docs.python-guide.org/writing/style/
- Classes
Module-Specific References
- Plotting with Matplotlib
- pyplot tutorial for the basics of plotting similarly to matlab.
- overview of plotting paradigms
- Numpy has amazing documentation. The highlights include a quickstart guide with the bare essentials, a more complete overview, and a handy guide for matlab pros who want to know how to convert their matlab knowledge.
- Scipy documentation
- Sympy documentation