\\ 20894 Menezes/, 182. t_autocorr (v,d) = {my (s=0,n=#v); for (i=1,n-d,s+=(v[i]!=v[i+d])); s} t_erf (x) = 1-erfc(x) \\ Frequencies of elements in vector v. t_frequencies (v) = {my (el,h,A,i); el=[]; h=[]; for (j=1,#v, x=v[j]; if (i=t_pos(x,el),h[i]++,\ el=concat(el,[x]); h=concat(h,[1]))); A=matrix(#el,2,i,j,if(j==1,el[i],h[i])); vecsort(A~,2,4)} \\ Maximum of forward partial |sums|. t_maxsum (v) = {my (s=0,m=0); for (i=1,#v, s+=v[i]; sa=abs(s); if (sa>m,m=sa)); m} \\ If necessary, add 0.0 for obtaining a real number. t_mean (v) = vecsum(v)/#v \\ If necessary, add 0.0 for obtaining a real number. t_median (v) = {my (n); v=vecsort(v); n=#v; if (n%2,v[n\2+1],(v[n/2]+v[n/2+1])/2)} \\ N(0,1). t_Phi (x) = 0.5*(1+t_erf(x/sqrt(2)))