Function 什么函数或函数集将产生最终值组合的最高中值?

Function 什么函数或函数集将产生最终值组合的最高中值?,function,wolfram-mathematica,median,piecewise,Function,Wolfram Mathematica,Median,Piecewise,目前,我正在进行一项投资试验,试验内容如下: initializeMoney := (totalMoney = 10); returnedMoney[w_] := Module[{x}, (x = RandomVariate[NormalDistribution[1.1, 1]]; If[x < 0, x = 0]; If[(1 < x) && (x < 1.7), x = 1.1]; w*x)] investStep[tot_] := If[(tot

目前,我正在进行一项投资试验,试验内容如下:

initializeMoney := (totalMoney = 10);

returnedMoney[w_] := 
Module[{x}, (x = RandomVariate[NormalDistribution[1.1, 1]]; 
If[x < 0, x = 0]; If[(1 < x) && (x < 1.7), x = 1.1]; w*x)]

investStep[tot_] := 
If[(tot < .01) || (tot < myWager[tot]), 0, 
tot - myWager[tot] + returnedMoney[myWager[tot]]]

Clear[myWager];
myWager[totalMoney_] := ???
Piecewise[{{totalMoney/2, totalMoney <= 20}, {2, totalMoney > 20}}];

initializeMoney;
accountBalances = NestList[investStep, totalMoney, 100];
accountBalances[[-1]]
ListPlot[accountBalances]
initializeMoney:=(totalMoney=10);
返回的货币[w_]:=
模[{x},(x=随机变量[正态分布[1.1,1]];
如果[x<0,x=0];如果[(1
我的目标是使所有最终值的中间值(在第5个代码块运行500次以上之后)尽可能大。目前我有两个问题:我不确定哪个函数会给我一个大的(大于50)最终中值,以及如何计算最终值的中值

目前,我选择的功能是(因为除了myWager中的更改外,代码保持不变,所以我将只包括我在myWager中所做的更改):

Clear[myWager];
我的赌注[总金额]:=
分段[{{totalMoney/2,totalMoney 20}];]
此函数的输出示例(每次运行时都会更改):

所以作为总结,, 我想知道哪一个函数/函数集(分段)允许我获得图形上最终点的最高(或大于50)中值(总共计算100次后)


此外,如何计算最终值的中值(计算500次后)?

这不是一个真正适合本网站的编程问题,是吗?可能是math.stackexchange.com?这不是一个真正适合本网站的编程问题,是吗?也许是math.stackexchange.com?
Clear[myWager];
myWager[totalMoney_] := 
Piecewise[{{totalMoney/2, totalMoney <= 20}, {2, totalMoney > 20}}];]