MODE R = REAL; MODE S = STRUCT(R c, [~]R m); OP * = (R s, []R r)[]R: ( INT n = UPB r; [n]R t; FOR j TO n DO t[j] := s*r[j] OD; t); PROC c = ([]R a)S: (INT n = UPB a; S bt = (R p:=1, b := 0; FOR j TO n DO p *:= a[j]*j; b +:= a[j]**2 OD; (1/p, ([n]R t; FOR j TO n DO t[j] := 1/(p*a[j]*(n+1)) OD; t))); PROC r = (R b, INT j)S: (b<0 | (0, ~) | (j=0 | R t = b**n; (t*c OF bt, b*t*m OF bt) | S s0 = r(b, j-1), s1 = r(b - a[j], j-1); (c OF s1 = 0 | s0 | (c OF s0 - c OF s1, ([n]R t; FOR k TO n DO t[k] := (m OF s0)[k] - (m OF s1)[k] OD; t[j] -:= c OF s1; t))))); r(1, n)); PROC cn = ([]R a)S: (INT n = UPB a; INT q := 0; FOR j TO n DO (a[j] < 0 | q := j) OD; IF q = 0 THEN c(a) ELSE [n]R na; FOR j TO n DO na[j] := (j=q | a[j]/(a[j]-1) | a[j]/(1-a[q])) OD; S s = cn(na); (c OF s, ([n]R nm := m OF s; nm[q] := c OF s - (m OF s)[q]; nm)) FI); (0=0 | print(("S= ", cn( (1, 1/3, 1/4) ))) | MODE TC = STRUCT([~]R t, S a); PROC ts = (R t)TC: #0 1.e-13 THEN print(("Foul m: ", j, k, (m OF s)[k], (m OF a OF t[j])[k], newline))FI OD) OD)