地推有毒:
z[x_] := \!\(\*
TagBox[GridBox[{
{"\[Piecewise]", GridBox[{
{"1",
RowBox[{"x", "==", "0"}]},
{
RowBox[{"x", "+",
RowBox[{"2",
RowBox[{"(",
RowBox[{
RowBox[{"RandomVariate", "[",
RowBox[{"BernoulliDistribution", "[",
FractionBox[
RowBox[{"M", "+", "1", "-", "x"}],
RowBox[{"M", "+", "1"}]], "]"}], "]"}], "-",
FractionBox["1", "2"]}], ")"}]}]}],
RowBox[{
RowBox[{"x", "!=", "0"}], "&&",
RowBox[{"x", "!=",
RowBox[{"M", "+", "1"}]}]}]},
{"M",
RowBox[{"x", "==",
RowBox[{"M", "+", "1"}]}]}
},
AllowedDimensions->{2, Automatic},
Editable->True,
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {},
"Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {},
"Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.84]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}},
Selectable->True]}
},
GridBoxAlignment->{
"Columns" -> {{Left}}, "ColumnsIndexed" -> {},
"Rows" -> {{Baseline}}, "RowsIndexed" -> {}},
GridBoxItemSize->{
"Columns" -> {{Automatic}}, "ColumnsIndexed" -> {},
"Rows" -> {{1.}}, "RowsIndexed" -> {}},
GridBoxSpacings->{"Columns" -> {
Offset[0.27999999999999997`], {
Offset[0.35]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {
Offset[0.2], {
Offset[0.4]},
Offset[0.2]}, "RowsIndexed" -> {}}],
"Piecewise",
DeleteWithContents->True,
Editable->False,
SelectWithContents->True,
Selectable->False,
StripWrapperBoxes->True]\); M = 9;
Apply[Composition, Array[z &, 16]][#] & /@ Array[0 &, 100]
2021年04月11日 01点04分
5
复合就不会报错
2021年04月11日 01点04分