在Mathematica 8中具有等式约束的函数最小化 [英] Function minimization with equality constraints in Mathematica 8
问题描述
在Mathematica 8中使用具有简单等式的约束时,最小化无效.例如.
When using constraints with simple equality in Mathematica 8, minimization doesn't work. E.g.
FindMinimum[{x^2 + y^2, y == 1}, {x, y}]
在Mathematica 6中可以正常运行,但在版本8中出现错误.其他人可以确认(或解释)吗?看起来像用约束来固定参数之一会使版本8混淆.将xy==1
放入也可以,所有不等式也可以.
works ok in Mathematica 6, but gives errors in version 8. Can anyone else confirm (or explain) this? Looks like fixing one of the parameters with a constraint confuses version 8. Putting xy==1
is OK, also any inequality.
对此有任何简单的解决方法吗?我试过更改Method
,不走运.我想将所有参数都保留在参数列表中,但是用简单的约束来保存其中一些参数,而不是从列表中删除参数名称.我在版本6中有可用的代码,在版本8中不再可用.
Any simple workaround on this? I have tried changing the Method
, no luck. I would like to keep all the parameters in the parameter list, but hold some of them with simple constraint instead of removing the parameter name from the list. I have a working code in version 6, which does not work anymore in 8.
推荐答案
您的语法似乎不正确:
FindMinimum[{x^2 + y^2, y == 1}, {x, y}]
要求以y
开头的x
.这对我来说没有多大意义.
which asks to start x
with a value of y
. This doesn't make much sense to me.
也许您正在尝试做:
Minimize[{x^2 + y^2, y == 1}, {x, y}]
Out: {1, {x -> 0, y -> 1}}
您的语法显然是有效的.如上所示,考虑将Minimize
用作解决您的问题的方法.
Apparently your syntax is valid. Consider Minimize
as shown above to be a possible work-around for your problem.
这篇关于在Mathematica 8中具有等式约束的函数最小化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!