elif or if?  It's not a crear for me why you ignore integral limits here.