Added formula for q

Closes #23192