Stats

Popular Posts

Followers

Mathematica code for one paper

戴忠淵 於 Monday, October 12, 2009 7:04 PM 發表

I write the Mathematica code for this paper, On inventory replenishment with non-linear increasing demand, which had been published in Computers & Operations Research 29 (2002) 1819–1825

Definition of Parameter

{H,c1,c2} = {1,9,2}
f[t_] := 900 t + 100 t^2;
g[t_] := Integrate[f[u], {u, t, H}] // Evaluate;

The algorithm

test[k_]:=Union[Nest[Sort[Flatten[Append[#,Table[(anstemp=NMaximize[{(t-#[[i]])*(g[t]-g[#[[i+1]]]),0<>c1,t/.anstemp[[2]],#[[i+1]]]),{i,Length[#]-1}]]]]&,{0,H},k]]

Numerical example

i = 1; While[True, If[TrueQ[test[i] == test[i + 1]], Break[]]; i++]; {i, test[i]}


{3, {0, 0.195414, 0.337524, 0.467143, 0.581866, 0.697343, 0.804015, 0.904759, 1}}

The inventory system

a = test[3];
Show[Plot[g[t], {t, 0, H}, PlotStyle -> Thickness[0.005],
Filling -> {1 -> {Bottom, Red}}],
Graphics[{EdgeForm[Dashed], White,
Rectangle[{a[[#]], 0}, {a[[# + 1]], g[a[[# + 1]]]}]}] & /@
Range[Length[a] - 1],
PlotRange -> {All, {0, 500}},
ImageSize -> 400
]



Demostration for the algorithm

b=NestList[Sort[Flatten[Append[#,Table[(anstemp=NMaximize[{(t-#[[i]])*(g[t]-g[#[[i+1]]]),0<>c1,t/.anstemp[[2]],#[[i+1]]]),{i,
Length[#]-1}]]]]&,{0,H},3];


Show[Plot[g[t], {t, 0, H}, PlotStyle -> Thickness[0.005]],
Table[Graphics[{EdgeForm[Dashed], RGBColor[Random[], Random[], Random[]],
Rectangle[{b[[i, #]], g[b[[i, # + 2]]]}, {b[[i, # + 1]], g[b[[i, # + 1]]]}]}] & /@
Range[Length[b[[i]]] - 2], {i, {4, 3, 2}}],
PlotRange -> {All, {0, 500}},
ImageSize -> 400
]

athematica;教學;pdf mathematica 6教學 mathematica基本教學 mathematica mathematica下載 spss教學網站 spss教學講義下載 spss教學pdf spss教學網 pss教學講義下載 spss教學網站 spss教學下載 spss教學講義 spss教學pdf roc curve spss教學 manova spss教學 spss教學手冊 spss 16教學 automator mac 教學 automator 浮水 box cox spss cwtex linux cwtex ptt cwtex texlive cwtex-linux excel matrix excel 分配圖 excel 畫常態分配圖 excel常態分配 excel常態分配圖 excel畫常態分佈圖 excel畫常態分配圖 google latex 註解 graphicspath latex 路徑 import mathematica integral exp x 2 latex latex 文字和圖片重疊 latex 浮水印 透明度 watermark latex 圖例 latex 圖片文字重疊 latex教學 mac automator mac latex 新增 package mac pdf 浮水印 mac 水印 mac合併pdf mathematica mathematica 8 圖 字 mathematica abs mathematica pso mathematica 字型 mathematica 教學 pdf mathematica 講義 mathematica教學 mathematica講義 norminv vba p-value excel scientific workplace lyx spss string substr spss 幾何平均數 spss 遺漏值 spss教學講義下載 丁吉峰 可愛手寫字體 可愛字體 可愛的字體 如何畫常態分配圖 利用mac automator幫pdf加入浮水印 怎麼合併pdf for mac automator 怎麼畫星星 浮水印 cwtex 留言板 常態分配圖 常態分配圖如何畫 敏感性分析 公式 統計學講義 最小生成樹 華康可愛字體 戴忠淵 Tags: ,

讀者回應 ( 0 意見 )

Post a Comment

Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.

如果這篇文章對你有幫助,那請留個訊息給我~