# [SOLVED]Double Fourier series

#### dwsmith

##### Well-known member
$$\sum_{n = 1}^{\infty}\sum_{m = 1}^{\infty}A_{nm}\sin\frac{n\pi x}{L}\sin\frac{m\pi y}{H} = -\frac{4}{\pi}\sum_{k = 1}^{\infty}\frac{1}{(2k-1)\sinh\frac{\pi(2k-1)H}{L}}\sin\frac{\pi(2k-1)x}{L}\sinh\frac{\pi(2k-1)y}{L}$$
If I start with x on the left, can I then end up with:
$$\frac{L}{2}\sum_{m = 1}^{\infty}A_{nm}\sin\frac{m\pi y}{H} = -\frac{4L}{2\pi}\Rightarrow\sum_{m = 1}^{\infty}A_{nm}\sin\frac{m\pi y}{H} = -\frac{4}{\pi}$$
So
$$A_{nm} = -\frac{8}{H\pi}\int_0^H\sin\frac{m\pi y}{H}dy = \begin{cases} 0, & \text{if m is even}\\ -\frac{16}{m\pi^2}, & \text{if m is odd} \end{cases}$$
$$\frac{16}{\pi^2}\sum_{n = 1}^{\infty}\sum_{m = 1}^{\infty}\sin\frac{n\pi x}{L}\sin\frac{(2m-1)\pi y}{H} = \frac{4}{\pi}\sum_{k = 1}^{\infty}\frac{1}{(2k-1)\sinh\frac{\pi(2k-1)H}{L}}\sin\frac{\pi(2k-1)x}{L}\sinh\frac{\pi(2k-1)y}{L}$$
Is this true though?

Last edited:

#### dwsmith

##### Well-known member
$$\sum_{n = 1}^{\infty}\sum_{m = 1}^{\infty}A_{nm}\sin\frac{n\pi x}{L}\sin\frac{m\pi y}{H} = -\frac{4}{\pi}\sum_{k = 1}^{\infty}\frac{1}{(2k-1)\sinh\frac{\pi(2k-1)H}{L}}\sin\frac{\pi(2k-1)x}{L}\sinh\frac{\pi(2k-1)y}{L}$$
I don't think what I have done is correct. How can I solve this for the Fourier coefficient?

#### Ackbach

##### Indicium Physicus
Staff member
Typically, what's done is that you multiply the LHS by functions orthogonal to the ones you have in the sum, and perform the inner product (for the function case, it's likely an integral over the region of interest - I'm guessing $(0,L)$?) with respect to which the functions are orthogonal. Then the LHS collapses down to Kronecker deltas, and you're left with the integrals on the RHS with which you must contend.

#### dwsmith

##### Well-known member
Typically, what's done is that you multiply the LHS by functions orthogonal to the ones you have in the sum, and perform the inner product (for the function case, it's likely an integral over the region of interest - I'm guessing $(0,L)$?) with respect to which the functions are orthogonal. Then the LHS collapses down to Kronecker deltas, and you're left with the integrals on the RHS with which you must contend.
I understand that much.
But I don't know how to solve it. I tried something but it can't be right.
$$A_{nm} = -\frac{16}{\pi LH}\int_0^L\int_0^H\left(\sum_{k=1}^{\infty}\frac{\sin\frac{\pi(2k-1)x}{L}\sinh\frac{\pi(2k-1)y}{L}}{(2k-1)\sinh\frac{\pi(2k-1)H}{L}}\right)\sin\frac{n\pi x}{L}\sin\frac{m\pi y}{H}dydx$$
What can I do to simplify this?
Is this correct?
$$A_{nm} = -\frac{16}{\pi LH}\int_0^H\left(\sum_{k=1}^{\infty}\frac{\sinh \frac{\pi(2k-1)y}{L}}{(2k-1)\sinh\frac{\pi(2k-1)H}{L}}\int_0^L\sin\frac{\pi(2k-1)x}{L}\sin\frac{n\pi x}{L}dx\right)\sin\frac{m\pi y}{H}dy$$
and then that integral is $L/2$?

