kill(all)$

polyhydroxy base : (tri)hydroxy strongbase,M(OH)n => n=3
peter.vlasschaert@gmail.com,28/09/2016

first step: weak base (n=3)

polyhydroxy base : (tri)hydroxy weak base,M(OH)n => n=3
-------------------------------------------------------
h=[H(+)],c=Cb,k1=kb(1),k2=kb(2),k3=kb(3),kw = 1E-14

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

p2:lhs(p1)-rhs(p1)=0;
p3:factor(lhs(p2))=0$

p4:(-1)*num(lhs(p3))=0;

nn1:ev(lhs(p4),h=0);
nn2:coeff(lhs(p4),h);
nn3:coeff(lhs(p4),h^2);
nn4:coeff(lhs(p4),h^3);
nn5:coeff(lhs(p4),h^4);
nn6:coeff(lhs(p4),h^5);

p5:(nn6*h^5+nn5*h^4+nn4*h^3+nn3*h^2+nn2*h+nn1);

second step: strong base ( n=3)

polyhydroxy base : (tri)hydroxy strong base,M(OH)n => n=3
-------------------------------------------------------
h=[H(+)],c=Cb,k1=kb(1)->inf,k2=kb(2)->inf,k3=kb(3)->inf,kw = 1E-14
result : k=k1*k2*k3 -> inf : limit p5/k for k -> inf

p11:ratsubst(k,k1*k2*k3,nn1)$
n1_k:limit((p11)/k,k,infinity)$
p22:ratsubst(k,k1*k2*k3,nn2)$
n2_k:limit((p22)/k,k,infinity)$
p33:ratsubst(k,k1*k2*k3,nn3)$
n3_k:limit((p33)/k,k,infinity)$
p44:ratsubst(k,k1*k2*k3,nn4)$
n4_k:limit((p44)/k,k,infinity)$
p55:ratsubst(k,k1*k2*k3,nn5)$
n5_k:limit((p55)/k,k,infinity)$
p66:ratsubst(k,k1*k2*k3,nn6)$
n6_k:limit((p66)/k,k,infinity)$

p77:n6_k*h^5+n5_k*h^4+n4_k*h^3+n3_k*h^2+n2_k*h^1+n1_k=0;

p88:factor(lhs(p77))=0;

p99:(-1)*part(p88,1,1,2)=0;

p100:solve(lhs(p99),h);

strong basse(n=3,M(OH)3),quadratic equation : kw <> 0

p101:part(p100,2);

nb1:ev(lhs(p99),h=0)/h;
nb2:coeff(lhs(p99),h)*h/h;
nb3:coeff(lhs(p99),h^2)*h^2/h;

nb:nb2+nb3=-nb1;

kw=oh*h

np:subst(kw/oh,h,lhs(nb));
nq:subst(oh,kw/h,rhs(nb));
npq:np=nq;

first approximation :(kw=0,linear equation) trihydroxy base M(OH)3,n=3

nr:ev(npq,kw=0);

pOH = - log(3*Cb),pH+pOH=14=pkw
pH = 14 - log(3*Cb)