kill(all)$

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

see also part 4,5

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

load(lrats)$

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

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

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

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

Find relation between :K_a ,K_b
===========================

system : '1' and '2'.

acid 'HA' = [H3O(+)]=[H(+)]=H donor.
------------------------------------------------

reaction : HA+H2O = H3O(+)+A(-) ... '1'
================================
rem:[A(-)] = A

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

acid 'A(-)' = [H3O(+)]=[H(+)]=H acceptor.
-----------------------------------------------------------
rem : [OH(-)]=OH

reaction : A(-)+H2O = HA+OH(-) ... '2'
================================

p2a: K_b = ((HA)*(OH))/A;

result : K_w ?
============

p3:p2*p2a;

H2O+H2O = H3O(+) + OH(-)
======================
or
H2O           = H(+) + OH(-)        => K_w
======================

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

p4a:lhs(p3) = lhs(p4);

water solution for a product
========================

pH = neutrale = 7
==============
H2O  =>  H = OH

p5:H = OH;

inside def  :pH = ph
-----------------------------

p6:ph=float(-log10(10^(-7)));

from def : pH =>
=============

p7:pH(10^(-7));

p7a:float(%);

H2O =>  H = OH = 10^(-7)
=====================

p8:H=10^(-7);

p8a:OH=10^(-7);

from def : pOH =>
=============

p8b:pOH(10^(-7));

p8c:%,numer;

find value :K_w
==============

p9:subst([p8,p8a],p4);

p10:lhs(p9)=float(rhs(p9)), numer;

find : pK_w
==========
p=-log10

p11:pK_w= -log10(rhs(p10));

p11a:lhs(p11)=float(rhs(p11)), numer;

relation : 
K_a*K_b = K_w
K_w         = H*OH=1.0*10^-14
pK_w       = 14.0

rem:
====
----------------------------------------------------------
Menu : Simplify :  Expand  Logarithms 
                                 Contract Logarithms
----------------------------------------------------------