python script to find lambda for analytical 1D solution