kill(all)$

polyhydroxy base : (di)hydroxy weak base,M(OH)n => n=2
------------------------------------------------------
M = Ca(OH)2
h=[H(+)],c=Cb,k1=kb(1),k2=kb(2),kw = 1E-14
peter.vlasschaert@gmail.com,23/09/2016

p1:kw/h=h+c*(2*h^2*k1*k2 +h*k1*kw)/(h^2*k1*k2+h*k1*kw+kw^2);

p2:lhs(p1)-rhs(p1)=0$

p3:factor(lhs(p2))=0$

p4:num(lhs(p3))=0;

n1:ev(lhs(p4),h=0);
n2:coeff(lhs(p4),h);
n3:coeff(lhs(p4),h^2);
n4:coeff(lhs(p4),h^3);
n5:coeff(lhs(p4),h^4);

p5:(n5*h^4+n4*h^3+n3*h^2+n2*h+n1)=0;