Hi, I am new to Mathematica and am trying to solve minimum time optimal control problem using NDSolve. Please see attached for my notebook. I have 4 ODEs and 4 boundary conditions. Final time (tf) in this case is also unknown and need to be calculated by another constraint (transversality condition for free final time):
1 + \[Lambda1][tf]*x2[tf] - \[Lambda2][tf]*Sign[\[Lambda2]][tf] == 0
I am not sure how to add this equation to NDSolve and solve the problem altogether to include tf? I am sure there is a better way to do it. I thought this problem was straightforward but I couldn't find solution online...so here I am asking for help. This problem can actually be solved by hand calculation but I want to learn how to solve it with Mathematica. Thank you so much for your help!
I don't think NDSolve has capabilities to use variable boundary limits like that. The only method to try I can think off right now, is to re-scale the time axis to fit this equation. So in your ODEs you introduce tnew = t/tf so that 0 <= tnew <= 1. After that you will have to rethink your ODEs to make sense with that re-scaling and how to get the value for tf in a self-consistent manner.
tnew = t/tf
0 <= tnew <= 1