Q-switching and mode locking. TOPSS program. Disproportionate stratified random sampling formula. Quaternions definition.