Not sure if anyone here is familiar with the innerworkings of HackInScience page, but I’m learning Python and found it to be a very helpful page for practice problems. I’ve actually completed every challenge, except one… the Dirichlet square.
(HackInScience — Dirichlet solver)
I thought I came up with a clever solution utilizing np.linalg.solve… basically one pass through the provided array to build a set of algebraic matrices and let Numpy find the solution values… but while it works on my local machine, I almost instantly get a timeout error in HackInScience when submitting the solution, with the page stating I might have an infinite loop or something. I did trace the error back to my np.linalg.solve line, basically if I remove that line the timeout error goes away… but I also don’t have the right answer.
Does anyone know if np.linalg.solve is an extremely slow implementation…this exercise would be solving a 9x9 matrix so I figured the time involved would be neglegable. Is it possbile something with HackInScience might not like the way numpy loops through that, or am I just wrong in thinking it was a viable solution?
If need be I’m sure I could find some other manual way to calculate the solution without using solve, but thought it was a clever solution, and would like to know if its me thats wrong, or if the page is just being picky. Would also be nice to see every task on that page with a green check.