> restart;
> T:=proc(x)
  if (evalf(x-1/2)<0) then x/(1-x)
    else 2-1/x
  fi;
end proc; 

> TY:=proc(x)
  local y;
  y:=T(x);
  if (evalf(y-1/3)>0) then if (evalf(y-1/2)<0) then return(y) fi fi;
  return(TY(y));
end proc;

> a:=3/2-sqrt(5)/2; evalf(a); evalf(T(a)); evalf(T(T(a))); simplify(TY(a)-a);

> b:=1-sqrt(3)/3; evalf(b); evalf(T(b)); evalf(T(T(b))); evalf(T(T(T(b)))); simplify(TY(b)-b);

> phi:=proc(x)
  if (evalf(x-1/2)<0) then log(1-x) else log(x) fi;
end proc;

> phiY:=proc(x)
  local y;
  y:=T(x);
  if (evalf(y-1/3)>0) then if (evalf(y-1/2)<0) then return(phi(x)) fi fi;
  return(phi(x)+phiY(y));
end proc;

> c:=1-sqrt(6)/4; evalf(c); evalf(T(c)); evalf(T(T(c)));

> d:=TY(c); evalf(d); evalf(T(d)); evalf(T(T(d))); evalf(T(T(T(d)))); simplify(T(T(T(d)))-c);

> simplify(phiY(c)+phiY(d)-phiY(a)-phiY(b));

> factor(%);

> evalf(%);

>