Help with solution of supposedly simple Optimal Control problem?

Hi, I'm trying to solve the following optimal control problem. I am sincerely sorry that I am not providing it in TeX format, but I hope it is readable

minimize over u(t) : [ integral from 0 to tf : [ a1*(x1(t) - x1f)^2 + a2*(x2(t) - x2f)^2 + r*u(t)^2 ] ]

subject to:

dx1/dt = x2(t)

dx2/dt = u(t)

x1(0) = 0;

x2(0) = 0;

x1(tf) = x1f;

x2(tf) = x2f;

finding the final time tf is not part of the problem and it can be considered fixed. a1,a2 and r are constants, x1 and x2 the state variables, u the control signal and x1f, x1f the desired state at the final time.

I have proceded in the usual fashion by setting up the Hamiltonian as

H = a1*(x1(t) - x1f)^2 + a2*(x2(t) - x2f)^2 + r*u(t)^2 + p1(t)*x2(t) + p2(t)*u(t)

where p1(t) and p2(t) are the costate variables satisfying:

dp1/dt = -partial derivative of H w.r.t. x1

dp2/dt = - partial derivative of H w.r.t. x2

From the necessary optimality conditions dH/du = 0 th optimal control uStar(t) is given as

uStar(t) = -p2(t)/2r

After inserting this in the original state equations I figured that since I have four first order differential equations (in x1,x2,p1,p2) and four boundary conditions I should be able to solve this, and tried with MATLAB's symbolic math toolbox. And indeed, I got a solution, only problem is that its to long to be printed (exceedes 25 000 characters :S) and of no practical use... But the question is, I guess, if this i due to the problem it self or just an effect of matlabs symbolics handler. I ofcourse tried simplify(...) but to no use.

Any Ideas on how to proceed?

The problem seems simple enough and it should be possible to get a closed expression.

Thanks!

Robert