2024年3月6日发(作者:五易文)
P96
8、t=[0:0.1:2*pi];
A1=5;
A2=3;
w1=2;
w2=4;
x1=A1*sin(w1*t+pi/3);
x2=A2*sin(w2*t+pi/4);
plot(t,x1,'-r',t,x2,'-b');
543210-1-2-3-4-501234567P98 21
x=-5:0.1:5;
y=0:0.1:10;
[X,Y]=meshgrid(x,y);
z=X.^2.*Y + sqrt(Y)./X;
mesh(X,Y,z);
30020010-5140.820.600.4-20.2022022-20-200-2-2
P97 20
subplot(1,2,1);
[X0,Y0,Z0]=sphere(20);
X=2*X0;Y=3*Y0;
Z=4*Z0+1;
surf(X,Y,Z);
axis equal
其中,s 为线间的距离,l 为针长度,x 为线中点到最近平行线的距离,
为针与线平行线间的夹角。联合概率密度函数为
4
f (x ) f () ,0 x s / 2,0 / 2;
subplot(1,2,2)
t=-1:0.1:1;
[X,Y,Z]=cylinder(1+t.^2,20);%形成旋转曲面
surf(X,Y,Z);
P195 1
x=[-1.0 -0.75 -0.50 -0.25 0 0.25 0.50 0.75 1.00];
y=[-0.2209 0.3295 0.8826 1.4392 2.0003 2.5645 3.1334 3.7061 4.2836];a=polyfit(x,y,1);
P151 3
syms v
vp=1578;
f=int(4/pi^(1/2)*v^2/vp^3*exp(-v^2/vp^2),v,0,Inf);
VF=vpa(f);
1. 解: 依题, 取 a 5,c 1,m 16, x0 1
xn1 (5xn 1)(mod16),x0 1,
x
伪随机数: n n
16
2. 解: 依题, 取 a 137,c 187,m 256,x0 1
xn1 (137xn 187)(mod 256),x0 1,
xn2 (137xn1 187)(mod 256),
x x x
伪随机数: n n ,n1 n1 ,n2 n2
256 256 256
3. 解:引入二维随机均匀分布向量(x,) 表示针在桌上的位置,
s 1 1
x [0, ], f (x ) ;[0, ], f () .
1 2
2 s / 2 0 2 / 2 0
1 2
f (x ,) s
0, others.
记针与线相交事件为A,则概率
l
( ) ( sin)
P A P x
2
l
sin
2 2 4 2l
= ( , )
f x dxd d dx
s s
l 0 0
x sin
2
2l
.下面是MC 计算步骤: sP(A)
----------------------- Page 2-----------------------
s
i). [0,1], ( ) 1, set
1 1 1 1
2
s
2 [0,1], ( 2 ) 1, set 2 2 .
2
;
l
ii). judge: min(,l ) sin
1 1 2
2
if it's yes, set i 1;
if not, set i 0, { 1, , n}.
1 n 2l
iii). sum I= i , then = .
n i 1 sI
4. 解:依题,引入事件集x {x1 | p1 pair , x2 | p2 comp , x3 | p3 photo }.
T T T
i). [0,1], ( ) 1;
ii). judge: p1, x x1;
MC 计算步骤:
p1 p1 p 2, x x2 ;
>p1 p 2, x x 3 .
其中, x 表示对产生,x 康普顿散射,x 光电效应。
1 2 3
5. 解:依题, MC 计算步骤:
x x
F (x) f (t )dt etdt 1ex .
i). [0,1], ( )=1;
1
ii). set F( ) 1e , ln(1 ).
1
reset 1 [0,1], ln .
6. 解:依题,本题变换法抽样和直接变换法。
设粒子运动距离为L,其分布密度函数为g (L) 。
1 t/
已知时间t 的分布密度函数,有 ( ) ,且 L vt .
f t e
t t L L
dt 1 1 1 t 1
v v
则由 g (L) f (t ) 得出 g L e e e
( )
dL v v v
L
1
即 g L e v ,下面用直接变换对L 的分布密度函数g (L) 进行抽样。
( )
v
L L L
1
L v v
首先,的分布函数为 F L e dL e ,下面是抽样步骤:
( ) 1
v
0
----------------------- Page 3-----------------------
i). [0,1], ( ) 1;
1 1
MC 计算步骤: ii). 令=F() 1e v, 解出
vln(1).
iii). 和 1 服从同样的分布,故有 v ln .
7. 解:依题,二维独立随机变量分布
d(,) f (, )dd, f (, ) f () f ()
1 2
f 1() sin, f 2 () 1, [0,],[0,2].
下面采用直接抽样法:
改写d ( , ) d cos
,由于各项同性分布,cos在[1,1]上均匀
d
分布,在[0,2
] 上均匀分布。令x cos,于是可以设
,其中g () 为待定分布密度函数。
F x f x dx n x x
由 1 1 n 1 1
1
----------------------- Page 4-----------------------
sin sin, 可令 take [0,1],( ) 1, i 1, , n.
x [ 1,1], f (x ) 1; [0, ], g( )
dx
由 g () f (x) 1 d
cosx g (x), g 1 () cosh()
有MC 计算步骤:
i). , [0,1], () 1,() 1;
1 2 1 1 2 2
ii). x cos 1+2, cos1(12);
1 1 1
2
2 2
iii). ( , ) cos1(12 ), 2 ( , ).
1 2 1 2
8. 解: 依题,考虑使用条件密度法
f (x, y) f (x)f (y | x).
1 2
其中,
f 1(x) f (x, y)dy nxn exydy
0 0
1 1
=nx n ( )(0 1) nx n , x 1
x
( , )
f x y xy
f 2 (y |x ) xe , y 0
f 1(x )
i). 反函数法抽样:
x
1 x
( ) ( ) n 1 n
i i
n
set F () 1
1 1 1 1
1 1 1
.
1 1
n n max( , , )
1
1 1 1 n
ii). 反函数法抽样,x :
1
y
1y
F (y) f (y |)dy 1e
由 2 2 1
1
take [0,1],( ) 1,
n1 n1
1
set F () 1e 1 2
n1 2 2 2 n 1
1
1 , ln .
n1 n1 2 n1
1
ln(1 )
1
1
). =( , ) { ,ln }.
iii
1 2 n1
max( , , )
1 n
9. 证:
i). [0,1],( ) 1;
i i
1 1 x x
set x g () x cot() g (x ) arc cot( 0 i )
i i 0 i i i
1 di 1 1 1 1
ii). (g (x )) =1 (- ) f (x )
i 1 2 2 i
dxi 2 (x x )
x x 0
1 ( )
2 0 i
1 di
iii). f (x ) (g (x )) f (x )dx g()d.
i i i i i i
dx
i
注:也可以采用反函数法证明,其中用到反切函数的如下性质:
cot( ) cot( ) cot( ).
i i i
10. 证: 依题,
15 x3 15 3 1 1 15 3 x nx
f (x) 4 ( x ) 4 x x x 4 x e e
e 1 e 1e n 0
4
x 156 (n 1) 4 1 nx
=e 4 4 ( x e )
n 0 (n 1) (4 1)!
4
90 (n 1) 3 (n 1)x
= 4 4 [ x e ]
n 0 (n 1) 3!
4 4
90 n 3 nx n 3 nx
x e p n x e ]
= 4 4 [ ] ( )[
n 1 n 3! n 1 3!
其中,
----------------------- Page 5-----------------------
90 n4 3 nx
p (n ) 0, p (n ) 1; f (x ) x e is Gamma distribution.
4 4 且 n
n n 1 3!
MC 计算步骤:
i). [0,1], ( ) 1,i 1, ,5;
i i
90 l1 1 90 l 1
ii). judge:
4 4 i 4 4
j 1 j j 1 j
if it's true,f n (x ) sampling; if not, gotoi ).
l 1 4
L / 90
取为满足 4 1 的最小整数。
j 1 j
4
n 3 nx 1
iii). f (x) x e 12题), x ln().
按 抽样(见
n 2 3 4 5
3! L
2
1 (x )
2
1 2
( 1)
2e 1 x
H( ) , ( ) ( ) 2
x L h x H x e
L
p x dx dx x
11. 证:考虑 ( ) exp[ 2 ] , 0.
2 2
(1). 反函数抽样: g (x ) ex .
1
x x
F (x) g (x)dx exdx 1ex
1 1
0
i). [0,1], ( ) 1;
1 1
1
ii). set F ( ) 1e ln(1 )
1 1 1 1 1
,1 [0,1], ln .
1 1 1 1
2 x2 /2
( ) , 0.
(2). 第二类舍选法抽样:f x e x
set f (x) H (x) g(x), g(x) ex , x
f (x ) 2 1 2 1/2
H( ) exp[ ( 2 1)]
x x x e
( ) 2
g x
2e 1 2
= exp[ (x 1) ], x 0
0
----------------------- Page 6-----------------------
i). [0,1], () e1 ; [0,1], ( ) 1;
1 1 1 2 2 2
ii). judge: 2 h ( 1 ), if it's true, 2 1 ; if not, goto (2)-i).
1 2
( 1)
1
where h ( ) e 2
2 1 2
1 2 2
ln ( 1) ( 1) 2ln
2 1 1 2
2
2
2 1 (x )
(3). 变换抽样法: p x
( ) exp[ 2 ].
2
1 2
2 2
i). [0, ), f ( ) e 2 ;
2 2
2 1 ( )2
ii). p ( ) exp[ ]
2
2
1
( ) ( ( )) ( )
f f h h
h( ) g1( )
set h ( ) .
2 2
12. 证:归纳法证明之。
1
(1)n 1时, ( ) ax direct sampling ln ;
f x ae
1 1 1
a
k
(2)假设 n k 时成立,即f k (x) a xk
(k 1)!
1
抽样 ln( );
k 1 2 k 1 k
a
(3)n k 1时,
k 1 k 1 x
a k ax a ax k 1
f x x e e t dt
1eax 有 k 1( ) k ! (k 1)!
0
x k
a 1 ( )
(k 1)!tk e at ae a x t dt
0
x
f t f x t dt f t f x t dt
= ( ) ( ) ( ) ( ) .
k 1 k 1
0
由 复 合 抽 样
1
( ) ( ) ln( ).
k 1 k 1 k 1 k 1 k 1 k 1 1 k
a
13. 证:归纳法证明之。
数学准备:
----------------------- Page 7-----------------------
1 1
2
x 1 y 1 1 2 z
( , ) (1 ) , ( ) ( ) 2 2 (2 )
x y t t dt z z
2
0
( ) ( ) x/2
x y e
( , ) , 2 .
x y dx
( )
x y 0
1
1 2 x/2 1 x/2
(1)n 1, f1 (x) x e e .
法 :
1
z
2 2x
1 2
). ( , + ), ( ) y /2 ;
i y y e
2
ii). set x y2 , y x ;
dy 1 x2 /2 1 1
). ( ( )) ( ).
iii y x e f 1 x
dx 2 2 x 2
1
where arising from the different ranges of x and y .
2
n1
1 x/2 2 1
( )
(2)假设n 1时成立,即f n1 x n1 e x 有
n 1
2 2 ( )
2
抽样 x y 2 y 2 y 2
n1 1 2 n1
(3)当取n 时,
n n
1 /2 1 1 /2 1 n 2 1
f n (x ) 2n/2 (n / 2)e x x 2 n/2 n 1 1 e x x 2 ( 2 , 2)
2 ( )( )
2 2
n 1 n3 1
1 x/2 2 1 2 2
= n/2 n 1 1 e x t (1t) dt
2 ( )( ) 0
2 2
x n3 1
1
txt /2
n/2 n 1 1 e x t 2 (x t) 2 dt
2 ( )( ) 0
2 2
x 3 ( )
n x t
1 1
x/2 2 2
= e t e dt
n 1 n1 2(x t)
0 ( )2 2
2
x
= ( ) ( ) ( ) ( )
f n1 x f 1 x t dt f n1 x f 1 x t dt
0
n
由复合抽样法: x x x (y ) x x y2 y2 .
n n1 1 n n n1 n i
i 1
14. 解:MC 计算步骤:
----------------------- Page 8-----------------------
3/2 x f (x ) x x
( ) ( ) , ( ) .
x e dx f x dx x e dx f x e dx f x x
e
0 0 0 0
i). [0,1], ( ) 1, i 1,,n;
i i
ii). 首先对偏倚密度函数g (x) ex 抽样:
x
F (x) exdx 1ex ,
1
0
set F () ln ;
i 1 i i i
3/2
f (x )
iii). 求出f (x) 在各抽样点的值:
g (x)
f () 3 3
i 2 2
f () (ln ) ;
i i i
g ()
i
n 3
1
iiii). {ln i n 2
i , 1, , }, I= ( ln i ) .
n i 1
15. 解:依题,Metropolis 计算步骤:
i). 选择初始位置: x 0, f (x) A;
0 0 max
ii). [0,1], ( ) 1,
1 1
L L L
def. step L [ , ];
i 1
2 2 2
iii). [0,1], ( ) 1, 引入过渡概率:
2 2
( )2
x
e i i
x x ) min{1, }
(i i1 2
x
e i
judge: x x ),
2 (i i1
if it's true, x x , then
i1 i1 i i
goto i ) and walk for the next step x x ,x x ;
1 0 i1 i2
if not, goto ii ) and walk for the step x x again.
i i1
N
2 1 2 2
iiii). ={ 0 , 1, , i , , N }, calculate x i , 1,
N i 0
2 2
if ( x .eq. ) then
time stop!
16. 解:依题: 2 x 2 x
f (x) x e f (x)g (x), with f (x) x , g (x) e
1 1
g (x )
(
引入过渡概率: x x ) min{1, }.
x [0,4] g (x)
Metropolis 计算步骤:
----------------------- Page 9-----------------------
i). 选择初始位置: x 0, g (x 0) 1;
0 0 max
ii). [0,1], ( ) 1, L=4,
1 1
def. step L [0,4];
i 1
iii). [0,1], ( ) 1,
2 2
judge: x x ),
2 (i i1
if it's true, x x , then
i1 i1 i i
goto i ) and walk for the next step x x , , ;
x x
1 0 i1 i2
if not, goto ii ) and walk for the step xi xi1 again.
均值 { } , 方差 [ { }].
0 E 0 0 E 0
N N 1
4 N
2 x 1 2
iiii). ={ 0 , 1, , i , , N }, x e dx I= N i .
0 i 1
17. 解:依题,首先离散化区域D : 0 x 1,0 y 1.
1
则区域D 内任意正则点0 的势值: ( ).
0 1 2 3 4
4
随机游走步骤:
i). [0,1], ( ) 1;
1 1 3
ii). if( .or. 1) then
4 2 4
(n)
0 1
else
(n) 0
0
endif
iii). 0 N
重复从 点开始进行 次上述随机游走,则有
{ (1) (n) (N )}
: ,, ,,
0 0 0 0
N
(n)
0
n 1 2 N 2 2
2024年3月6日发(作者:五易文)
P96
8、t=[0:0.1:2*pi];
A1=5;
A2=3;
w1=2;
w2=4;
x1=A1*sin(w1*t+pi/3);
x2=A2*sin(w2*t+pi/4);
plot(t,x1,'-r',t,x2,'-b');
543210-1-2-3-4-501234567P98 21
x=-5:0.1:5;
y=0:0.1:10;
[X,Y]=meshgrid(x,y);
z=X.^2.*Y + sqrt(Y)./X;
mesh(X,Y,z);
30020010-5140.820.600.4-20.2022022-20-200-2-2
P97 20
subplot(1,2,1);
[X0,Y0,Z0]=sphere(20);
X=2*X0;Y=3*Y0;
Z=4*Z0+1;
surf(X,Y,Z);
axis equal
其中,s 为线间的距离,l 为针长度,x 为线中点到最近平行线的距离,
为针与线平行线间的夹角。联合概率密度函数为
4
f (x ) f () ,0 x s / 2,0 / 2;
subplot(1,2,2)
t=-1:0.1:1;
[X,Y,Z]=cylinder(1+t.^2,20);%形成旋转曲面
surf(X,Y,Z);
P195 1
x=[-1.0 -0.75 -0.50 -0.25 0 0.25 0.50 0.75 1.00];
y=[-0.2209 0.3295 0.8826 1.4392 2.0003 2.5645 3.1334 3.7061 4.2836];a=polyfit(x,y,1);
P151 3
syms v
vp=1578;
f=int(4/pi^(1/2)*v^2/vp^3*exp(-v^2/vp^2),v,0,Inf);
VF=vpa(f);
1. 解: 依题, 取 a 5,c 1,m 16, x0 1
xn1 (5xn 1)(mod16),x0 1,
x
伪随机数: n n
16
2. 解: 依题, 取 a 137,c 187,m 256,x0 1
xn1 (137xn 187)(mod 256),x0 1,
xn2 (137xn1 187)(mod 256),
x x x
伪随机数: n n ,n1 n1 ,n2 n2
256 256 256
3. 解:引入二维随机均匀分布向量(x,) 表示针在桌上的位置,
s 1 1
x [0, ], f (x ) ;[0, ], f () .
1 2
2 s / 2 0 2 / 2 0
1 2
f (x ,) s
0, others.
记针与线相交事件为A,则概率
l
( ) ( sin)
P A P x
2
l
sin
2 2 4 2l
= ( , )
f x dxd d dx
s s
l 0 0
x sin
2
2l
.下面是MC 计算步骤: sP(A)
----------------------- Page 2-----------------------
s
i). [0,1], ( ) 1, set
1 1 1 1
2
s
2 [0,1], ( 2 ) 1, set 2 2 .
2
;
l
ii). judge: min(,l ) sin
1 1 2
2
if it's yes, set i 1;
if not, set i 0, { 1, , n}.
1 n 2l
iii). sum I= i , then = .
n i 1 sI
4. 解:依题,引入事件集x {x1 | p1 pair , x2 | p2 comp , x3 | p3 photo }.
T T T
i). [0,1], ( ) 1;
ii). judge: p1, x x1;
MC 计算步骤:
p1 p1 p 2, x x2 ;
>p1 p 2, x x 3 .
其中, x 表示对产生,x 康普顿散射,x 光电效应。
1 2 3
5. 解:依题, MC 计算步骤:
x x
F (x) f (t )dt etdt 1ex .
i). [0,1], ( )=1;
1
ii). set F( ) 1e , ln(1 ).
1
reset 1 [0,1], ln .
6. 解:依题,本题变换法抽样和直接变换法。
设粒子运动距离为L,其分布密度函数为g (L) 。
1 t/
已知时间t 的分布密度函数,有 ( ) ,且 L vt .
f t e
t t L L
dt 1 1 1 t 1
v v
则由 g (L) f (t ) 得出 g L e e e
( )
dL v v v
L
1
即 g L e v ,下面用直接变换对L 的分布密度函数g (L) 进行抽样。
( )
v
L L L
1
L v v
首先,的分布函数为 F L e dL e ,下面是抽样步骤:
( ) 1
v
0
----------------------- Page 3-----------------------
i). [0,1], ( ) 1;
1 1
MC 计算步骤: ii). 令=F() 1e v, 解出
vln(1).
iii). 和 1 服从同样的分布,故有 v ln .
7. 解:依题,二维独立随机变量分布
d(,) f (, )dd, f (, ) f () f ()
1 2
f 1() sin, f 2 () 1, [0,],[0,2].
下面采用直接抽样法:
改写d ( , ) d cos
,由于各项同性分布,cos在[1,1]上均匀
d
分布,在[0,2
] 上均匀分布。令x cos,于是可以设
,其中g () 为待定分布密度函数。
F x f x dx n x x
由 1 1 n 1 1
1
----------------------- Page 4-----------------------
sin sin, 可令 take [0,1],( ) 1, i 1, , n.
x [ 1,1], f (x ) 1; [0, ], g( )
dx
由 g () f (x) 1 d
cosx g (x), g 1 () cosh()
有MC 计算步骤:
i). , [0,1], () 1,() 1;
1 2 1 1 2 2
ii). x cos 1+2, cos1(12);
1 1 1
2
2 2
iii). ( , ) cos1(12 ), 2 ( , ).
1 2 1 2
8. 解: 依题,考虑使用条件密度法
f (x, y) f (x)f (y | x).
1 2
其中,
f 1(x) f (x, y)dy nxn exydy
0 0
1 1
=nx n ( )(0 1) nx n , x 1
x
( , )
f x y xy
f 2 (y |x ) xe , y 0
f 1(x )
i). 反函数法抽样:
x
1 x
( ) ( ) n 1 n
i i
n
set F () 1
1 1 1 1
1 1 1
.
1 1
n n max( , , )
1
1 1 1 n
ii). 反函数法抽样,x :
1
y
1y
F (y) f (y |)dy 1e
由 2 2 1
1
take [0,1],( ) 1,
n1 n1
1
set F () 1e 1 2
n1 2 2 2 n 1
1
1 , ln .
n1 n1 2 n1
1
ln(1 )
1
1
). =( , ) { ,ln }.
iii
1 2 n1
max( , , )
1 n
9. 证:
i). [0,1],( ) 1;
i i
1 1 x x
set x g () x cot() g (x ) arc cot( 0 i )
i i 0 i i i
1 di 1 1 1 1
ii). (g (x )) =1 (- ) f (x )
i 1 2 2 i
dxi 2 (x x )
x x 0
1 ( )
2 0 i
1 di
iii). f (x ) (g (x )) f (x )dx g()d.
i i i i i i
dx
i
注:也可以采用反函数法证明,其中用到反切函数的如下性质:
cot( ) cot( ) cot( ).
i i i
10. 证: 依题,
15 x3 15 3 1 1 15 3 x nx
f (x) 4 ( x ) 4 x x x 4 x e e
e 1 e 1e n 0
4
x 156 (n 1) 4 1 nx
=e 4 4 ( x e )
n 0 (n 1) (4 1)!
4
90 (n 1) 3 (n 1)x
= 4 4 [ x e ]
n 0 (n 1) 3!
4 4
90 n 3 nx n 3 nx
x e p n x e ]
= 4 4 [ ] ( )[
n 1 n 3! n 1 3!
其中,
----------------------- Page 5-----------------------
90 n4 3 nx
p (n ) 0, p (n ) 1; f (x ) x e is Gamma distribution.
4 4 且 n
n n 1 3!
MC 计算步骤:
i). [0,1], ( ) 1,i 1, ,5;
i i
90 l1 1 90 l 1
ii). judge:
4 4 i 4 4
j 1 j j 1 j
if it's true,f n (x ) sampling; if not, gotoi ).
l 1 4
L / 90
取为满足 4 1 的最小整数。
j 1 j
4
n 3 nx 1
iii). f (x) x e 12题), x ln().
按 抽样(见
n 2 3 4 5
3! L
2
1 (x )
2
1 2
( 1)
2e 1 x
H( ) , ( ) ( ) 2
x L h x H x e
L
p x dx dx x
11. 证:考虑 ( ) exp[ 2 ] , 0.
2 2
(1). 反函数抽样: g (x ) ex .
1
x x
F (x) g (x)dx exdx 1ex
1 1
0
i). [0,1], ( ) 1;
1 1
1
ii). set F ( ) 1e ln(1 )
1 1 1 1 1
,1 [0,1], ln .
1 1 1 1
2 x2 /2
( ) , 0.
(2). 第二类舍选法抽样:f x e x
set f (x) H (x) g(x), g(x) ex , x
f (x ) 2 1 2 1/2
H( ) exp[ ( 2 1)]
x x x e
( ) 2
g x
2e 1 2
= exp[ (x 1) ], x 0
0
----------------------- Page 6-----------------------
i). [0,1], () e1 ; [0,1], ( ) 1;
1 1 1 2 2 2
ii). judge: 2 h ( 1 ), if it's true, 2 1 ; if not, goto (2)-i).
1 2
( 1)
1
where h ( ) e 2
2 1 2
1 2 2
ln ( 1) ( 1) 2ln
2 1 1 2
2
2
2 1 (x )
(3). 变换抽样法: p x
( ) exp[ 2 ].
2
1 2
2 2
i). [0, ), f ( ) e 2 ;
2 2
2 1 ( )2
ii). p ( ) exp[ ]
2
2
1
( ) ( ( )) ( )
f f h h
h( ) g1( )
set h ( ) .
2 2
12. 证:归纳法证明之。
1
(1)n 1时, ( ) ax direct sampling ln ;
f x ae
1 1 1
a
k
(2)假设 n k 时成立,即f k (x) a xk
(k 1)!
1
抽样 ln( );
k 1 2 k 1 k
a
(3)n k 1时,
k 1 k 1 x
a k ax a ax k 1
f x x e e t dt
1eax 有 k 1( ) k ! (k 1)!
0
x k
a 1 ( )
(k 1)!tk e at ae a x t dt
0
x
f t f x t dt f t f x t dt
= ( ) ( ) ( ) ( ) .
k 1 k 1
0
由 复 合 抽 样
1
( ) ( ) ln( ).
k 1 k 1 k 1 k 1 k 1 k 1 1 k
a
13. 证:归纳法证明之。
数学准备:
----------------------- Page 7-----------------------
1 1
2
x 1 y 1 1 2 z
( , ) (1 ) , ( ) ( ) 2 2 (2 )
x y t t dt z z
2
0
( ) ( ) x/2
x y e
( , ) , 2 .
x y dx
( )
x y 0
1
1 2 x/2 1 x/2
(1)n 1, f1 (x) x e e .
法 :
1
z
2 2x
1 2
). ( , + ), ( ) y /2 ;
i y y e
2
ii). set x y2 , y x ;
dy 1 x2 /2 1 1
). ( ( )) ( ).
iii y x e f 1 x
dx 2 2 x 2
1
where arising from the different ranges of x and y .
2
n1
1 x/2 2 1
( )
(2)假设n 1时成立,即f n1 x n1 e x 有
n 1
2 2 ( )
2
抽样 x y 2 y 2 y 2
n1 1 2 n1
(3)当取n 时,
n n
1 /2 1 1 /2 1 n 2 1
f n (x ) 2n/2 (n / 2)e x x 2 n/2 n 1 1 e x x 2 ( 2 , 2)
2 ( )( )
2 2
n 1 n3 1
1 x/2 2 1 2 2
= n/2 n 1 1 e x t (1t) dt
2 ( )( ) 0
2 2
x n3 1
1
txt /2
n/2 n 1 1 e x t 2 (x t) 2 dt
2 ( )( ) 0
2 2
x 3 ( )
n x t
1 1
x/2 2 2
= e t e dt
n 1 n1 2(x t)
0 ( )2 2
2
x
= ( ) ( ) ( ) ( )
f n1 x f 1 x t dt f n1 x f 1 x t dt
0
n
由复合抽样法: x x x (y ) x x y2 y2 .
n n1 1 n n n1 n i
i 1
14. 解:MC 计算步骤:
----------------------- Page 8-----------------------
3/2 x f (x ) x x
( ) ( ) , ( ) .
x e dx f x dx x e dx f x e dx f x x
e
0 0 0 0
i). [0,1], ( ) 1, i 1,,n;
i i
ii). 首先对偏倚密度函数g (x) ex 抽样:
x
F (x) exdx 1ex ,
1
0
set F () ln ;
i 1 i i i
3/2
f (x )
iii). 求出f (x) 在各抽样点的值:
g (x)
f () 3 3
i 2 2
f () (ln ) ;
i i i
g ()
i
n 3
1
iiii). {ln i n 2
i , 1, , }, I= ( ln i ) .
n i 1
15. 解:依题,Metropolis 计算步骤:
i). 选择初始位置: x 0, f (x) A;
0 0 max
ii). [0,1], ( ) 1,
1 1
L L L
def. step L [ , ];
i 1
2 2 2
iii). [0,1], ( ) 1, 引入过渡概率:
2 2
( )2
x
e i i
x x ) min{1, }
(i i1 2
x
e i
judge: x x ),
2 (i i1
if it's true, x x , then
i1 i1 i i
goto i ) and walk for the next step x x ,x x ;
1 0 i1 i2
if not, goto ii ) and walk for the step x x again.
i i1
N
2 1 2 2
iiii). ={ 0 , 1, , i , , N }, calculate x i , 1,
N i 0
2 2
if ( x .eq. ) then
time stop!
16. 解:依题: 2 x 2 x
f (x) x e f (x)g (x), with f (x) x , g (x) e
1 1
g (x )
(
引入过渡概率: x x ) min{1, }.
x [0,4] g (x)
Metropolis 计算步骤:
----------------------- Page 9-----------------------
i). 选择初始位置: x 0, g (x 0) 1;
0 0 max
ii). [0,1], ( ) 1, L=4,
1 1
def. step L [0,4];
i 1
iii). [0,1], ( ) 1,
2 2
judge: x x ),
2 (i i1
if it's true, x x , then
i1 i1 i i
goto i ) and walk for the next step x x , , ;
x x
1 0 i1 i2
if not, goto ii ) and walk for the step xi xi1 again.
均值 { } , 方差 [ { }].
0 E 0 0 E 0
N N 1
4 N
2 x 1 2
iiii). ={ 0 , 1, , i , , N }, x e dx I= N i .
0 i 1
17. 解:依题,首先离散化区域D : 0 x 1,0 y 1.
1
则区域D 内任意正则点0 的势值: ( ).
0 1 2 3 4
4
随机游走步骤:
i). [0,1], ( ) 1;
1 1 3
ii). if( .or. 1) then
4 2 4
(n)
0 1
else
(n) 0
0
endif
iii). 0 N
重复从 点开始进行 次上述随机游走,则有
{ (1) (n) (N )}
: ,, ,,
0 0 0 0
N
(n)
0
n 1 2 N 2 2