# Laplace equation in unit square

I would like to solve the $\triangle u(x,y) = 0$ in the unit square, with periodic BC when $x=0,1$ and Neumann condition when $y=0,1$ $$\partial_y u(x,0) = \begin{cases} A \quad &\text{for } 0\leq x\leq L\\ B \quad &\text{for } L<x\leq 1\\ \end{cases}\quad \partial_y u(x,1) = \begin{cases} B \quad &\text{for } 0\leq x\leq 1-L\\ A \quad &\text{for } 1-L<x\leq 1\\ \end{cases}$$ We also fix $u(0,0) = 0$ to make the solution unique.

The hint said instead of considering Green's functions or separation of variables, think about simple solutions of $\triangle u = 0$, draw a picture consider the solution in different parts of the domain and derive jump conditions to connect the solutions.

My attempt: Here let us call $$g(x) = \begin{cases} A \quad &\text{for } 0\leq x\leq L\\ B \quad &\text{for } L<x\leq 1\\ \end{cases}$$ and note that the Nuemann condition at $z=0$ is $g(x)$, and at $z=1$ is $g(1-x)$.

If provided $g(x) = \sum_n a_n \cos(n\pi x)$ (point-wise or uniform), we can define $$u(x,y) = \sum_n a_n \frac{\sin(n\pi x - n\pi y)}{-n\pi}.$$ (I realized this $u$ is not harmonic) $u$ is periodic when $x=0,1$, and
$$\partial_y u(x,0) = \sum _n a_n \cos(n\pi x) = g(x)$$ and $$\partial_y u(x,1) = \sum _n a_n \cos(n\pi (x - 1))=\sum _n a_n \cos(n\pi (1-x)) = g(1-x).$$

But I am not sure if we can find a cosine series which pointwise converges to $g(x)$, how could we fix this? I think I have $L^2$ convergence $$\sum_n a_n \cos(n\pi x) \rightarrow g \text{ in } L^2$$ which means I have pointwise a.e. convergence because of the summation.