Triplet states and optical absorptions in finite polyenes and conjugated polymers