I've attached a picture about my problem. It seems my code calculates the wrong values, and I don't know, why.