Code Nummies are bite sized programming challenges, which focus on a specific topic from numerics, computational pyhsics or computer science. Every Nummy will explain that very topic and provide instructions on how to tackle the problem as well as some code to get you kickstarted. This includes a set of tests (to verify your solution). Most Code Nummies are provided in Python and C++.
This is my entry for the #SoME1 Summer of Math 2021.
- Correlation coefficient
- Linear Interpolation
- Explicit Euler Integration
- Swapping Variables
- Numerical root finding
- Pseudo Random Number Generators
- The Travelling Salesman Problem
You can download a Nummy either via the Code
-> Download ZIP
button on github, or
via git clone.
Most Code Nummies provide a Python and C++ project. You can choose in which language you want to take the problem.
For Python PyCharm is recommended as an IDE.
- Open the
python
folder in PyCharm. - Go to settings -
Project: Python
-Project Structure
. Mark thesrc
folder as source, thetests
folder as tests. Close settings. - In the top right, click on
Edit configuration
. Click on the+
to create a pytest target. Selectscript path
and select thepython/tests
folder. - Press
ctrl + F5
to execute the tests.
Navigate to the folder of the Nummy you want to exercise and type
cmake .
in a terminal. CMake supports multiple IDEs, see the list of generators.
- Windows: Microsoft Visual Studio community edition
- Windows, Mac, Linux: Clion
- Windows, Mac, Linux: Visual Studio code
- Windows, Mac, Linux: Code::Blocks
When learning passively, it happens to me more than often that I say "yes, I would have done it in a similar way". Most of the time, I am missing out on the crucial parts. The tricky questions will only pop up, once I get my hands dirty and craft the solution on my own. If you have similar experience, Code Nummies will be very helpful to you. The idea is to get proper hands-on experience and craft the solution on your own.
To smooth out the experience, the Code Nummies will offer a set of instructions and provide everything to get started. Tests are included and will guide the implementation. Most Nummies also contain some applications, which will provide nice results.
All Code Nummies have a dedicated branch in git, called solution
, where you can peek for a solution.
The name is a mashup of "Code Kata" and "Numerics".
A Code Nummy will take around 30 minutes to complete. Of course individual completion time will vary, depending on the Nummy difficulty and personal experience. If it takes you longer than an hour, take a step back, get some time off the screen. Most likely you were stuck in a dead end.
There are awesome tutorials available on how to get started with (scientific) programming. My personal advice is to just get started and get your hands dirty. While the Code Nummies relief you of the burden of thinking about most of the frameworks and test cases, some fundamental understanding of how programming works is unfortunately required. But I am sure that you can easily get up to speed.
If you have never touched Python nor C++, I suggest to start with Python as it makes starting from scratch easier. Regardless of the language, you do not have to understand all the internal details, as long as you have a broad understanding of the algorithm. We are doing math and numerics here, and not strict software development. :)
C++ is a very powerful, multi-paradigm, portable programming language. Knowing your way around C++ is a very handy skill. Also, most large scale numerical simulations which run on clusters are written in C++.
Python is an easy to use and portable programming language. It offers numerous packages for various applications. Thus it is easy to see results quickly and an awesome way to get started.
There is nothing that will stop you to tackle the problem in matlab, cobol, brainfuck2d or any other language/tool of your choice. The tests are created with readability in mind, so you should be able to adapt them easily in your preferred language. Of course, language syntax and some semantic details will be different. However, the transition should be straightforward.
If you have a solution in a specific tool, please consider creating a Pull Request. Others might be interested as well. Additionally, it would be great to see the Code Nummies grow by the community.
Thank you for taking a detailed look at the provided code and instructions. Please create an issue in the respective repository. If you already know a fix for the issue, please create a pull request . I am happy to improve the Nummies whenever possible.