kill(all);

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

Acid Mixtures (mono'HA1',mono,'HA2')
=================================

HA1 , HA2  both 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 acid: HA1,HA2
==================

reaction : HA1+H(2)O      ⇔ H(3)O(+) + A1(-)         ....  '1a'
reaction : HA2+H(2)O      ⇔ H(3)O(+) + A1(-)         ....  '1b'
reaction : H(2)O+H(2)O ⇔ H(3)O(+) + OH(-)          ....  '1c'
----------------------------------------------------------------------------
rem:H(3)O(+) =H, Ai(-) = Ai,OH(-)=OH  , i=1,2
----------------------------------------------------------------------------

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

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

-----------------------------------------------------
 [H(3)O(+)]  = [A1(-)] +[A2(-)] + [OH(-)] 
-----------------------------------------------------

p1c:H = OH + A1+A2;

definition : pKa
============

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

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

p2a:K_a1 = ((H)*(A1))/(HA1);
p2b:K_a2 = ((H)*(A2))/(HA2);

C_HAi = concentration strong Acid  ... '3a,b', i=1,2
-------------------------------------------------

p3a:C_HA1=(HA1)+(A1);
p3b:C_HA2=(HA2)+(A2);

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

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

p4a:solve(p3a,HA1);
p4b:solve(p3b,HA2);

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

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

3e)  solve for 'p5a,p5b'  for A1,A2
============================

p6a:solve(p5a,A1)[1];
p6b:solve(p5b,A2)[1];

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

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

Kw: see above.

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

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

assumption  :   [H(+)] <<< K_a1 and [H(+)] <<< K_a2 ;strong acid

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

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

rem : Htot = sum of all concentration = C_HA1+C_HA2+....+C_HAn 
---------------------------------------------------------------------------------------------------
example : n=2

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

p8b: ph = pH(rhs(p8a));

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

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

p8d:ratsimp(p8c*H);

we see : quadratic equation  'p8d'

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

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

assume(C_HA1>0,C_HA2>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: H = sol;

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

p9e:ph=pH(rhs(p9d));

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

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