Stand With Ukraine

Thursday, December 24, 2009

Mireille Mathieu

J'aime bien cette chanteuse, et ici sont les liens à mes chansons préférés.
http://www.youtube.com/watch?v=78a2NYmgGZI
http://www.youtube.com/watch?v=W-4g-pXZ8AQ
http://www.youtube.com/watch?v=-NBMGID3HaY

Gravity waves

Gravity waves.

Gravity waves in a system with rotation.

Gravity waves in a system with rotation. (So called geostrophic adjustment). Here is an analytic solution expressed in terms of the Bessel functions (see Gill, "Atmosphere and ocean dynamics" 1982).


All the pictures were created using python library matplotlib and converted to gif using the command convert from imagemagick.

Wind velocity vector, at a given point (sea breeze modelling)

Rotation of wind vector at a given point given by a solution of 2 dimensional linearized system of Euleur's equations. Taking into account only the pressure and Coriolis forces.

Wednesday, December 23, 2009

Permutations

It is time to write something about programming. Here I want to present a function implemented in python which returns the list of permutations of the given string.

#return the list of the permutations of s
def get_permutations(s):
result = []
if len(s) == 1:
result.append(s)
return result

for i in range(0,len(s)):
s_tmp = s.replace(s[i],s[0])[1:]
subset_permuts = get_permutations(s_tmp)
for perm in subset_permuts:
result.append( s[i] + perm )
return result

It takes 16.5364508629 seconds in order to find the permutations of the string '1234567890'.
For the code

print get_permutations('123');
print 'Execution time: ', time.time() - t0, ' s'

The output is following:
['123', '132', '213', '231', '321', '312']
Execution time: 5.88893890381e-05 s