This post is a part of the 2017 CQuIC computing summer workshop tutorial materials with audio records available.
When designing the CQuIC summer 2017 IT workshop, we as the organizers have the following in mind:
- Only teach some basic scientific computing skills that we think are crucial for students to be ready for doing research projects using current IT techniques.
- Instructors will only teach what they are familiar and comfortable with, and we focus on using one programming language for numerical and algebra calculations.
- Let students work on their own, and instructors should never touch students’ keyboards.
Obviously, we are also missing some maybe important points given the situation above. Please comment below so that I can on behalf of other instructors to collect and answer your questions.
Practical suggestions on using Matlab:
- About visualization: The default color map in recent Matlab versions are pretty good already, but the common mistakes in making plots with Matlab is mostly on fontsize and curve thickness and so on. Therefore, it might be good to learn to use the following functions and parameters:
'linewidth',2or similar definition when you call the
set(gca,'fontsize',16)or similar to uniformally define the fontsize of your axis label and titles.
learn to use tools like matlab2tikz to export figures into LaTeX supported TikZ code and the like. This makes it easy to unify fonts in the plots and the main text ready for publications.
About parallel computing: The default
parforfunction is pretty good on handling up-to-12-core parallel computing jobs. If you encounter “lose of connection to workers” error, you may want to set
falsewhen you define the parpool.
Other tips on using Jupyter notebook
- You can use other languages in Jupyter notebook–beside Python and include Matlab. As a fact, the word Jupyter comes from modern programming languages including Julia, Python and R. You can define the kernel by selecting the kernel you need under the
kernelmenu after installing the necessary kernel packages. The full list of community-supported kernel can be found here.
- It is possible to run different languages in one notebook. The easiest way is to execute bash commands to call other language-based commands inside of the notebook. But different kernel define different syntax to do so. One example of running variant languages on a Julia kernel can be found here.
On choosing your daily programming languages
- If you don’t mind the commercial nature, Matlab is actually pretty on numerical calculations and better than Python in common scenarios. Python only get some advantage when you want to use a lot of cores to do parallel computing. A good benchmark on those common modern programming languages can be found on the Julia website and plotted here.
- Another note on Matlab is that it also has a powerful Symbolic Math Toolbox and two versions of interactive notebook interfaces–one is the old fashion notebook based on MuPAD and the other one is called Live Editor. Both are similar to Jupyter notebook and Mathematica.
- If you collaborate with other people, it would be the best to use the common language that you and your collaborators are all familiar with.
- Once you’ve mastered one programming language, try something new and use languages for what they are good for.
Things might be touched in doing the followup projects
- Unit tests and other test techniques in various languages.
- For Matlab users, there are three types of Unit Test styles–one is script-based unit tests, one is function-based unit tests, and the other one is class-based unit tests under the testing framework of Matlab.
- For Python users, there is also an Unit Test Framework for Python 3 and an Unit Test Framework for Python 2.
- For Julia users, linked is the doc for Unit Testing.
- More details on documenting when programming in your preferred languages.
- For Matlab users, you can write help documentations in the code and display your documentations as an interactive Live Script or HTML page.
- For Python users, documenting can be done using Sphinx and exporting to LaTeX, HTML, PDF and other formats or hosting on readthedocs.org website.
- For Julia users, you can find the documentation guidelines and the Julia-Sphinx and JuliaDoc extensions for various styles of documenting and uploading docs to readthedocs.org. One example of programming in Julia can be found here.
- Continuous integration (like travis-CI) and virtualizations to automate some testing and migrating tasks.
- Permanent storage and generating DOIs for your code and data.