I did some preliminary work on this today, and opened an issue to help you keep track of progress. (It may take me a little while to find the time to do it. )
Edit: I’ve opened a draft pull request that contains the two formulas so you can take a look now. There are no supporting files, README but I don’t doubt you’ll find your way browsing the code for now. The PR is linked in the issue.
Temporary shorcuts: