以下代码创建了某个计算的图表。我的问题是,尽管分母中的术语顺序很好,但在应用Plus之后,它们会被任意地重新排列。任何建议如何强制原始订单被保留?防止“Plus”重新排列东西
http://yaroslavvb.com/upload/ind-sets-grid.png
r[i_] := Floor[(i - 1)/n] + 1; c[i_] := Mod[i, n, 1]; adj[a_, b_] := Abs[r[a] - r[b]] + Abs[c[a] - c[b]] == 1; indsetQ[s_] := Not[Or @@ (adj @@@ Subsets[s, {2}])]; indsets[k_] := Select[Subsets[Range[n^2], {k}], indsetQ]; twoColorGraph[g_, seen_, lbl_] := Module[{radius = .22}, vcoords = # -> {c[#], n - r[#]} & /@ Range[n^2]; fv = Function[{p, v}, {EdgeForm[Thick], If[MemberQ[seen, v], Pink, White], Disk[p, radius]}]; GraphPlot[g, VertexLabeling -> True, VertexRenderingFunction -> fv, PlotLabel -> Style[lbl, 20], LabelStyle -> Directive[Bold], VertexCoordinateRules -> vcoords, ImageSize -> 80] ]; n = 2; g = Array[Boole[adj[#1, #2]] &, {n^2, n^2}]; weight[set_] := Times @@ (Subscript[\[Lambda], c[#], r[#]] & /@ set); denominator = twoColorGraph[g, #, weight[#]] & /@ Join @@ (indsets[#] & /@ Range[2]); numerator = twoColorGraph[g, {1}, weight[{1}]]; Style[numerator/(Plus @@ denominator), FontSize -> 30]
这是一个重复,意图,如果不是形式,另一个问题(http://stackoverflow.com/questions/3947071/controllingorder-of-variables-in-an-expression)。否则,我会给你一个单独的图形+1。什么是计算? – rcollyer 2010-11-05 19:38:36
是的,这是相似的。那里的建议是定义像“myPlus”这样的不是无序的自己的功能,但是我怎样才能让它与“Plus”一样呈现? – 2010-11-05 19:42:07
计算是在有限网格(即具有硬核自排斥和硬核对相互作用的宏规范气体)上找到每个现场占据核心排斥性局部气体的概率 – 2010-11-05 20:12:19