kill(all);

Maxima : intro computation ,base and acid, 'part :12a,version 1.0'
peter.vlasschaert@gmail.com, 13/12/2018

Base Mixtures (mono'B1',mono,'B2')
=================================

B1,B2         : representation strong base.

see : Maxima : intro computation ,base and acid, 'part :11a,version 1.0'
===========================================================

HA1,HA2   : representation strong acid.

load packages :
------------------------

load(lrats)$
load(facexp)$

convert:
-----------

log10(x):=log(x)/log(10);

definition : pH,pOH
================

p1: pH(x)   :=-log10(x)$
p1a:pOH(x):=-log10(x)$

dissociation : aq :
===============

p1b:kw=10^(-14);

quadratic equation :  s1*x^2+s2*x+s3= 0
=================

quadra2(s1,s2,s3,aa):= block([x1,x2,disc], disc: sqrt(s2^2-4*s1*s3),
                                                     x1:(-s2+disc)/(2*s1),
                                                     x2:(-s2-disc)/(2*s1),
                                                     aa:[x1,x2])$  

rem:solution of quadratic equation ,only pos solution have a physical meaning.

strong base: B1,B2
==================

================================
definition : base ,acid
---------------------------------
base : [H(+)] acceptor   : B    => BH(+)
acid  : [H(+)] donor         : HA =>  A(-)
================================

reaction : B1+H(2)O      ⇔ OH(-) + BH1(+)         ....  '1a'
reaction : B2+H(2)O      ⇔ OH(-) + BH2(+)         ....  '1a'
reaction : H(2)O+H(2)O ⇔ H(3)O(+) + OH(-)        ....  '1c'
----------------------------------------------------------------------------
rem:H(3)O(+) =H, BHi(+) = BHi,OH(-)=OH  , i=1,2
----------------------------------------------------------------------------

equilibrium: take account both  '1a' and '1b' and '1c'
-------------------------------------------------------------------------------

Charge balance : all species with charge in the solution.
==============

------------------------------------------------------
 [OH(-)]  = [BH1(+)] +[BH2(+)] + [H(+)] 
------------------------------------------------------

p1c:OH = H+BH1+BH2;

definition : pKb
============

p2:pKb(x)   :=-log10(x)$

definition : K_bi  ,i=1,2     with   '1a,1b'
=============

p2a:K_b1 = ((OH)*(BH1))/(B1);
p2b:K_b2 = ((OH)*(BH2))/(B2);

C_Bi = concentration strong base  ... '3a,b', i=1,2
-------------------------------------------------

p3a:C_B1=(B1)+(BH1);
p3b:C_B2=(B2)+(BH2);

How to find A from charge balance, 'p1c'
------------------------------------------------------------

1e)  solve for Bi from 'p3a,b' i=1,2
========================

p4a:solve(p3a,B1);
p4b:solve(p3b,B2);

2e)  put  Bi into  'p2a,p2b', i=1,2
=======================

p5a:subst(p4a,p2a);
p5b:subst(p4b,p2b);

3e)  solve for 'p5a,p5b'  for BH1,BH2
============================

p6a:solve(p5a,BH1)[1];
p6b:solve(p5b,BH2)[1];

How to find OH from charge balance, 'p1c'
---------------------------------------------------------------

p7a: Kw = (OH)*(H);
p7b:solve(p7a,H)[1];

Kw: see above.

insert 'p6a' and 'p6b' and 'p7b' into 'p1c'
==================================

p8:subst([p6a,p6b,p7b],p1c);

Only roots who have physical meaning : here only positive roots.
---------------------------------------------------------------------------------------------------
Why concentration can be never negative

rem : pOH + pH = 14 => symbolic : pOh + ph = 14

assumption  :   [OH(-))] <<< K_b1 and [OH(-)] <<< K_b2 ;strong acid

1e)   dilution : small    : Kw/OH = H  ,base mixture solution  => Kw /OH = 0
=================

p8a:lhs(p8) = subst([Kw/OH=0],part(rhs(p8),3))+subst([OH=0],part(rhs(p8),1))
                         +subst([OH=0],part(rhs(p8),2));

rem : OHtot = sum of all concentration = C_B1+C_B2+....+C_Bn 
---------------------------------------------------------------------------------------------------
example : n=2

pOh : solution
============

p8b: pOh = pOH(rhs(p8a));

ph : solution
============

p8b1:ph = 14+rhs(p8b);

1e)   dilution : very high    : Kw/OH = H  ,base mixture solution  => Kw /OH ≠0
====================

p8c:lhs(p8) = part(rhs(p8),3)+part(rhs(p8a));

p8d:ratsimp(p8c*OH);

we see : quadratic equation  'p8d', variable : OH

p9: lhs(p8d) - rhs(p8d) = 0;

s1: ratcoef(lhs(p9),OH^2);
s2: ratcoef(lhs(p9),OH);
s3: ev(lhs(p9),OH=0);

assume(C_B1>0,C_B2>0,Kw>0);

quadratic equation :  s1*x^2+s2*x+s3= 0 , see  ' above'
=================

p9a:quadra2(s1,s2,s3,aa);

two solution
-------------------

p9b:p9a[1];
p9c:p9a[2];

select :solutions with physical meaning,   pos solution
----------------------------------------------------------------------------------

for i:1 thru 2 do(
if is(p9a[i] >0) = true then sol: p9a[i]);

sol;

p9d: OH = sol;

pOh : solution
=============

p9e:pOh=pOH(rhs(p9d));

ph : solution
=============

p9e1:ph=14+pOH(rhs(p9d));

difference : example ( n=2), Mixture
----------------------------------------------------

=============================
strong acid        = > strong base
=============================
H                           => OH
K_ai                     =>  K_bi   i= 1,2,..n
C_HAi                  => C_Bi    i=1,2,..n
=============================

internet:
=======

Acid Strength and the Acid Dissociation Constant (Ka) = K_a
===================================================

https://chem.libretexts.org/Textbook_Maps/General_Chemistry
/Map%3A_A_Molecular_Approach_(Tro)/
16%3A_Acids_and_Bases/
16.04%3A_Acid_Strength_and_the_Acid_Dissociation_Constant_(Ka)

Table  16.4.1 : Values of  Ka ,  pKa ,  Kb , and  pKb  for Selected Acids ( HA  and Their Conjugate Bases ( A− )

acid  : HA                               K_a              , pK_a     
----------------------------------------------------------------------------------------
nitric   acid  :HNO3              2.3×10^1       ,−1.37       => strong acid
acetic acid  : CH3COOH   1.7×10^(-5)    ,4.76         => weak acid

given : concentration,       C_HA = 0.01 M 
rem : removes memory :  C_HA,K_a

------------------------------------------------------------------------------------------------