Last edited:

#### Ackbach

##### Indicium Physicus
Staff member
OK, so let's start at the beginning:
$$\sum_{n = 1}^{ \infty} \sum_{m = 1}^{ \infty}A_{nm} \sin \left( \frac{n \pi x}{L} \right) \sin \left( \frac{m \pi y}{H} \right) = -\frac{4}{ \pi} \sum_{k = 1}^{ \infty} \frac{1}{(2k-1) \sinh \left(\frac{\pi(2k-1)H}{L} \right) } \sin \left( \frac{ \pi(2k-1)x}{L} \right) \sinh \left( \frac{ \pi(2k-1)y}{L} \right).$$
The first thing to notice is that the dummy variables on the LHS are $n,m$, and on the RHS is $k$. Let's not collide our dummy variables. We multiply on the left by a function orthogonal to $\sin(n \pi x/L)$, which would be $\sin(p \pi x/L)$, and integrate on $(0,L)$ w.r.t. $x$. That is, we have
$$\sum_{n = 1}^{ \infty} \sum_{m = 1}^{ \infty}A_{nm} \left[ \int_{0}^{L} \sin \left( \frac{p \pi x}{L} \right) \sin \left( \frac{n \pi x}{L} \right)\,dx \right] \sin \left( \frac{m \pi y}{H} \right)$$
$$= -\frac{4}{ \pi} \sum_{k = 1}^{ \infty} \frac{1}{(2k-1) \sinh \left(\frac{\pi(2k-1)H}{L} \right) } \left[ \int_{0}^{L} \sin \left( \frac{p \pi x}{L} \right)\sin \left( \frac{ \pi(2k-1)x}{L} \right) \,dx \right] \sinh \left( \frac{ \pi(2k-1)y}{L} \right).$$
The integral on the LHS is
$$\int_{0}^{L} \sin \left( \frac{p \pi x}{L} \right) \sin \left( \frac{n \pi x}{L} \right)\,dx=\delta_{np}\,\frac{L}{2},$$
where $\delta_{np}$ is the Kronecker delta. So, what that does is collapse the whole $n$-sum on the LHS down to one term. That is, the LHS becomes
$$\frac{L}{2} \sum_{m = 1}^{ \infty}A_{pm} \sin \left( \frac{m \pi y}{H} \right).$$
By the same token, the integral on the RHS is
$$\int_{0}^{L} \sin \left( \frac{p \pi x}{L} \right)\sin \left( \frac{ \pi(2k-1)x}{L} \right) \,dx=\delta_{(2k-1)p}\,\frac{L}{2}.$$
So our entire equation is now
$$\frac{L}{2} \sum_{m = 1}^{ \infty}A_{pm} \sin \left( \frac{m \pi y}{H} \right) =-\frac{4}{ \pi} \sum_{k = 1}^{ \infty} \frac{1}{(2k-1) \sinh \left(\frac{\pi(2k-1)H}{L} \right) } \left[ \delta_{(2k-1)p}\,\frac{L}{2} \right] \sinh \left( \frac{ \pi(2k-1)y}{L} \right),$$
or
$$\sum_{m = 1}^{ \infty}A_{pm} \sin \left( \frac{m \pi y}{H} \right) =-\frac{4}{ \pi} \sum_{k = 1}^{ \infty} \frac{\delta_{(2k-1)p}}{(2k-1) \sinh \left(\frac{\pi(2k-1)H}{L} \right) } \sinh \left( \frac{ \pi(2k-1)y}{L} \right).$$
What does the Kronecker delta on the RHS do? Well, we're summing over $k$. Every time we get a $2k-1=p$, the term "counts", and otherwise, it doesn't. If $p$ is odd, then we get one term from the sum. If $p$ is even, we get no terms from the sum. Hence, the equation collapses down to
$$\sum_{m = 1}^{ \infty}A_{pm} \sin \left( \frac{m \pi y}{H} \right) =\begin{cases}-\frac{4}{ \pi} \frac{1}{p \sinh \left(\frac{p \pi H}{L} \right) } \sinh \left( \frac{p \pi y}{L} \right),\quad &p\;\text{odd}\\ 0,\quad &p\;\text{even}\end{cases}.$$
We can rewrite this as
$$\sum_{m = 1}^{ \infty}A_{(2p-1)m} \sin \left( \frac{m \pi y}{H} \right) =\frac{4}{ \pi} \frac{1}{(2p-1) \sinh \left(\frac{(2p-1) \pi H}{L} \right) } \sinh \left( \frac{(2p-1) \pi y}{L} \right).$$
Now I would just do the same thing again: multiply both sides by
$$\sin \left( \frac{q \pi y}{H} \right),$$
and integrate over $(0,H)$ w.r.t. $y$. What do you get?

