kill(all)$

# find:generalequations for strong base m(OH)n,n=1,2

 find:general equations for strong base M(OH)n,n=1,2
 peter.vlasschaert@gmail.com, 26/09/2016

calculus ,infinity limit of rational expression.

p:(5*x^3+x+9)/(3*x^3+5);
limit(p, x, infinity);

general equation for (di)hydroxy base : (n=2,M(OH)n)
h=[H(+)],c=Cb,k1=kb(1),k2=kb(2),kw = 1E-14

p1:kw/h=h+cb*(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;

monohydroxy strong base (n=1,M(OH)n)
[H(+)] = h ,kb(1)=k1 = infinity , kb(2)=k2= 0,kw=1E-14

p5:ev(lhs(p4),k2=0);

p6:limit(lhs(p5/k1), k1, infinity);

p7:factor(p6);

p8:(-1)*part(p7,3)=0;

p9:solve(lhs(p8),h);

p10:part(p9,2);

nb1:ev(lhs(p8),h=0)/h;
nb2:coeff(lhs(p8),h)*(h/h);
nb3:coeff(lhs(p8),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 : monohydroxy base 'MOH'

nr:ev(npq,kw=0);

pOH = - log(c),   pH+pOH = 14 = kw

dihydroxy base (n=2,M(OH)n)
[H(+)] = h ,kb(1)=k1 = infinity , kb(2)=k2= infinity ,kw=1E-14

first (n=2)

p4;

n1:ev(lhs(p4),h=0);
n2:coeff(lhs(p4),h^1);
n3:coeff(lhs(p4),h^2);
n4:coeff(lhs(p4),h^3);
n5:coeff(lhs(p4),h^4);
q1:n5*h^4+n4*h^3+n3*h^2+n2*h+n1;
q2:ratsubst(k,k1*k2,q1);

p11:ratsubst(k,k1*k2,n1);
n1_k:limit((p11)/k,k,infinity);
n1_k1:limit(ratsubst(k1*k2,k,(coeff(p11,k1)/(k)))*k1,k2,infinity);
n1_k2:limit(ratsubst(k1*k2,k,(coeff(p11,k2)/(k)))*k2,k1,infinity);
n1_c:limit(ev(p11,k1=0,k2=0,k=0)/(k),k,infinity);

p22:ratsubst(k,k1*k2,n2);
n2_k:limit((p22)/k,k,infinity);
n2_k1:limit(ratsubst(k1*k2,k,(coeff(p22,k1)/(k)))*k1,k2,infinity);
n2_k2:limit(ratsubst(k1*k2,k,(coeff(p22,k2)/(k)))*k2,k1,infinity);
n2_c:limit(ev(p22,k1=0,k2=0,k=0)/(k),k,infinity);

p33:ratsubst(k,k1*k2,n3);
n3_k:limit((p33)/k,k,infinity);
n3_k1:limit(ratsubst(k1*k2,k,(coeff(p33,k1)/(k)))*k1,k2,infinity);
n3_k2:limit(ratsubst(k1*k2,k,(coeff(p33,k2)/(k)))*k2,k1,infinity);
n3_c:limit(ev(p33,k1=0,k2=0,k=0)/(k),k,infinity);

p44:ratsubst(k,k1*k2,n4);
n4_k:limit((p44)/k,k,infinity);
n4_k1:limit(ratsubst(k1*k2,k,(coeff(p44,k1)/(k)))*k1,k2,infinity);
n4_k2:limit(ratsubst(k1*k2,k,(coeff(p44,k2)/(k)))*k2,k1,infinity);
n4_c:limit(ev(p44,k1=0,k2=0,k=0)/(k),k,infinity);

p55:ratsubst(k,k1*k2,n5);
n5_k:limit((p55)/k,k,infinity);
n5_k1:limit(ratsubst(k1*k2,k,(coeff(p55,k1)/(k)))*k1,k2,infinity);
n5_k2:limit(ratsubst(k1*k2,k,(coeff(p55,k2)/(k)))*k2,k1,infinity);
n5_c:limit(ev(p55,k1=0,k2=0,k=0)/(k),k,infinity);

 t1:n1_k+n1_k1+n1_k2+n1_c$
 t2:n2_k+n2_k1+n2_k2+n2_c$
 t3:n3_k+n3_k1+n3_k2+n3_c$
 t4:n4_k+n4_k1+n4_k2+n4_c$
 t5:n5_k+n5_k1+n5_k2+n5_c$

p66:t5*h^4+t4*h^3+t3*h^2+t2*h+t1=0;

p77:factor(p66);

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

p99:solve(p88,h);

p100:part(p99,2);

nd1:ev(lhs(p88),h=0)/h;
nd2:coeff(lhs(p88),h)*(h/h);
nd3:coeff(lhs(p88),h^2)*(h^2/h);

nd:nd2+nd3=-nd1;

mp:subst(kw/oh,h,lhs(nd))$
mq:subst(oh,kw/h,rhs(nd))$
mpq:mq=mp;

first approximation:dihydroxy base 'M(OH)2'

mr:ev(mpq,kw=0);

pOH=-log(2*cb) , pH+pOH=pkw