Untitled

                Never    
import math


def F(x='', y=''):
	k = 4
	def f(x, y): return 3*x**2 + x*y + 2*y**2 - x - 4*y
	if not x == '' and not y == '':
		return f(x, y)
	elif x == '':
		return lambda x: f(x, y)
	elif y == '':
		return lambda y: f(x, y)
	else:
		return False


def min_func(f, point, step):
	while True:
		if f(point) < f(point+step):
			break
		point += step
	return point


def search_min_of_func(f, point, step):
	if f(point+step) < f(point-step):
		return min_func(f, point, step)
	elif f(point+step) == f(point-step):
		if f(point+step) > f(point):
			return point
		else:
			return min_func(f, point, step)
	else:
		return min_func(f, point, step*(-1))

if __name__ == "__main__":
	u = [-1, 2]
	step = 0.01
	eps = 1e-5
	while True:
		y = search_min_of_func(F(x=u[0]), u[1], step)
		x = search_min_of_func(F(y=y), u[0], step)
		if math.sqrt((u[0]-x)**2+(u[1]-y)**2) < eps:
			print([f'{x:.5f}' for x in [x, y]])
			print(F(x, y))
			break
		u[0] = x
		u[1] = y

Raw Text