IMPORTANT:
Do you have a typo on the original RHS? Should it be
$$-\frac{4}{ \pi} \sum_{k = 1}^{ \infty} \frac{1}{(2k-1) \sinh \left(\frac{\pi(2k-1)H}{L} \right) } \sin \left( \frac{ \pi(2k-1)x}{L} \right) \sinh \left( \frac{ \pi(2k-1)y}{H} \right)?$$
If so, that would make our equation come down to
$$\sum_{m = 1}^{ \infty}A_{(2p-1)m} \sin \left( \frac{m \pi y}{H} \right) =\frac{4}{ \pi} \frac{1}{(2p-1) \sinh \left(\frac{(2p-1) \pi H}{L} \right) } \sinh \left( \frac{(2p-1) \pi y}{H} \right),$$
which makes a lot more sense to me.

Last edited:

#### dwsmith

##### Well-known member

IMPORTANT:
Do you have a typo on the original RHS? Should it be
$$-\frac{4}{ \pi} \sum_{k = 1}^{ \infty} \frac{1}{(2k-1) \sinh \left(\frac{\pi(2k-1)H}{L} \right) } \sin \left( \frac{ \pi(2k-1)x}{L} \right) \sinh \left( \frac{ \pi(2k-1)y}{H} \right)?$$
If so, that would make our equation come down to
$$\sum_{m = 1}^{ \infty}A_{(2p-1)m} \sin \left( \frac{m \pi y}{H} \right) =\frac{4}{ \pi} \frac{1}{(2p-1) \sinh \left(\frac{(2p-1) \pi H}{L} \right) } \sinh \left( \frac{(2p-1) \pi y}{H} \right),$$
which makes a lot more sense to me.
No the RHS is a solution to the Laplace equation so the eigenvalue is the same as sine since it was $\lambda y$ and $\lambda x$ where $\lambda = \frac{\pi n }{L}$ but we can let $L, H= \pi$ if that would help.

#### Ackbach

##### Indicium Physicus
Staff member
No the RHS is a solution to the Laplace equation so the eigenvalue is the same as sine since it was $\lambda y$ and $\lambda x$ where $\lambda = \frac{\pi n }{L}$ but we can let $L, H= \pi$ if that would help.
Ok, that's a bit surprising, but we'll go from there.

I don't think it makes a whole lot of difference in terms of computational difficulty. I think you can integrate in a straight-forward manner either way. Might as well retain $L\not=H$ to make your solution more general. Of course, the answer will be different depending.

So what do you get for $A_{pq}$?

#### dwsmith

##### Well-known member
Ok, that's a bit surprising, but we'll go from there.

I don't think it makes a whole lot of difference in terms of computational difficulty. I think you can integrate in a straight-forward manner either way. Might as well retain $L\not=H$ to make your solution more general. Of course, the answer will be different depending.

So what do you get for $A_{pq}$?
$$A_{pq} = \frac{8L^2(-1)^q}{(2p-1)\pi^2((2p-1)^2H^2+L^2q^2)}$$
I dont think this is correct though.

