Since I found I can use DEigensystem
to obtain eigenvalues and eigefunctions for differential operators, I am using it to verify solution to some of my HW's.
In this problem, from the textbook
I am not able to figure how the syntax to use. The eigenvalues are $n^2$ for $n=0,1,2,\dots$, and the eigenfunctions are $\{1,\cos(n x),\sin(n x)\}$
I do not know how to write the periodic boundary conditions for $y'(0)=y'(2\pi)$. This is what I tried (this below is still not complete)
ClearAll[y,x];
op={-y''[x],PeriodicBoundaryCondition[y[x],x==2 Pi],Function[x,x-2 Pi]]]};
eigf= NDEigenvalues[op,y[x],{x,0,2 Pi},5]
To add the derivatives part of the problem, I tried
op={-y''[x]+
PeriodicBoundaryCondition[y'[x],x==2 Pi,Function[x,x-2 Pi]],
PeriodicBoundaryCondition[y[x],x==2 Pi,Function[x,x-2 Pi]]};
eigf= NDEigenvalues[op,y[x],{x,0,2 Pi},5]
op={-y''[x],PeriodicBoundaryCondition[y'[x],x==2 Pi,Function[x,x-2 Pi]],
PeriodicBoundaryCondition[y[x],x==2 Pi,Function[x,x-2 Pi]]};
eigf= NDEigenvalues[op,y[x],{x,0,2 Pi},5]
I also noticed NDEigenvalues
gives any result, while DEigenvalues
does nothing at all.
Any suggestions how to use Mathematica to verify the above analytical results? Does PeriodicBoundaryCondition
support derivatives? I can post the hand derivation if needed.
reference http://reference.wolfram.com/language/ref/PeriodicBoundaryCondition.html
Appendix
Hand derivation follows
Solution using transformation.
Let $\tau=x-\pi$, hence the above system becomes \begin{align*} \frac{d\phi^{2}}{d\tau^{2}}+\lambda\phi & =0\\ \phi\left( -\pi\right) & =\phi\left( \pi\right) \\ \frac{d\phi}{d\tau}\left( -\pi\right) & =\frac{d\phi}{d\tau}\left( \pi\right) \end{align*} The characteristic equation is $r^{2}+\lambda=0$ or $r=\pm\sqrt{-\lambda}$. Assuming $\lambda$ is real. There are three cases to consider.
Case $\lambda<0$
Let $s=\sqrt{-\lambda}>0$ \begin{align*} \phi\left( \tau\right) & =c_{1}\cosh\left( s\tau\right) +c_{2} \sinh\left( s\tau\right) \\ \phi^{\prime}\left( \tau\right) & =sc_{1}\sinh\left( s\tau\right) +sc_{2}\cosh\left( s\tau\right) \end{align*} Applying first B.C. gives \begin{align} \phi\left( -\pi\right) & =\phi\left( \pi\right) \nonumber\\ c_{1}\cosh\left( s\pi\right) -c_{2}\sinh\left( s\pi\right) & =c_{1} \cosh\left( s\pi\right) +c_{2}\sinh\left( s\pi\right) \nonumber\\ 2c_{2}\sinh\left( s\pi\right) & =0\nonumber\\ c_{2}\sinh\left( s\pi\right) & =0 \tag{1} \end{align} Applying second B.C. gives \begin{align} \phi^{\prime}\left( -\pi\right) & =\phi^{\prime}\left( \pi\right) \nonumber\\ -sc_{1}\sinh\left( s\pi\right) +sc_{2}\cosh\left( s\pi\right) & =sc_{1}\sinh\left( s\pi\right) +sc_{2}\cosh\left( s\pi\right) \nonumber\\ 2c_{1}\sinh\left( s\pi\right) & =0\nonumber\\ c_{1}\sinh\left( s\pi\right) & =0 \tag{2} \end{align} Since $\sinh\left( s\pi\right) $ is zero only for $s\pi=0$ and $s\pi$ is not zero because $s>0$. Then the only other option is that both $c_{1}=0$ and $c_{2}=0$ in order to satisfy equations (1)(2). Hence trivial solution. Hence $\lambda<0$ is not an eigenvalue.
Case $\lambda=0$
The space equation becomes $\frac{d\phi^{2}}{d\tau^{2}}=0$ with the solution $\phi\left( \tau\right) =A\tau+B$. Applying the first B.C. gives \begin{align*} \phi\left( -\pi\right) & =\phi\left( \pi\right) \\ -A\pi+B & =A\pi+B\\ 0 & =2A\pi \end{align*} Hence $A=0$. The solution becomes $\phi\left( \tau\right) =B$. And $\phi^{\prime}\left( \tau\right) =0$. The second B.C. just gives $0=0$. Therefore the solution is $$ \phi\left( \tau\right) =C $$ Where $C$ is any constant. Hence $\lambda=0$ is an eigenvalue.
Case $\lambda>0$
\begin{align*} \phi\left( \tau\right) & =c_{1}\cos\left( \sqrt{\lambda}\tau\right) +c_{2}\sin\left( \sqrt{\lambda}\tau\right) \\ \phi^{\prime}\left( \tau\right) & =-c_{1}\sqrt{\lambda}\sin\left( \sqrt{\lambda}\tau\right) +c_{2}\sqrt{\lambda}\cos\left( \sqrt{\lambda} \tau\right) \end{align*} Applying first B.C. gives \begin{align} \phi\left( -\pi\right) & =\phi\left( \pi\right) \nonumber\\ c_{1}\cos\left( \sqrt{\lambda}\pi\right) -c_{2}\sin\left( \sqrt{\lambda}% \pi\right) & =c_{1}\cos\left( \sqrt{\lambda}\pi\right) +c_{2}\sin\left( \sqrt{\lambda}\pi\right) \nonumber\\ 2c_{2}\sin\left( \sqrt{\lambda}\pi\right) & =0\nonumber\\ c_{2}\sin\left( \sqrt{\lambda}\pi\right) & =0 \tag{3} \end{align} Applying second B.C. gives \begin{align} \phi^{\prime}\left( -\pi\right) & =\phi^{\prime}\left( \pi\right) \nonumber\\ c_{1}\sqrt{\lambda}\sin\left( \sqrt{\lambda}\pi\right) +c_{2}\sqrt{\lambda }\cos\left( \sqrt{\lambda}\pi\right) & =-c_{1}\sqrt{\lambda}\sin\left( \sqrt{\lambda}\pi\right) +c_{2}\sqrt{\lambda}\cos\left( \sqrt{\lambda} \pi\right) \nonumber\\ 2c_{1}\sqrt{\lambda}\sin\left( \sqrt{\lambda}\pi\right) & =0\nonumber\\ c_{1}\sin\left( \sqrt{\lambda}\pi\right) & =0 \tag{2} \end{align} Both (3) and (2) can be satisfied for non-zero $\sqrt{\lambda}\pi.$ The trivial solution is avoided. Therefore the eigenvalues are \begin{align*} \sin\left( \sqrt{\lambda}\pi\right) & =0\\ \sqrt{\lambda_{n}}\pi & =n\pi\qquad n=1,2,3,\cdots\\ \lambda_{n} & =n^{2}\qquad n=1,2,3,\cdots \end{align*}
Hence the corresponding eigenfunctions are
$$ \left\{ \cos\left( \sqrt{\lambda_{n}}\tau\right) ,\sin\left( \sqrt {\lambda_{n}}\tau\right) \right\} =\left\{ \cos\left( n\tau\right) ,\sin\left( n\tau\right) \right\} $$
Transforming back to $x$ using $\tau=x-\pi$
$$ \left\{ \cos\left( n\left( x-\pi\right) \right) ,\sin\left( n\left( x-\pi\right) \right) \right\} =\left\{ \cos\left( nx-n\pi\right) ,\sin\left( nx-n\pi\right) \right\} $$
But $\cos\left( x-\pi\right) =-\cos x$ and $\sin\left( x-\pi\right) =-\sin x$, hence the eigenfunctions are
$$ \left\{ -\cos\left( nx\right) ,-\sin\left( nx\right) \right\} $$
The signs of negative on an eigenfunction (or eigenvector) do not affect it being such as this is just a multiplication by $-1$. Hence the above is the same as saying the eigenfunctions are
$$ \left\{ \cos\left( nx\right) ,\sin\left( nx\right) \right\} $$
Summary
$\lambda=0$ eigenfunctions arbitrary constant
$\lambda>0$ eigenfunctions $\left\{ \cos\left( nx\right) ,\sin\left( nx\right) \right\} $ for $n=1,2,3\cdots$
y
andy'
overspecifies the problem. However, specifying onlyy'
fails with the 'Initial Condition Creation Failed" message. Apparently,NDEigensystem
is not yet capable of handling this boundary condition. $\endgroup$