the Mapping Algorithm

in the C code is a bit obscure

I couldn't quite remember how I derived it

so I did it again...
with a simpler result this time
that is equivalent to the other
after canceling a lot of terms

and probably faster
in code form