from math import sin , cos , pi , sqrt # some sample values n_Tc = 32000 n_Tm = 44000 # taken from an "ideal" mono-atomic VX3 dim_x , dim_y = 3 , 2 delta = 0.88 theta = 8 * pi bars = 80 # calculations alpha = sqrt ( float ( n_Tc ) / float ( n_Tm )) a_delta = ( 1 / delta + alpha ) ** 2 b_delta = ( 1 / delta + 1 / alpha ) ** 2 print '| 6 3 0 -3 -6 -9 va t vb -9 -6 -3 0 3 6 |' print '| ----+----+----+----+----+----+ ------ | ------- | ------ +----+----+----+----+----+---- |' for i in range ( bars + 1 ): t = theta * float ( i ) / float ( bars ) # Dupont's formulae va = cos ( t * dim_x ) * a_delta + cos ( t ) * delta vb = sin ( t * dim_y ) * b_delta + sin ( t ) * delta # fancy display bars sa = int ( va / 18 * 30 + 15 ) * '#' sb = int ( vb / 18 * 30 + 15 ) * '#' print '| %30s %+.3f | %7.4f | %+.3f %-30s |' % ( sa , va , t , vb , sb )