Some python code performing symbolic computation