try to cut math module from http://www.halley.cc/code/?python/vectors.py