Logic should appear in only one place.
Keep it DRY: don’t repeat yourself.
Comments should explain why, not what or how. If the reader needs to know what the formula is for this code, they should look at the source code, not the comments. If they want to know why that algorithm was chosen over some other, then they should find that answer in the comments.