Mathematical algorithms