Last edited:

#### Ackbach

##### Indicium Physicus
Staff member
Hmm. Two things:

1. I really should have asked what you got for $A_{(2p-1)q}$, not $A_{pq}$.

2. I got something a bit different from you. Could you please post your steps?

#### dwsmith

##### Well-known member
Hmm. Two things:

1. I really should have asked what you got for $A_{(2p-1)q}$, not $A_{pq}$.

2. I got something a bit different from you. Could you please post your steps?
I forgot a (2p-1)^2 but I just edited my original post.

#### Ackbach

##### Indicium Physicus
Staff member
I forgot a (2p-1)^2 but I just edited my original post.
I saw the edit. Your new result is much closer to mine, but it's still different. Maybe I computed it wrong, but I get $-q$ times your answer.

Double checking...

#### dwsmith

##### Well-known member
I saw the edit. Your new result is much closer to mine, but it's still different. Maybe I computed it wrong, but I get $-q$ times your answer.

Double checking...
In post 5, you forgot your - sign at the begin{cases} part and I forgot to type q too.

#### Ackbach

##### Indicium Physicus
Staff member
In post 5, you forgot your - sign at the begin{cases} part and I forgot to type q too.
You got it: we meet in the middle! So, final result is, I think:

$$A_{(2p-1)q}=\frac{8q}{\pi^{2}}\,\frac{(-1)^{q}L^{2}}{(2p-1)(H^{2}(2p-1)^{2}+q^{2}L^{2})},$$
and
$$A_{(2p)q}=0.$$

#### dwsmith

##### Well-known member
You got it: we meet in the middle! So, final result is, I think:

$$A_{(2p-1)q}=\frac{8q}{\pi^{2}}\,\frac{(-1)^{q}L^{2}}{(2p-1)(H^{2}(2p-1)^{2}+q^{2}L^{2})},$$
and
$$A_{(2p)q}=0.$$
But the solution doesn't seem right though. If I plot it varying time, at t = 0, the solution isn't 0. You don't see a time part since it was set to 0 to solve for the Fourier series.

#### Ackbach

##### Indicium Physicus
Staff member
Can you post the original PDE and your solution steps to get to the Fourier analysis problem in the OP?

#### dwsmith

##### Well-known member
Can you post the original PDE and your solution steps to get to the Fourier analysis problem in the OP?
Consider the 2-D diffusion equation subject to non-homogeneous boundary conditions
$$u(x,0,t) = 0,\quad u(0,y,t) = 0,\quad u(x,H,t) = 1,\quad u(L,y,t) = 0,$$
and an initial condition
$$u(x,y,0) = 0.$$

The steady state solution is $0 = u_{xx} + u_{yy}$, i.e. the Laplace equation.
\begin{alignat*}{3}
\varphi(x) & = & A\cos\lambda x + B\sin\lambda x\\
\psi(y) & = & C\cosh\lambda y + D\sinh\lambda y
\end{alignat*}
Using the boundary conditions on $x$, we now have $\varphi(x) = \sin\frac{\pi n x}{L}$. Using the $y = 0$ boundary condition on $\psi$, we have that $C = 0$ so the general solution is
$$u_{\text{ss}}(x,y) = \sum_{n = 1}^{\infty}B_n\sin\frac{\pi n x}{L}\sinh\frac{\pi n y}{L}.$$
Using the last $y$ boundary condition, we have
$$u_{\text{ss}}(x,H) = \sum_{n = 1}^{\infty}B_n\sin\frac{\pi n x}{L}\sinh\frac{\pi n H}{L} = 1.$$
That is,
\begin{alignat*}{3}
B_n & = & \frac{2}{L\sinh\frac{\pi n H}{L}}\int_0^L\sin\frac{\pi n x}{L}dx\\
& = & \begin{cases}
0, & \text{if n is even}\\
\frac{4}{n\pi\sinh\frac{\pi n H}{L}}, & \text{if n is odd}
\end{cases}
\end{alignat*}
Therefore, the steady state solution is
$$u_{\text{ss}}(x,y) = \frac{4}{\pi}\sum_{n = 1}^{\infty}\frac{1}{(2n - 1)\sinh\frac{\pi(2n - 1)H}{L}}\sin\frac{\pi(2n - 1)x}{L}\sinh\frac{\pi(2n - 1)y}{L}.$$

