I am sorry for the post. It works. I have made a mistake towards the end. Dvector x(n); should be Dvector x(n+1); -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://list.coin-or.org/pipermail/cppad/attachments/20170814/38be2a4d/attachment.html>