Perform numerical experiments in Emacs Org mode
During the years of my PhD research, a numerical experiment for verifying theoretical concepts required several stages, which were accomplished with different tools or in different environments.
- Program implementation
- Activity: Write and debug the source code for the numerical algorithm.
- Tool and environment: Emacs editor or some IDE, such as MATLAB, Visual Studio, etc.
- Data generation
- Activity
- Generate configuration or input files in batch using Linux commands.
- Run the test program which produces a bunch of data files (reference).
- Tool and environment: Linux command executed in a terminal, such as Konsole.
- Activity
- Data transformation
- Activity: use Bash, Awk and Linux commands to extract and transform interested quantities from the data files.
- Tool and environment: Write the scripts in Emacs, execute Linux commands in the terminal
- Postprocessing and visualization
- Activity
- Write and run Octave scripts to postprocess data files.
- Plot figures and save them to image files.
- Image files are converted to different formats using Ghostscript.
- Create a spreadsheet for recording test conditions, manual computation and data visualization.
- Tool and environment: edit and run Octave scripts in Emacs, image format conversion via executing
gs
command in the terminal, spreadsheet in LibreOffice Calc
- Activity
- Summary
- Activity: Write test report which includes manual insertion of figures generated by Octave or spreadsheet, copy recorded test conditions and conclusions from spreadsheet.
- Tool and environment: LibreOffice Writer
Now, I have switched to Emacs Org mode, which provides a basic markup language support and a powerful LaTeX export backend. Furthermore, with the help of its babel extension, I am able to start interactive sessions to write and run multilingual source code, which include but not limited to math computation (both numerical and symbolic) and visualization via Octave and Maxima, rigorous mathematical drawing via Asymptote, Bash and Python scripts, Linux command execution, etc. In this way, all the previous stages involved in a numerical experiment can be incorporated into Emacs. Among them, stage 2~5 can be coalesced into Org mode. This will greatly reduce the burden of switching among different tools and environments, which spares my brain more space for meaningful and in-depth thinking.