Mathematica:如何找到以指数为参数的表达式的最大值
我正在使用 Mathematica 8 寻找表达式最大值的解析解。当我使用 Maximize 命令尝试找到解决方案时,它只是重复我输入的内容,这意味着 Mathematica 不知道如何执行此操作。我已将问题范围缩小到:似乎如果有一个指数是参数,则最大化不起作用。这是一个例子。这是伯努利试验的似然函数,其中 a 和 b 是成功和失败的结果。
Maximize[{t^a*(1 - t)^b, {t >= 0, t <= 1, a > 0, b > 0}}, {t}]
在这种情况下,我想要得到的解决方案是 a/(a+b)
。如果我提供像 3 和 2 这样的常量而不是 a
和 b
那么它就会找到解决方案。
是否有不同的方法来指定表达式或约束,以便 Mathematica 可以找到指数为参数的表达式的最大值?我觉得我缺少一些东西,因为这太简单了。
I'm using Mathematica 8 to find an analytic solution to the max of an expression. When I use the Maximize command to try to find a solution, it just repeats what I entered, implying that Mathematica doesn't know how to do it. I've narrowed down the problem to this: it seems like if there is an exponent that is a parameter, Maximize doesn't work. Here's an example. This is the likelihood function from a Bernoulli trial, where a and b are the successes and failures.
Maximize[{t^a*(1 - t)^b, {t >= 0, t <= 1, a > 0, b > 0}}, {t}]
What I would like to get as a solution is a/(a+b)
in this case. If I provide constants like 3 and 2 instead of a
and b
then it finds the solution.
Is there a different way to specify the expression or the constraints so that Mathematica can find a maximum to expressions with exponents that are parameters? I feel like there's something I'm missing because this is so simple.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我一直在玩它,即移动条件、更改表达式形式、删除条件,但我也无法让
Maximize
发挥作用。但是,这可以直接解决,如下所示,正如您所说,
{{t -> a/(a + b)}}
。有时Reduce
可用于帮助理解为什么像Maximize
这样的函数会通过提供更完整的解决方案空间来表现出错误的行为。它的调用方式类似于Solve
,如下所示,在
本例中,这并没有多大帮助。
I've been playing with it, i.e. moving conditions, changing expression form, removing conditions, and I can't get
Maximize
to behave, either. However, this can be solved directly, as followswhich gives, as you said,
{{t -> a/(a + b)}}
. SometimesReduce
can be used to help understand why a function likeMaximize
misbehaves by giving a more complete picture of the solution space. It is invoked likeSolve
, as followsgiving
which isn't all that helpful, in this case.
Mathematica 中的 Maximize 函数应用于指数函数,只有在对所有参数(在您的情况下是 a、b 和 t)进行最大化时才有效。现在,您只能最大化 t,这是行不通的。
考虑这个简单的例子(使用 Mathematica 8.0):
The Maximize function in Mathematica, applied on an exponential function, only works if you maximize with respect to all parameters (a, b and t in your case). Now, you only maximize with respect to t, which does not work.
Consider this easy example (using Mathematica 8.0):