Category Archives: Free Stuff

Python intro

First of all python is free! Then, I think of python as a super cool programming language that is also a super calculator. It allows you to do higher level math calculations but it can also help find cheaper airplane tickets in the Internet (ask me if you’re interested). Here is a short tutorial to get you started with python after you have installed canopy.

Quick start:

  1. Install Enthought Canopy Express from
  2. Open the Canopy editor and create a new file.
  3. Read the following mini tutorial and try some commands in the prompt.
  4. Type in the given equations from 1 to 6 and check the results with print statements. Don’t forget to hit run (Ctr + R or Cmd + R).

mini tutorial continued …

variables in python

you can basically use any typical variable name in python such as ‘perigee’ or ‘radius_earth’. Try to give descriptive variable names so your code is easily readable by others.

assign numerical values to variables

it’s as easy as you’d expect

perigee = 418.0

important note: in python 2 an integer number (such as ’18’) is treated differently than a floating number (such as ‘18.0’). To do math with floating numbers in python 2 you can’t have integers in the mix. So that’s why I usually initialize my integer variables with a ‘.0’ at the end so I won’t get strange results. You should try to see what I mean.

math calculations in python

To do math in python is also very simple and as expected


Rp = perigee + radius_earth
R = a*(1-e**2)/(1+e*cos(nu))

important note: in python the exponent operator is ‘**’ instead of ‘^’ as in other programming languages. Here is a short list of the operators you  can use in python:

print your results

The way you print in python 2 is different from python 3. This example is for python 2:

print 'Period = ',P,' min'

last but not the least: numpy

numpy is a python library that helps you do math. You can read more about it here:

For now you just need to import this python library and use it blindly. On the first line of your script type:

from numpy import *

this will import all the functionality of numpy into your python script. For this tutorial it’s specially useful to be able to use the constant ‘pi’ and also for the function ‘cos’. Otherwise you would have to make your own ‘pi’ and ‘cos’.

Here is the source code to make the magic happen:

#iss orbital speed and period
from numpy import *

perigee = 418.0 #km
apogee  = 426.0 #km
radius_earth = 6371.0 #km
mu_earth = 3.986e5 # km^3/s^2

Rp = perigee + radius_earth
Ra = apogee  + radius_earth

print 'Radius Perigee: ', Rp, 'km'
print 'Radius Apogee : ', Ra, 'km'

# 1) eccentricity
e = (Ra - Rp)/(Ra + Rp)
print 'eccentricity: ', e

# 2) semimajor axis
a = (Ra+Rp)/2.0
print 'a =', a, ' km'

# 3) mechanical energy
epsilon = -mu_earth/(2*a)

# 4) altitude at nu=90deg
nu = 90*pi/180
R = a*(1-e**2)/(1+e*cos(nu))

print 'R =', R, 'km'

# 5) orbital speed
V = sqrt(2*(mu_earth/R + epsilon))
print("V = {:2f} km/s".format(V))

# 6) orbital period
P  = 2*pi*sqrt(a**3/mu_earth)
print("P = {:.2f} sec = {:.2f} min = {:.2f} hr".format(P, P/60, P/60/60))

SVN 1.7 for Mac OS Lion

Mac OS Lion comes with SVN 1.6 installed by default. But I needed to install SVN 1.7 to work on a project that uses SVN1.7.

Here is what I did to come trough:

I like using the SVN GUI tool svnX. The current version of the program is: svnX 1.3.3 ( Take a look and download it if you like what you see. It’s free and after you learn how to use it you will love it!. Download here.

The latest version of subversion is 1.7.5 (as today) and it can be found in

But svnX 1.3.3 is compatible with svn 1.7.4 so we are going to install that rather that the latest svn (1.7.5). Also I because I found some problems with svn 1.7.5.

1) Create a folder where you will put the svn 1.7.4 files. Download and extract the source.

$mkdir ~/Downloads/svn
$cd ~/Downloads/svn
$curl > ./subversion-1.7.4.tar.gz
$tar -xvjf subversion-1.7.4.tar.bz2  //to uncompress a bzip2 tar file: .tbz or .tar.bz2
$cd subversion-1.7.4

Configuration setup, Building and install the binary

$./configure --prefix=/usr/local
$sudo make install

It should now be installed in /usr/local/bin/svn. Check if it got correctly installed.

$/usr/local/bin/svn --version


  • You may try to install version 1.7.5 at your risk. Replace ‘subversion-1.7.5.tar.bz2’ with the latest version you find in the above link on the ‘curl’ command.
  • You can also install the latest version of subversion using MacPorts


Free Online Classes

Linear Algebra

By Gilbert Strang – MIT


  1. Positive definite matrices K = A’CA
  2. One-dimensional applications: A = difference matrix
  3. Network applications: A = incidence matrix
  4. Applications to linear estimation: least squares
  5. Applications to dynamics: eigenvalues of K, solution of Mu” + Ku = F(t)
  6. Underlying theory: applied linear algebra
  7. Discrete vs. continuous: differences and derivatives
  8. Applications to boundary value problems: Laplace equation
  9. Solutions of Laplace equation: complex variables
  10. Delta function and Green’s function
  11. Initial value problems: wave equation and heat equation
  12. Solutions of initial value problems: eigenfunctions
  13. Numerical linear algebra: orthogonalization and A = QR
  14. Numerical linear algebra: SVD and applications
  15. Numerical methods in estimation: recursive least squares and covariance matrix
  16. Dynamic estimation: Kalman filter and square root filter
  17. Finite difference methods: equilibrium problems
  18. Finite difference methods: stability and convergence
  19. Optimization and minimum principles: Euler equation
  20. Finite element method: equilibrium equations
  21. Spectral method: dynamic equations
  22. Fourier expansions and convolution
  23. Fast fourier transform and circulant matrices
  24. Discrete filters: lowpass and highpass
  25. Filters in the time and frequency domain
  26. Filter banks and perfect reconstruction
  27. Multiresolution, wavelet transform and scaling function
  28. Splines and orthogonal wavelets: Daubechies construction
  29. Applications in signal and image processing: compression
  30. Network flows and combinatorics: max flow = min cut
  31. Simplex method in linear programming
  32. Nonlinear optimization: algorithms and theory

Artificial Intelligence

By Sebastian Thrun & Peter Norvig – Stanford

Machine Learning

By Andrew Ng – Stanford

Other great resources