I wrote the following programs to compare the speed of python with c/fortran.
To get the time used by the programs I used the \"time\" command. All the
programs compute the sq
probably you can.
There are a number of math libraries for python which probably can do the task you want quite a bit more efficient.
Since the python ranges work quite different than c loops, I would try to unroll these loops first.