Create Bellman algorithm (Sage implementation)