function y = db1(x,Pc1,Pc2,C1,C2,mu1,mu2)

M = inv(C1);
N = inv(C2);
m = mu1;
n = mu2;
K = log(Pc2/Pc1) - log(det(C2)/det(C1));
 
      t3 = N(2,1)*x;
      t4 = M(2,1)*m(1);
      t5 = N(1,2)*n(1);
      t6 = M(2,1)*x;
      t7 = N(1,2)*x;
      t8 = N(2,1)*n(1);
      t9 = N(2,2)*n(2);
      t10 = M(2,2)*m(2);
      t11 = M(1,2)*x;
      t12 = M(1,2)*m(1);
      t13 = N(2,2)*N(1,1);
      t14 = x*x;
      t16 = M(2,2)*N(1,1);
      t18 = pow(n(1),2.0);
      t20 = M(2,2)*M(1,1);
      t22 = pow(m(1),2.0);
      t24 = pow(N(1,2),2.0);
      t27 = pow(M(1,2),2.0);
      t30 = N(2,2)*M(1,1);
      t32 = N(2,2)*M(2,2);
      t33 = pow(m(2),2.0);
      t36 = pow(n(2),2.0);
      t41 = N(2,1)*t14;
      t43 = pow(N(2,1),2.0);
      t47 = -4.0*t13*t14+4.0*t16*t14+4.0*t16*t18-4.0*t20*t14-4.0*t20*t22-2.0*t24*n(1)*x-2.0*t27*x*m(1)+4.0*t30*t14+4.0*t32*t33+4.0*t30*t22+4.0*t32*t36-4.0*t13*t18+2.0*M(2,1)*t22*M(1,2)-2.0*t41*M(1,2)-2.0*t43*x*n(1)+2.0*t41*N(1,2);
      t49 = pow(M(2,1),2.0);
      t54 = M(2,1)*t14;
      t69 = -2.0*t41*M(2,1)-2.0*t49*m(1)*x-2.0*N(1,2)*t14*M(1,2)+2.0*t54*M(1,2)-2.0*t54*N(1,2)-4.0*t4*t9-2.0*t4*t8-8.0*M(2,2)*K-4.0*t4*t11+8.0*N(2,2)*K+t27*t14+t43*t18+4.0*t7*t10-2.0*t8*t12+2.0*t8*t11-4.0*t8*t10-4.0*t9*t12;
      t89 = 4.0*t9*t11-8.0*t9*t10+4.0*t6*t9+2.0*t6*t8+2.0*t7*t12+2.0*t4*t7+2.0*N(1,2)*t18*N(2,1)-2.0*t4*t5+2.0*t3*t12+4.0*t3*t10-4.0*t3*t5+2.0*t3*t4-2.0*t5*t12+2.0*t5*t11-4.0*t5*t10+2.0*t5*t6+t49*t22;
      t92 = M(2,2)*N(2,1);
      t93 = n(2)*n(1);
      t95 = x*n(1);
      t97 = n(2)*x;
      t99 = N(2,2)*M(1,2);
      t100 = x*m(2);
      t104 = N(2,2)*M(2,1);
      t106 = m(2)*m(1);
      t108 = x*m(1);
      t110 = M(2,2)*N(1,2);
      t117 = t24*t18+t43*t14+4.0*t92*t93-8.0*t16*t95-4.0*t92*t97-4.0*t99*t100+t24*t14+t49*t14-4.0*t104*t100+4.0*t104*t106-8.0*t30*t108-4.0*t110*t97+8.0*t20*t108+4.0*t110*t93+t27*t22+8.0*t13*t95+4.0*t99*t106;
      t120 = sqrt(t47+t69+t89+t117);
      t121 = t3+t4-t5-t6+t7-t8-2.0*t9+2.0*t10-t11+t12+t120;
      t123 = 1/(-N(2,2)+M(2,2))*t121/2;

y = t123;