Use higher-order derivative for heat capacity

  - Also fix compilation error for zlog1p