# DEigenvalues with Robin B.C. sign problem

To find eigenvalues for $y''=\lambda y$ with robin boundary conditions on one end, and Dirichlet on the other end, I am getting correct value when robin B.C. on the right side, but when I flip things, and put robin on the left side, Mathematica does not give correct eigenvalues. It seems like a sign issue again.

Robin on the right side

Finding eigenvalues for \begin{align*} y^{\prime\prime}+\lambda y & =0\\ y^{\prime}\left( 1\right) +y\left( 1\right) & =0\\ y(0) & =0 \end{align*}

Code

ClearAll[y,x];
op={-y''[x]+NeumannValue[y[x],x==1],DirichletCondition[y[x]==0,x==0]};
eig=DEigenvalues[op,y[x],{x,0,1},6]//N


The eigenvalues are given by roots of $\tan\sqrt\lambda+\sqrt\lambda$

 NSolve[Tan[Sqrt[lam]]+Sqrt[lam]==0&& 0< lam<303,lam]


Which is correct.

Robin on the left side

Same code as above, just switch the B.C.

\begin{align*} y^{\prime\prime}+\lambda y & =0\\ y^{\prime}\left( 0\right) +y\left( 0\right) & =0\\ y(1) & =0 \end{align*}

code

ClearAll[y,x];
op={-y''[x]+NeumannValue[y[x],x==0],DirichletCondition[y[x]==0,x==1]};
eig=DEigenvalues[op,y[x],{x,0,1},6]//N


Now eigenvalues are roots of $\tan\sqrt\lambda-\sqrt\lambda$

 NSolve[Tan[Sqrt[lam]]-Sqrt[lam]==0&& 0<= lam<400,lam]


You can see they are not the same. By trial and error, I found that changing the code to be

op={-y''[x]+NeumannValue[-y[x],x==0],DirichletCondition[y[x]==0,x==1]};
eig=DEigenvalues[op,y[x],{x,0,1},6]//N


Now it gives the correct eigenvalues !

Question is: Why with robin on right side NeumannValue[y[x],x==1] works but needed a minus sign when robin on left side NeumannValue[-y[x],x==0] ?

This is very confusing. Only reference I saw is http://reference.wolfram.com/language/ref/NeumannValue.html

Where it says

So following the above, the robin conditions above is $y'(x)=-y(x)$ which means it should be NeumannValue[-y[x],x==0] But if using this convention for first example above will now give wrong result:

op={-y''[x]+NeumannValue[-y[x],x==1],DirichletCondition[y[x]==0,x==0]};
eig=DEigenvalues[op,y[x],{x,0,1},6]//N


Which is wrong.

So the question is, which is it? NeumannValue[-y[x],x==location] or NeumannValue[y[x],x==location] ?

## Appendix

If you need derivation of eigenvalues, please see below

Robin on right end:

Finding eigenvalues for \begin{align*} y^{\prime\prime}+\lambda y & =0\\ y^{\prime}\left( 1\right) +y\left( 1\right) & =0\\ y(0) & =0 \end{align*}

For $\lambda>0$ the solution is $$y=A\cos\sqrt{\lambda}x+B\sin\sqrt{\lambda}x$$

Hence $y^{\prime}\left( x\right) =-A\sqrt{\lambda}\sin\left( \sqrt{\lambda }x\right) +B\sqrt{\lambda}\cos\left( \sqrt{\lambda}x\right)$. Applying first B.C. gives

\begin{align} -A\sqrt{\lambda}\sin\sqrt{\lambda}+B\sqrt{\lambda}\cos\sqrt{\lambda}% +A\cos\sqrt{\lambda}+B\sin\sqrt{\lambda} & =0\nonumber\\ B\left( \sqrt{\lambda}\cos\sqrt{\lambda}+\sin\sqrt{\lambda}\right) +A\left( \cos\sqrt{\lambda}--\sqrt{\lambda}\sin\sqrt{\lambda}\right) & =0\tag{1} \end{align}

Applying second B.C. gives

$$0=A\tag{2}%$$

Hence (1) becomes

\begin{align*} B\left( \sqrt{\lambda}\cos\sqrt{\lambda}+\sin\sqrt{\lambda}\right) & =0\\ \tan\sqrt{\lambda}+\sqrt{\lambda} & =0 \end{align*}

Robin on left end:

Finding eigenvalues for \begin{align*} y^{\prime\prime}+\lambda y & =0\\ y^{\prime}\left( 0\right) +y\left( 0\right) & =0\\ y(1) & =0 \end{align*}

Assuming $\lambda>0$ the solution is $$y=A\cos\sqrt{\lambda}x+B\sin\sqrt{\lambda}x$$

Hence $y^{\prime}\left( x\right) =-A\sqrt{\lambda}\sin\left( \sqrt{\lambda }x\right) +B\sqrt{\lambda}\cos\left( \sqrt{\lambda}x\right)$. Applying first B.C. gives

$$B\sqrt{\lambda}+A=0\tag{1}$$

Applying second B.C. gives

$$0=A\cos\sqrt{\lambda}+B\sin\sqrt{\lambda}\tag{2}$$

From (1) $A=-B\sqrt{\lambda}$. Substituting this in (2) gives

\begin{align*} 0 & =-B\sqrt{\lambda}\cos\sqrt{\lambda}+B\sin\sqrt{\lambda}\\ 0 & =B\left( \sin\sqrt{\lambda}-\sqrt{\lambda}\cos\sqrt{\lambda}\right) \end{align*}

$B$ can't be zero, else $A=0$ also and trivial solution. Hence we must have

\begin{align*} \sin\sqrt{\lambda}-\sqrt{\lambda}\cos\sqrt{\lambda} & =0\\ \tan\sqrt{\lambda}-\sqrt{\lambda} & =0 \end{align*}

• Robin b.c. defined in terms of normal to the boundary (why mma uses $\partial_n$ in it's documentation). For region $[0,1]$ the normal to the region has different signs at values 0 and 1, as the normal to the region points in different directions in the 1-D space at these boundary values. (c.f. wikipedia ). It doesn't matter whether you place the sign inside or outside the NeumannValue, as long as one includes the normal direction. – John Joseph M. Carrasco Aug 27 '17 at 12:21