对于拉格朗日乘数等问题,您可以求解临界点。通常,您会得到一组关键点。有没有办法轻松地将原始函数映射到解决方案上,以在这些解决方案上评估/应用函数以获得函数值?
这是一些代码,最后一步是我不知道如何构建的代码:
f(x, y) := y^2 - x^2
g: 1/4 * x^2 + y^2
eq1: diff(f(x,y), x) = h * diff(g, x);
eq2: diff(f(x,y), y) = h * diff(g, y);
eq3: g = 1;
solve([eq1, eq2, eq3], [x, y, h]);
# Get:
# [[x=-2,y=0,h=-4],[x=2,y=0,h=-4],[x=0,y=-1,h=1],[x=0,y=1,h=1]]
# How can I get the list of values by applying the function to the
# list of solutions?
map(apply(f(x, y)), solve([eq1, eq2, eq3], [x, y, h]));
# Want (evaluated):
# [f(-2, 0), f(2, 0), f(0,-1), f(0, 1)]
# ???