Coding in Python

During the rocket campaign we will be using the programming language Python to process and analyze the recorded data, and ahead of the campaign we will use it to simulate the rocket trajectory. A full course in Python programming is outside the scope of this article, but here we have gathered some useful resources (all links open in a new tab):

  • For those familiar with MATLAB, Perl, Java, C or similar, programming in Python is mostly just a matter of getting used to another syntax. Examples include: lines need not be terminated with semicolons; whitespace indentation is used to delimit blocks, rather than curly brackets or keywords; and variables are not directly assigned a type. However, as detailed by Trey Hunner, Python has a somewhat idiosyncratic approach to for-loops.
  • Numfys.net is an excellent resource for numerical physics projects written in Python. The site is run by the Department of Physics at NTNU (Norwegian University of Science and Technology).

Lastly, some references to popular libraries:

  • Math. Provides common mathematical constants like pi and e (\pi and Euler’s constant, respectively), as well as the trigonometric functions, logarithms and the square root.
  • NumPy. Introduces multidimensional arrays into Python, and extends the definition of many functions from the math-library to accept arrays as arguments.

<< Previous pageContent – Glossary >>


This article is part of a pre-course program used by NAROM in Fly a Rocket! and similar programs.