Here is the problem where I am trying to solve by solving HJB equation, where the following term is coming:
To solve this, what I am doing is from one point I am iterating for all u than deciding h that stencil remains in the 9 point neighborhood, and then taking the 5 top most weight (based on distance) and lastly deciding the max value to update the value function but it is actually diverging.
https://colab.research.google.com/drive/1J805FxYLRBnRQAbvRRDVKwyqGO9wkR_M#scrollTo=ykFMv5YNKGBQ
I have written everything in function form please give a look, it is easy to understand, if anybody have any suggestion please weigh in