=================================================================== RCS file: /home/cvs/OpenXM/src/asir-port/cgi/r-fd.rr,v retrieving revision 1.3 retrieving revision 1.8 diff -u -p -r1.3 -r1.8 --- OpenXM/src/asir-port/cgi/r-fd.rr 2014/07/31 07:00:41 1.3 +++ OpenXM/src/asir-port/cgi/r-fd.rr 2015/02/28 11:39:13 1.8 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/asir-port/cgi/r-fd.rr,v 1.2 2014/07/31 06:24:11 takayama Exp $ */ +/* $OpenXM: OpenXM/src/asir-port/cgi/r-fd.rr,v 1.7 2015/02/25 04:47:50 takayama Exp $ */ load("tk_fd.rr")$ import("tk_r.rr")$ import("oh_number.rr")$ @@ -11,12 +11,22 @@ def r_d2rat(Y) { S = rtostr(Y); Y = "eval(("+S+")*exp(0));"; /* print(Y); */ Y = eval_str(Y); - return oh_number.rats(Y); + /* printf("Y=%a\n",Y); */ + /* return oh_number.rats(Y); */ + return rats2(Y); /* temporary */ }else return Y; } def r_ahvec(A,B,C,Y) { Y = r_d2rat(Y); - R=tk_fd.ygahvec(A,B,C,Y|all=1); + Ans=a_ahvec(A,B,C,Y); + /* Fans=map(rtostr,map(tk_fd.tk_number_rattofloat,Ans)); */ + Fans=map(deval,Ans); + Fans = tk_r.asir2r_c(Fans); + return Fans; +} + +def a_ahvec(A,B,C,Y) { + R=tk_fd.ahvec_abc(A,B,C,Y|all=1); Gamma=R[1]; Der=R[0]; Z=R[2]*Gamma; @@ -24,9 +34,71 @@ def r_ahvec(A,B,C,Y) { for (I=0; I 0.0000001) { + printf("error: X = %a, Y=%a\n",X,Y); + } + } +} + +def a_expect(A,B,C,Y) { + E=tk_fd.expectation_abc(A,B,C,Y); + return(E); +} +def r_expect(A,B,C,Y) { + Y = r_d2rat(Y); + E=a_expect(A,B,C,Y); + Fans=map_deval(E); Fans = tk_r.asir2r_c(Fans); return Fans; +} + +def r_ahmat(A,B,C,Y) { + Y = r_d2rat(Y); + Ans=a_ahmat(A,B,C,Y); + Fans=map_deval(Ans); + Fans = tk_r.asir2r_c(Fans); + return Fans; +} + +def a_ahmat(A,B,C,Y) { + return(tk_fd.ahmat_abc(A,B,C,Y)); +} + +def r_log_ahmat(A,B,C,Y) { + Y = r_d2rat(Y); + Ans=a_log_ahmat(A,B,C,Y); + Fans=map_deval(Ans); + Fans = tk_r.asir2r_c(Fans); + return Fans; +} + +def a_log_ahmat(A,B,C,Y) { + Ans=tk_fd.log_ahmat_abc(A,B,C,Y); + return Ans; +} + +def map_deval(L) { + if (type(L) >=4) return(map(map_deval,L)); + return(deval(L)); } end$