To compute this formula, you need to do:
Actually, to make it simpler, we can do Vectorization, that formula is actually equals to:
So we can code it as:
More example: