【问题标题】:Why won't this Mathematica code maximize?为什么这个 Mathematica 代码不能最大化?
【发布时间】:2014-04-24 02:24:54
【问题描述】:
f[n_] := ((A*n^a)^(1/s) + 
        c*(B*(a*c*(B/A)^(1/s)*n^(1 - (a/s)))^(-(a*s)/(a - s)))^(1/s))^s +
        b*log (1 - n - ((a*c*(B/A)^(1/s)*n^(1 - (a/s)))^(-(a*s)/(a - s))))
        d/dn (f (n))
        d/dn (f[n])
        D[f[n], n]
        solve (D[f[n], n] = 0)
        0
        Solve[D[f[n], n] = 0, n]
        Solve[0, n]
        Maximize[f[n], n]
        Maximize[b log (1 - n - (a (B/A)^(1/s) c n^(1 - a/s))^(-((a s)/(a - s)))) + ((A n^a)^(1/s) 
                     + c (B (a (B/A)^(1/s) c n^(1 - a/s))^(-((a s)/(a - s))))^(1/s))^s, n]

我没有得到任何这些功能的回报。知道为什么吗?

附上一张mathematica脚本的照片:

【问题讨论】:

  • 您没有阅读其他问题的答案吗?或者你有一个名为log的变量吗?

标签: wolfram-mathematica maximize mathematica-8


【解决方案1】:

首先,您使用的是小写的solve,它只是一个未定义的变量。要使用函数Solve,您需要用大写字母书写。同样,Log 必须使用大写字母,而不是小写字母,因为它是内置函数。

其次,你的左括号不是括号。 Mathematica 中的函数需要括号,例如 Solve[ ... ],而不是 Solve( )

第三,您使用的是= 而不是==。单等号= 用于存储变量,双等号== 用于表示相等。

在纠正这些错误后看看你是否可以让它工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    相关资源
    最近更新 更多