calculated optimal degree