## 19  Bryson-Denham Problem (Short version)

### 19.1  Problem description

The Bryson-Denham Problem but we take advantage of the propt input format to compute the cost function directly, without going via u and x3.

Reference: 

### 19.2  Problem setup

```toms t t_f
p = tomPhase('p', t, 0, t_f, 30); setPhase(p);
tomStates x1 x2
x1max = 1/9; x0 = {t_f == 0.5};

constr = {0.001 <= t_f <= 50
collocate({0 <= x1 <= x1max; -10 <= x2 <= 10})
initial({x1 == 0; x2 == 1}); final({x1 == 0; x2 == -1})
collocate(dot(x1) == x2)};

options = struct;
options.name = 'Bryson Denham Short';
solution = ezsolve(integrate(0.5*dot(x2).^2), constr, x0, options);
t  = subs(collocate(t),solution);
x1 = subs(collocate(x1),solution); x2 = subs(collocate(x2),solution);
figure(1)
plot(t,x1,'*-',t,x2,'*-');
legend('x1','x2');
title('Bryson Denham Short state variables');
```
```Problem type appears to be: con
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2011-02-05
=====================================================================================
Problem: ---  1: Bryson Denham Short            f_k       3.975295744665008800
sum(|constr|)      0.000000002213310492
f(x_k) + sum(|constr|)      3.975295746878319200
f(x_0)   1859.999999999970900000

Solver: snopt.  EXIT=0.  INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied

FuncEv  139 GradEv  137 ConstrEv  137 ConJacEv  137 Iter  136 MinorIter  316
CPU time: 0.375000 sec. Elapsed time: 0.375000 sec.
``` 