08/02/2018, 09:33 AM
(This post was last modified: 08/02/2018, 09:35 AM by Xorter.
Edit Reason: grammar
)
(08/02/2018, 04:29 AM)11Keith22 Wrote: What does the term "n-twise" mean? The terms would seem to be montwise, ditwise, tritwise, quitwise, etc., which I don't fully understand the meaning of in relation to the mod operator, which is always binary. I am probably missing something obvious here, but oh well.
n-twise means n-ary digit-wise. For instance:
utwise digits can be only: 1. (This is an ut.)
bitwise digits can be: 0, 1. (These are bits.)
tritwise digits can be: 0, 1, 2. (These are trits.)
tetratwise digits can be: 0, 1, 2, 3. (These are tetrats.)
pentatwise digits can be: 0, ..., 4. (These are pentats.)
and so on...
(Somewhy I prefer to the expression u- to mono-. It means one. The expression a- means zero. But I cannot find atwise digits (ats) senseful.)
So if I talk about an n-twise operator, then it means I convert its arguments to n-ary number system and then do the operator.
Let us see how it works in code pari-gp:
Code:
mod(x,y)=x-y*floor(x/y);
bttest(x,n,b)=if(x==0,0,digits(floor(x*b^50),b)[n]);
blength(x,b)=if(x==0,1,floor(real(log(x)/log(b)))+1);
h=50;
xorter(x,y)=sum(k=1,h+blength(max(x,y),3),3^(h+blength(max(x,y),3)-k)*mod(if(x==0,0,iferr(digits(floor(x*3^h),3)[k],err,0))+if(y==0,0,iferr(digits(floor(y*3^h),3)[k],err,0)),3))/3.0^h;
xorb(x,y,b)=sum(k=1,h+blength(max(x,y),b),b^(h+blength(max(x,y),b)-k)*mod(if(x==0,0,iferr(digits(floor(x*b^h),b)[k],err,0))+if(y==0,0,iferr(digits(floor(y*b^h),b)[k],err,0)),b))/b^h*1.0;You can try it, or just plot it. E. g. ploth(x=0,10,xorter(x,3*x)) returns with a nice fractal-function.
Hope it helped to understand. Be brave to ask me.
Xorter Unizo

