Question: plot the Hamiltonian as time function

I solved the canonical equations as piecewise functions and I wrote the Hamiltonian using these piecewise functions. Now the Hamiltonian is function of time (tau). I can not plot this Hamiltonian. Where is my mistake, please? Below is the Maple program. I mention that I tried to simplify the Hamiltonian, but without succes. Thank you for helping me.

                                     
> restart; with(DEtools); with(plots);
> r1 := Q1(tau)^2+Q2(tau)^2;
> r2 := sqrt((Q1(tau)^2-Q2(tau)^2-1)^2+4*Q1(tau)^2*Q2(tau)^2);
> q := 0.123e-1;
> eq1 := diff(Q1(tau), tau) = (1/4)*P1(tau)*r1*r2^3+(1/2)*Q2(tau)*r1^2*r2^3;
> eq2 := diff(Q2(tau), tau) = (1/4)*P2(tau)*r1*r2^3-(1/2)*Q1(tau)*r1^2*r2^3;
> eq3 := diff(P1(tau), tau) = (1/2)*P2(tau)*r1^2*r2^3-2*q*Q1(tau)*r1^2*r2^3/(1+q)-2*Q1(tau)*r2^3/(1+q)-2*q*Q1(tau)*(r1-1)*r1^2/(1+q);
> eq4 := diff(P2(tau), tau) = -(1/2)*P1(tau)*r1^2*r2^3+2*q*Q2(tau)*r1^2*r2^3/(1+q)-2*Q2(tau)*r2^3/(1+q)-2*q*Q2(tau)*(r1+1)*r1^2/(1+q);
> vPi := evalf(Pi); P := 2*vPi; h := 0.1e4; T := 1*P;
> Q10 := .2878; Q20 := .6948; P10 := 0; P20 := .7521;
> p := dsolve([eq1, eq2, eq3, eq4, Q1(0) = Q10, Q2(0) = Q20, P1(0) = P10, P2(0) = P20], numeric, [Q1(tau), Q2(tau), P1(tau), P2(tau)], method = rkf45, initstep = h, range = 0 .. T, maxfun = 0, output = piecewise);
> fQ1 := op(2, p[2]); fQ2 := op(2, p[3]); fP1 := op(2, p[4]); fP2 := op(2, p[5]);
> H := (1/8)*(fP1^2+fP2^2)/(fQ1^2+fQ2^2)+1/2*(fP1*fQ2-fQ1*fP2)+q*(fQ1^2+f*Q2^2)/(1+q)-1/((1+q)*(fQ1^2+fQ2^2))-q/((1+q)*sqrt((f*Q1^2-fQ*2^2-1)^2+4*f*Q1^2*fQ2^2))-q^2/(2*(1+q)^2);
> plot(H(tau), tau = 0.3e-1 .. T, discont = true);

Please Wait...