Python Solve Boundary Value Problem