version 1.1, 2018/06/06 07:40:32 |
version 1.2, 2018/06/07 01:53:33 |
|
|
/* $OpenXM$ */ |
/* $OpenXM: OpenXM/src/ox_gsl/assert2.rr,v 1.1 2018/06/06 07:40:32 takayama Exp $ */ |
#define myfail(s) printf("%a fails, Ans0=%a, Ans=%a\n",s,Ans0,Ans) |
#define myfail(s) printf("%a fails, Ans0=%a, Ans=%a\n",s,Ans0,Ans) |
#define dcmp(a,b) (deval(abs(1-a/b))<1e-10?1:0) |
#define dcmp2(a,b,e) (deval(abs(1-a/b))>e?1:0) |
Pid=ox_launch(0,getenv("OpenXM_HOME")+"/src/ox_gsl/ox_gsl"); |
Pid=ox_launch(0,getenv("OpenXM_HOME")+"/src/ox_gsl/ox_gsl"); |
// Try 1. |
// Try 1. |
//ox_cmo_rpc(Pid,"gsl_monte_plain_integrate",quote(1/(3.14^3*(1-cos(x0)*cos(x1)*cos(x2)))),[0.0,0.0,0.0],[3.14,3.14,3.14]); |
//ox_cmo_rpc(Pid,"gsl_monte_plain_integrate",quote(1/(3.14^3*(1-cos(x0)*cos(x1)*cos(x2)))),[0.0,0.0,0.0],[3.14,3.14,3.14]); |
//ox_cmo_rpc(Pid,"gsl_monte_plain_integrate",quote(1/(3.14^3*(1-cos(x0)*cos(x1)*cos(x2)))),[0.01,0.01,0.01],[3.14,3.14,3.14]); |
//ox_cmo_rpc(Pid,"gsl_monte_plain_integrate",quote(1/(3.14^3*(1-cos(x0)*cos(x1)*cos(x2)))),[0.01,0.01,0.01],[3.14,3.14,3.14]); |
ox_cmo_rpc(Pid,"gsl_monte_plain_integrate",quote(x0*x1*x2),[0.01,0.01,0.01],[3.14,3.14,3.14]); |
ox_cmo_rpc(Pid,"gsl_monte_plain_integrate",quote(x0*x1*x2),[0,0,0],[3.14,3.14,3.14]); |
Ans=ox_pop_cmo(Pid); |
Ans=ox_pop_cmo(Pid); |
|
Ans0=[119.8]$ |
|
if (dcmp2(Ans[0],Ans0[0],0.1)) myfail("Try1 "); else ; |
|
// Try2 |
|
ox_cmo_rpc(Pid,"gsl_monte_vegas_integrate",quote(x0*x1*x2),[0,0,0],[3.14,3.14,3.14],10000); // 10000 samples. |
|
Ans=ox_pop_cmo(Pid); |
|
Ans0=[119.8]$ |
|
if (dcmp2(Ans[0],Ans0[0],0.1)) myfail("Try2 "); else ; |
|
// Try3 |
|
ox_cmo_rpc(Pid,"gsl_monte_vegas_integrate",quote(1/(3.14^3*(1-cos(x0)*cos(x1)*cos(x2)))),[0.0,0.0,0.0],[3.14,3.14,3.14],10000); |
|
Ans=ox_pop_cmo(Pid); |
|
Ans0=[1.3932039296856768591842462603255]$ |
|
if (dcmp2(Ans[0],Ans0[0],0.01)) myfail("Try3 "); else ; |
end$ |
end$ |
Ans0=[1.05129e+06,-2.1069,0]$ |
|
if (dcmp(Ans[0],Ans0[0])) myfail("Try1 real"); else ; |
|
if (dcmp(Ans[1],Ans0[1])) myfail("Try1 im"); else ; |
|