Chebyshev differentiation matrices, boundary condition Good afternoon everyone and thanks in advance for any help,
Context:
I am currently dealing with an equation (Orr-Sommerfeld), which for simplicity I reduced to the following form

$ \frac{\partial}{\partial t} V= \frac{\partial^4 }{\partial y^4} V+
\frac{\partial^2 }{\partial y^2} V$,

applied on a vector $V(y, t)$, which can be discretized in $y$ on $[-1, +1]$ with the Chebyshev series.
This discretisation allows me to write the $y$-differentation for order $n$ as

$\frac{\partial^n }{\partial y^n} V= D^n V$.

I need to apply clamped boundary condition which involves applying both:


*

*Dirichlet condition, 



$V(y=+1) = V(y=-1) = 0$



*

*Neumann condition,



$\frac{\partial }{\partial y} V(y=+1) = \frac{\partial }{\partial y} V(y=-1) = 0$

Both boundary conditions can be applied through matrices $D^n$.
For Dirichlet, putting to zero first row, last row, first column and last column.
For Neumann, using the method "cheb4c" of the Matlab package, which provides $D^4$ with Dirichlet and Neumann boundary condition (so, clamped).
Question:
The package does not provide $D, D^2$ and $D^3$ for clamped boundary condition.
Thus, I am wondering if the Neumann boundary condition has an influence on these matrices, or just for differentiation matrices of order $4$ and superior.
I do not really understand the impact of the Neumann condition on the differentiation matrices...
Is matrix $D^2$ the same for Dirichlet and for clamped (Dirichlet + Neumann) boundary condition ? It looks strange to me.
My track:
The pseudo-solution I found is to modify the method 'cheb4c' of the package to give $D, D^2, D^3, D^4 $ with the clamped boundary condition. However, I don't know if the mathematics and code are valid for order 1, 2 and 3 as it is made to only return the 4th order.
In that case, $D^n_{Dirichlet}$ is different from $D^n_{Dirichlet + Neumann}$.
I will try to go through the code and math precisely and to try with simple example, but it someone knows already dealt with that before...
Thanks !
 A: From the papers ofHuang Sloan 1994:
$V$ is imposed a clamped boundary condition, which implied Dirichlet and Neumann boundary.
This condition is computed through the definition of the set of differentiation matrices $\{D^n\}_n$.
The set $\{D^n\}_n$ is actually built from interpolation polynomials which satisfies these boundary conditions.
Each condition is associated to a different polynomial (Chebyshev, Legendre... series of multiple sizes depending on the condition).
Computationally, it is necessary to impose different boundary conditions on $D^2$ than the ones on $D^4$, and thus to use two different polynomials to define them.
Why ?
On a long-tiem period, 4th order PDE can be reformulated under the following form :
\begin{equation}
v'''' = v'',
\end{equation}
with ' the y-differentiation, which leads to the following expressions with the differentiation matrices:
\begin{equation}
D^4 v = D^2 v,
\end{equation}
and finally:
\begin{equation}
v = (D^4)^{-1} D^2 v = B v.
\end{equation}
If the matrices $D^2$ and $D^4$ possess the same boundary conditions, it is possible to write $D^4 = (D^2)^2$, which follows 
\begin{equation}
B = (D^4)^{-1} D^2 = (D^2)^{-1} (D^2)^{-1} D^2 = (D^2)^{-1}.
\end{equation}
This matrix $D^2$ is nearly singular, and results in spurious (non-well resolved) eigenvalues in $B$.
Using two different boundary condition for $D^2$ and $D^4$ implies that the matrix $B$ is definite, which is not a sufficient but necessary condition in order to eliminate spurious modes, and prevents $B$ to be nearly singular.
For example, it I take the OSS model, it is either possible to define $D^4$ with clamped BCs and $D^2$ with Dirichlet BCs, or $D^4$ with Dirichlet and $D^2$ with clamped, and I obtain the usual eigenvalues. If I impose the same BC on $D^4$ and $D^2$ (either both Dirichlet or both clamped), the eigenvalues found are not well-resolved.
