Consider the following boundary value problem from 1 in equation 1 and its boundary conditione are provided in equation 2.
The system has the solution
In order to solve the system numerically, the problem is discretized using pseudospectral method.
In the code, the boundary conditions and the dynamics are treated as nonlinear constraints by solver "IPOPT" and the objective it set to 0.
The numerical and analytical solution are identical as shown in the figure below. In addition, the spectral convergence of the method is also additional verified by increasing the grid size progressively.
Footnotes
-
Wang, L. L., Samson, M. D., & Zhao, X. (2014). A well-conditioned collocation method using a pseudospectral integration matrix. SIAM Journal on Scientific Computing, 36(3), A907-A929. ↩