Let $u(x,y,t) = \tau(t)\phi(x,y)$. Then
$$\frac{1}{\alpha}\tau'\phi = \tau\phi_{xx} + \tau\phi_{yy}\Rightarrow\frac{\tau'}{\alpha\tau} = \frac{\phi_{xx} + \phi_{yy}}{\phi} = -k^2.$$
Thus, we have $\tau' + \alpha k^2\tau = 0$. Therefore, $\tau(t) = \exp(-\alpha k^2t)$. Next, let $\phi(x,y) = \varphi(x)\psi(y)$. Then
$$\varphi''\psi + \varphi\psi'' = -k^2\varphi\psi\Rightarrow\frac{\varphi''}{\varphi} = -\frac{\psi''}{\psi} - k^2 = -\mu^2.$$
That is,
\begin{alignat*}{3}
\varphi(x) & = & A\cos x\mu + B\sin x\mu\\
\psi(y) & = & C\cos y\sqrt{k^2 - \mu^2} + D\sin y\sqrt{k^2 - \mu^2}
\end{alignat*}
Using the boundary condition for $x$, we have $\varphi(L) = \sin L\mu = 0$ so $\mu = \frac{n\pi}{L}$ where $n\in\mathbb{Z}$. For the boundary conditions on $y$, we have $\psi(H) = \sin H\sqrt{k^2 - \mu^2} = 0$ so $k^2 = \left(\frac{n\pi}{L}\right)^2 + \left(\frac{m\pi}{H}\right)^2$ where $m\in\mathbb{Z}$. So the transient solution is
$$u_{\text{trans}}(x,y,t) = \sum_{n = 1}^{\infty}\sum_{m = 1}^{\infty}A_{nm}e^{-\alpha k^2t}\sin\frac{n\pi x}{L}\sin\frac{m\pi y}{H},\quad k^2 = \left(\frac{n\pi}{L}\right)^2 + \left(\frac{m\pi}{H}\right)^2.$$

#### dwsmith

##### Well-known member
Consider the 2-D diffusion equation subject to non-homogeneous boundary conditions
$$u(x,0,t) = 0,\quad u(0,y,t) = 0,\quad u(x,H,t) = 1,\quad u(L,y,t) = 0,$$
and an initial condition
$$u(x,y,0) = 0.$$

The steady state solution is $0 = u_{xx} + u_{yy}$, i.e. the Laplace equation.
\begin{alignat*}{3}
\varphi(x) & = & A\cos\lambda x + B\sin\lambda x\\
\psi(y) & = & C\cosh\lambda y + D\sinh\lambda y
\end{alignat*}
Using the boundary conditions on $x$, we now have $\varphi(x) = \sin\frac{\pi n x}{L}$. Using the $y = 0$ boundary condition on $\psi$, we have that $C = 0$ so the general solution is
$$u_{\text{ss}}(x,y) = \sum_{n = 1}^{\infty}B_n\sin\frac{\pi n x}{L}\sinh\frac{\pi n y}{L}.$$
Using the last $y$ boundary condition, we have
$$u_{\text{ss}}(x,H) = \sum_{n = 1}^{\infty}B_n\sin\frac{\pi n x}{L}\sinh\frac{\pi n H}{L} = 1.$$
That is,
\begin{alignat*}{3}
B_n & = & \frac{2}{L\sinh\frac{\pi n H}{L}}\int_0^L\sin\frac{\pi n x}{L}dx\\
& = & \begin{cases}
0, & \text{if n is even}\\
\frac{4}{n\pi\sinh\frac{\pi n H}{L}}, & \text{if n is odd}
\end{cases}
\end{alignat*}
Therefore, the steady state solution is
$$u_{\text{ss}}(x,y) = \frac{4}{\pi}\sum_{n = 1}^{\infty}\frac{1}{(2n - 1)\sinh\frac{\pi(2n - 1)H}{L}}\sin\frac{\pi(2n - 1)x}{L}\sinh\frac{\pi(2n - 1)y}{L}.$$

