Probability and integration


ss

Please see my code to do a problem in Griffith’s quantum mechanics. But I have a feel that my code is really lengthy and is not general. Is there a way to make this general? or any easy alternatives? solution