mathematica程序运行不了,标识In[1]和Out[1]也没有出现

mathematica程序运行不了,标识In[1]和Out[1]也没有出现,第1张

错误的处理:

出现这样的原因一般是临时目录的权限不够,至于为什么中途出现这种问题,我尚不清楚,解决的办法是给Windows目录下的临时文件夹Temp的安全选项卡中加入NetWork Service用户并赋予全权。

Clear["Global`*"]

H = 10.

X[t_] := With[{a = 3., b = 0.08, \[Mu] = 10.},

Piecewise[{{a*E^(b*t),

0 <= t <\[Mu]}, {a*E^(b*\[Mu]), \[Mu] <= t <= H}}]]

Integrate[X[v], {v, t, Ti}, Assumptions ->{t >= 0, Ti >= t}]

ps = 1350.

\[Rho][ti_, t_] :=

With[{\[Alpha] = 0.6, Kps = 0.98, k1 = 0.0012, kt = 0.96,

k2 = 0.0012}, \[Alpha]*Kps*E^(-k1*ps) + (1 - \[Alpha])*kt*

E^(-k2*(ti - t))]

Integrate[-\[Rho][ti, v]*X[v], {v, Ti1, t},

Assumptions ->{Ti1 >= 0, Ti1 <= t}]

Y2[t_, Ti_] :=

Piecewise[{{-37.5*(-2.2255409284924674 + E^(0.08*t)),

0 <= t <10. &&Ti >10.}, {-37.5*(E^(0.08*t) - E^(0.08*Ti)),

0 <= t <10. &&t - Ti <0. &&Ti <= 10.}}, 0.]

Y1[ti_, Ti1_, t_] :=

Piecewise[{{(-3.5187957066762117*^-9*(9.081331218216658*^9 +

1.240102205*^9*E^(0.8 + 0.0012*ti) -

1.240102205*^9*E^(0.0012*ti + 0.08*Ti1) -

4.031831712*^9*E^(0.0812*Ti1)))/E^(0.0012*ti),

t >10. &&

0. <= Ti1 <

10.}, {(-3.5187957066762117*^-9*(4.031831712*^9*E^(0.0812*t) +

1.240102205*^9*E^(0.08*t + 0.0012*ti) -

1.240102205*^9*E^(0.0012*ti + 0.08*Ti1) -

4.031831712*^9*E^(0.0812*Ti1)))/E^(0.0012*ti),

0. <t <= 10. &&Ti1 >= 0. &&t - Ti1 >0.}}, 0.]

With[{ch = 270, pb = 800, c0 = 1000., cs = 20.,

cl = 20., \[Lambda]0 = 0.1, \[Lambda]1 = 1, h = 0.1},

For[n = 1, n <= 2, n++, TP3 = 0.

For[i = 1, i \[LessSlantEqual] n, i++, Ti1 = (i - 1.)*H/n

Ti = i*H/n

TP1 = Table[ti = Ti - \[Lambda]*H/n

ni1 = NIntegrate[\[Rho][ti, t]*X[t], {t, Ti1, ti}]

ni2 = NIntegrate[X[t], {t, ti, Ti}](ps - pb)*(ni1 + ni2) - c0 -

ch*NIntegrate[(t - ti)*Y2[t, Ti], {t, ti, Ti}] +

cs*NIntegrate[Y1[ti, Ti1, t], {t, Ti1, ti}] -

cl*NIntegrate[(1 - \[Rho][ti, t])*X[t], {t, Ti1,

ti}], {\[Lambda], \[Lambda]0, \[Lambda]1, h}]

TP2 = Max[TP1](*求最大值*)TP3 = TP3 + TP2(*求最大值之和*)

PositionMax1 =

Position[TP1,

Max[TP1]](*求最大值Position*)\[Lambda]Max = \[Lambda]0 +

h*(PositionMax1[[1, 1]] - 1)(*求最大值时 x 的值*)

Print["\[Lambda]", n, i, "=", \[Lambda]Max]]

Print["n=", n, " ", "总利润=", TP3]]]


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12109538.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-21
下一篇 2023-05-21

发表评论

登录后才能评论

评论列表(0条)

保存