Two-scale mathematics and fractional calculus for thermodynamics