read `C13.txt`;G1((x-1)^2+(y-1)^2, [x,y], [6,-3], 0.1, 500, 0.01)#not bad!G1((x1-4)^2+(x2-7)^6+x3^8, [x1,x2,x3],[0,0,0], 0.1, 500, 0.01)#seems to work just fine for polynomials with easy minima#next up is a function with local min at (1,1)G1(4+x^3+y^3-3*x*y, [x,y],[-1,4], 0.1, 500, 0.01)#again, pretty good!G1(x^3-2*x^2+y^2+z^2-2*x*y+x*z-y*z+3*z, [x,y,z],[1,1,1], 0.1, 500, 0.01)#the previous function had a local min at (2,1,-1). G1 seems to be working perfectly fine to me!#A step size of 0.1 seems reasonable, to get decent precision without taking too many steps. A low tolerance like 0.01 is helpful to make sure you don't run into false critical points#Let's try a more complicated functionG1(exp(x^2+y^4+z^6), [x,y,z],[4,5,-3], 0.1, 500, 0.01)#Okay, that took too long. What about a rational function?G1(normal((x^2+y^2)/(x-1)^2), [x,y],[-1,-1], 0.1, 500, 0.01)G1(normal((x^2+y^2)/(x-1)^2), [x,y],[4,4], 0.1, 1000, 0.01)#Here, I got different results depending on the initial point. If x starts off negative, it will probably get near the right answer. But if x is positive, this algorithm usually won't be able to get around the pole at 1.#It seems to me that the implementation of the algorithm is just fine. The algorithm itself will have difficulties dealing with singularities, but if you know where those are and choose your initial point carefully you can probably avoid them