As far as I understand, you've made two mistake which do not satisfy your task. Well, I seggest you adding b = 2pi/3 to the first gap instead of what you add in the previous effort. Then, to solve the next part, I would change f on 8/sqrt(3)*cospi
I bet that this answer will sort everything out. Regards!