Annotation of OpenXM/src/ox_gsl/assert2.rr, Revision 1.2
1.2 ! takayama 1: /* $OpenXM: OpenXM/src/ox_gsl/assert2.rr,v 1.1 2018/06/06 07:40:32 takayama Exp $ */
1.1 takayama 2: #define myfail(s) printf("%a fails, Ans0=%a, Ans=%a\n",s,Ans0,Ans)
1.2 ! takayama 3: #define dcmp2(a,b,e) (deval(abs(1-a/b))>e?1:0)
1.1 takayama 4: Pid=ox_launch(0,getenv("OpenXM_HOME")+"/src/ox_gsl/ox_gsl");
5: // Try 1.
6: //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]);
7: //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]);
1.2 ! takayama 8: ox_cmo_rpc(Pid,"gsl_monte_plain_integrate",quote(x0*x1*x2),[0,0,0],[3.14,3.14,3.14]);
1.1 takayama 9: Ans=ox_pop_cmo(Pid);
1.2 ! takayama 10: Ans0=[119.8]$
! 11: if (dcmp2(Ans[0],Ans0[0],0.1)) myfail("Try1 "); else ;
! 12: // Try2
! 13: ox_cmo_rpc(Pid,"gsl_monte_vegas_integrate",quote(x0*x1*x2),[0,0,0],[3.14,3.14,3.14],10000); // 10000 samples.
! 14: Ans=ox_pop_cmo(Pid);
! 15: Ans0=[119.8]$
! 16: if (dcmp2(Ans[0],Ans0[0],0.1)) myfail("Try2 "); else ;
! 17: // Try3
! 18: 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);
! 19: Ans=ox_pop_cmo(Pid);
! 20: Ans0=[1.3932039296856768591842462603255]$
! 21: if (dcmp2(Ans[0],Ans0[0],0.01)) myfail("Try3 "); else ;
1.1 takayama 22: end$
1.2 ! takayama 23:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>