Pengfei's function rolled into analytic_funcs