kill(all)$

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

load packages
----------------------

load(lrats)$

reaction :  HA  + H2O     ⇔ H3O(+) + A(-)        .... '1'
                    H2O + H2O   ⇔ H2O(+) + OH(-)     .... '2'

eq: '1'   assume K_a : equilibrium constant
====================================

rem : [OH(-)] = OH,[H3O(+)] = H ,[A(-)] = A,[HA] =HA

p1:K_a =((H)*(A))/HA;

assume : [HA]  = 10^(-99) ⇒ 0,   K_a → infinity, why : A*H  have some value.

C_HA =[HA] + [A(-)]

p2:C_HA = HA + A;

HA = 0 ,for strong acid.

p2a:subst([HA=0],p2);

from equation '1'   : [H(+)] = [A(-)]

p2b: subst([A=H],p2a);

=>         pH = -log10(C_HA)

eq: '2'   assume K_w : equilibrium constant
=====================================

p3:K_w =(H)*(OH);

assume : H2O: water neutral : [OH(-)] =[H(+)] = 10^(-7)
--------------------------------------------------------------------------------
rem : pH+pOH = 14  => K_w = 10^(-14) @ 25°C

for acid : [OH(-)] = K_w/[H(+)]

p3a:solve(p3,OH)[1];

from charge balance : ( + charge) = (- charge)
--------------------------------------------------------------------
species :[A(-)],[H(+)],[OH(-)]

charge balance : '1' and '2'
==============

p4:H=OH + A;
K_w : 10^(-14);

p4a:subst([p3a],p4);

because : K_w << H ,strong acid.
=> [OH(-)]  <<< [H(+)]  => K_w/H = 0

p4b:lhs(p4a) = part(rhs(p4a),2);

combination : 'p4b' and 'p2a and p2b' ,find pH for a strong acid.

rem : charge bance.

def : charge balance
=================
sum (+ charge)  = sum (-charge)

solution : species,[A(3-)],[M(2+)],[OH(-)],[H(+)]
------------------------------------------------------------------
[A(-)] = A,[M(2+)] = M 

charge balance :for the solution for this example.
=========================================

2*[M(2+)] +1* [H(+)] = 1*[OH(-)] + 3*[A(3-)]

p5:2*M +1* H = 3*A + 1*OH;

'--------------------------------------------------------------------------------------------------'