I think that implementing an algorithm instead of using a library sometimes can sometimes give a better understanding and control of the model. When I am coding some program for scientific computations, it's important for me to understand what I am doing. And implementingImplementing the important algorithms helps me to get a better knowledge of the problem anand achieve a better control onof it. Also
On the other hand, sometimes it's not a trivaltrivial task to select a library that is needed for getting a solution, so it's better to search for already implemented-implemented algorithms when you are sure what are you trying to achieve and why do you want it.
If the algorithms are complex, then coding them by hand gives you the better opportunity to improve performaceperformance/quality of solution using the task-specific features. And sometimes it is necessary to change the algorithm a bit, and thiswhich is easier if you know the code that you wrote and you can edit it in the way you want.