0
$\begingroup$

I'm trying to implement various kinds of pseudospectral methods for direct optimization in Matlab using IPOPT. I've got some working Legendre-Gauss-Lobatto code, but would like to use the flipped Radau method. What greatly helped me out writing the LGL code was having an example 6x6 differentiation matrix to test against until my code could reproduce it. What I could use is a similar LGR differentiation matrix for e.g. the N=6 case (a 6x7 "unsparse" matrix due to the addition of the uncollocated -1 point).

I'd also like to know if the flipped Radau points are literally just inverted around 0, or if the algorithm to determine the LGR points needs to be modified to find $P_N(x)-P_{N+1}(x)$ instead of $P_N(x)+P_{N+1}(x)$?

Alternatively pointers to any Matlab or Python code which can reproduce these differentiation matrices would be appreciated.

For background on LGR/LGL/LG methods:

Divya Garg, Michael Patterson, William Hager, Anil Rao, David Benson, et al.. An overview of three pseudospectral methods for the numerical solution of optimal control problems. 2017. hal-01615132

$\endgroup$
  • $\begingroup$ According to Matlab if x is a vector of the roots of $P_N(x)+P_{N+1}(x)$ for N=5 then legendreP(5,x) + legendreP(6,x) is the zero vector and legendreP(5,-x) - legendreP(6,-x) is also the zero vector, so I think that answers my question about generating the flipped LGR points. $\endgroup$ – lamont Jun 19 at 22:03
  • $\begingroup$ I think also the obvious thing for me to do is to just take a function that is trivial to differentiate and check applying the derivative operator against it vs. the known analytic solution. Already did that with my known-working LGL code. Can then invert that to test integration as well.. $\endgroup$ – lamont Jun 20 at 17:15
  • $\begingroup$ The matlab code associate with the book SPECTRAL METHODS: Algorithms, Analysis and Applications is here and legsrddiff.m by changing dy=dy1+dy2; y=y1+y2; to dy=dy1-dy2; y=y1-y2; -- still working on adding the noncollocated point. $\endgroup$ – lamont Jun 25 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.