implemented log Z