MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   Mathematica论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=34)
-   -   [求助]:各位仁兄帮忙看一下这个程序哪有错误? (https://www.labfans.com/bbs/showthread.php?t=5227)

make12358 2008-11-08 11:02

[求助]:各位仁兄帮忙看一下这个程序哪有错误?
 
<< Statistics`ContinuousDistributions`
f[x1] := Which[9000 ≤ x1 < 10000, (-9000 +
x1)/200000, 10000 ≤ x1 < 13000, (-13000 + x1)/6000000]
F[x1] := Integrate[f[t], {t, 9000, x1}]
x2 = NormalDistribution[5000, 300];
x3 = NormalDistribution[2000, 100];
G[x_, P_] := F[x] - p;
Nex[x_, y_, z_] := N[x - y/z];
m[p_] := (x = 11000;
While[Abs[G[x_, p_] > 1*10^(-10),
x = Nex[x, G[x_, p_], f[x]]]]; x);
X1 = Map[m, Table[Random[], {20}]]
在运行后出现不了结果,请各位大哥帮忙看一下,哪些地方输入有误?谢谢了!

lifereader 2008-11-09 10:00

回复: [求助]:各位仁兄帮忙看一下这个程序哪有错误?
 
错误太多了,没耐心去改,
[code]函数f[x1],F[x1]的定义有误,
G[x_, P_] := F[x] - p;两个p不一样,Mathematica是大小写敏感的;
模块概念不熟[/code]


所有时间均为北京时间。现在的时间是 09:03

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.