Let $u(x,y,t) = \tau(t)\phi(x,y)$. Then
$$\frac{1}{\alpha}\tau'\phi = \tau\phi_{xx} + \tau\phi_{yy}\Rightarrow\frac{\tau'}{\alpha\tau} = \frac{\phi_{xx} + \phi_{yy}}{\phi} = -k^2.$$
Thus, we have $\tau' + \alpha k^2\tau = 0$. Therefore, $\tau(t) = \exp(-\alpha k^2t)$. Next, let $\phi(x,y) = \varphi(x)\psi(y)$. Then
$$\varphi''\psi + \varphi\psi'' = -k^2\varphi\psi\Rightarrow\frac{\varphi''}{\varphi} = -\frac{\psi''}{\psi} - k^2 = -\mu^2.$$
That is,
\begin{alignat*}{3}
\varphi(x) & = & A\cos x\mu + B\sin x\mu\\
\psi(y) & = & C\cos y\sqrt{k^2 - \mu^2} + D\sin y\sqrt{k^2 - \mu^2}
\end{alignat*}
Using the boundary condition for $x$, we have $\varphi(L) = \sin L\mu = 0$ so $\mu = \frac{n\pi}{L}$ where $n\in\mathbb{Z}$. For the boundary conditions on $y$, we have $\psi(H) = \sin H\sqrt{k^2 - \mu^2} = 0$ so $k^2 = \left(\frac{n\pi}{L}\right)^2 + \left(\frac{m\pi}{H}\right)^2$ where $m\in\mathbb{Z}$. So the transient solution is
$$u_{\text{trans}}(x,y,t) = \sum_{n = 1}^{\infty}\sum_{m = 1}^{\infty}A_{nm}e^{-\alpha k^2t}\sin\frac{n\pi x}{L}\sin\frac{m\pi y}{H},\quad k^2 = \left(\frac{n\pi}{L}\right)^2 + \left(\frac{m\pi}{H}\right)^2.$$
Is there something wrong here that is causing problems with solving the double Fourier series?

#### dwsmith

##### Well-known member
For t = 0, the solution should be zero. I am not getting zero. Here is the code:
There has to be something wrong with the coefficient for the double fourier series.
Code:
ClearAll["Global*"];
Nmax = 13;
Mmax = 13;
Jmax = 13;
\[Lambda] = Table[Pi*(2*n - 1)/L, {n, 1, Nmax}];
\[Gamma] = Table[Pi*m/H, {m, 1, Mmax}];
L = Pi;
H = Pi;
\[Alpha] = 1;

u[x_, y_] =
4/Pi*Sum[1/((2*j - 1)*Sinh[Pi*(2*j - 1)*H/L])*Sin[Pi*(2*j - 1)/L*x]*
Sinh[Pi*(2*j - 1)/L*y], {j, 1, Jmax}];

h[x_, y_, t_] =
u[x, y] +
8/Pi^2*Sum[
m*(-1)^m/((2*n - 1)*((2*n - 1)^2 + m^2))*Sin[Pi*(2*n - 1)/L*x]*
Sin[Pi*m/H*y]*
E^{-\[Alpha]*((Pi*(2*n - 1)/L)^2 + (Pi*m/H)^2)*t}, {n, 1,
Nmax}, {m, 1, Mmax}];

Manipulate[
Plot3D[h[x, y, t], {x, 0, Pi}, {y, 0, Pi}, Boxed -> False,
ColorFunction -> "Rainbow", Mesh -> None,
PlotRange -> {-.3, 1.3}], {t, 0, 100, .01}]`