CME 100 Python Workbook#
This Jupyter Book contains a series of Python exercises aimed at introducing students to scientific computing in the context of CME 100: Vector Calculus for Engineers at Stanford University. The exercises are adapted by Enze Chen, Lecturer in Materials Science and Engineering, from the MATLAB Workbook created by Vadim Khayms, Senior Lecturer in Mechanical Engineering. We hope you will find these exercises useful for your studies!
Important note for students
These pages only have Python, corresponding to the exercises in the original MATLAB Workbook. If you’re looking for the MATLAB exercises, see the document provided in class.
Other FAQs#
What do I install?#
Nothing! Unlike the MATLAB exercises, we’ll be doing everything in the cloud. If you like the sound of this, keep reading the Usage tips for instructions on how to complete and submit your work.
What if I want to use Python for a homework problem?#
If you choose to use Python on the homework, you can start with our homework template. This avoids the hassle of managing your local installation and uses the same Google Colab UI as all the examples.
Does it matter which language I learn?#
Not particularly, as the underlying computing principles and computational thinking are the same. Sure, certain tasks may be easier in one language than in the other as they were developed by different scientific communities, but we anticipate that learning one will serve as a solid foundation for learning all others in your future work.
However, if you strongly prefer to optimize your choice of programming language, we suggest you talk to your friends, major department, and professionals in your field to understand which programming language you’re more likely to encounter in the future.
Do I need CS 106A to do this?#
We don’t think so! The exercises are designed to be well-scaffolded and self-guided, so we hope the workbook is as approachable as possible. Some of the solutions are also quite short, only 3–4 lines of code.
Now, if you’ve taken CS 106A, then certainly that would help with some of the Python syntax and paradigms. Note, however, that we are not going to be writing extensive functions, performing unit tests, handling edge cases, etc.—“programming” in the traditional sense. What we’re doing is closer to scripting (common in engineering, and a subset of programming), which involves writing a short program that solves one task when executed sequentially from top to bottom, without really worrying about the generalizability of our solution. (Which would obviously be important in the real world!)