weilinhy 发表于 2008-6-20 21:41

1stOpt遇到的问题

Constant N=893617900, M1=313148160, M2=297872640, X1=7.96, X2=6.93,tuo=2,S=11.430,sigmas=0.4938,r=0.0252;
Function
sigmas-(V*sigmav/S)* ( 1/N -(M1/N)* ( ( normcdf(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo))))- 1) /(N+M1+M2) +M2* ( normcdf(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))) -1 ) / ((N+M1)*(N+M1+M2)) ) -(M2/N)*( normcdf(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo))))/(N+M1+M2) + M1*normcdf(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo))))/ ((N+M2)*(N+M1+M2)) ) ) ;

S*N-V + M1*( (1/(N+M1+M2)) * ( exp(-r*tuo)* (N*X1+M2*(X1-X2)) * normcdf( -(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo))) -sigmav*sqrt(tuo)) ) -V* normcdf( -(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo))))) ) + (M2/((N+M2)*(N+M1+M2))) *( exp(-r*tuo)* (N*X2-M1*(X1-X2))* normcdf( -(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo))) -sigmav*sqrt(tuo)) ) -V* normcdf( -(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))) ) ) ) + M2* ( (1/(N+M1+M2))* (V* normcdf(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))) -exp(-r*tuo)* (N*X2-M1*(X1-X2)) * normcdf(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))-sigmav*sqrt(tuo)) ) + (M1/((N+M2)*(N+M1+M2))) * (V* normcdf(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))) -exp(-r*tuo)* (N*X1+M2*(X1-X2)) * normcdf(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))-sigmav*sqrt(tuo)) ) ) ;


W1= (1/(N+M1+M2)) * ( exp(-r*tuo)* (N*X1+M2*(X1-X2)) * normcdf( -(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo))) -sigmav*sqrt(tuo)) ) -V* normcdf( -(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo))))) ) + (M2/((N+M2)*(N+M1+M2))) *( exp(-r*tuo)* (N*X2-M1*(X1-X2))* normcdf( -(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo))) -sigmav*sqrt(tuo)) ) -V* normcdf( -(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))) ) ) ;

W2= (1/(N+M1+M2))* (V* normcdf(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))) -exp(-r*tuo)* (N*X2-M1*(X1-X2)) * normcdf(((log(V/(N*X2-M1*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))-sigmav*sqrt(tuo)) ) + (M1/((N+M2)*(N+M1+M2))) * (V* normcdf(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))) -exp(-r*tuo)* (N*X1+M2*(X1-X2)) * normcdf(((log(V/(N*X1+M2*(X1-X2)))+(r+1/2*sigmav*sigmav)*tuo)/(sigmav*sqrt(tuo)))-sigmav*sqrt(tuo)) )


怎么结果会成
v: 6937220930.16085
sigmav: -8.00972547285533
w1: -5.76319488865101
w2: -4.94203761626664
负数肯定不对 哪位同学解释下 谢谢

[ 本帖最后由 weilinhy 于 2008-6-20 21:44 编辑 ]
页: [1]
查看完整版本: 1stOpt遇到的问题