add analytical derivation, make changes to corrisponding function, and new formating changes