kill(all)$

Electrochemistry (part 1c : Thermodynamics  dG 'Gibbs free energy')
peter.vlasschaert@gmail.com, 25/02/2019

rem :Electrochemistry (part 1a : Thermodynamics  dG 'Gibbs free energy')
rem :Electrochemistry (part 1b : Thermodynamics  dG 'Gibbs free energy')

load ' packages'
=============
load(lrats)  : used for simplification.

load(lrats)$

relation : between 'work = wk ' and ' G = gibbs free energy '.
===============================================
see : part 1b :

ideal : G     =>  del(G)
------------------------------
see (part 1b)  = 'p3a'

p1:del(G)=V*del(P)-S*del(T);

real : G  ( = non ideal )  with μ_i  => del(G)
-----------
see part 1b  = 'p3b'

p2a1:del(G)=-S*del(T)+V*del(P)+sum(μ[i]*del(n[i]),i,1,n);
p2a2:del(G)=-S*del(T)+V*del(P)+'sum(μ[i]*del(n[i]),i,1,n);

real : G  ( = non ideal )  with wk => del(G)
-----------

p2b:lhs(p1) = rhs(p1) - del(wk);

rem : 'p2b '  - sign before del(wk) 
==========================
because : infitesimal work( = wk) done by the system

what about  'p2b'
=============

rem : we will find the condition for work when P,T are constant.

1e) constraint on P,T
------------------------------

p3a:[del(P) = 0,del(T) = 0];

2e) what result on  'p2b'
---------------------------------

p3b:subst(p3a,p2b);

p3b1:p3b*(-1);

rem  : relation between  dG =dwk, T,P = constant

suppose : electrochemical cell ( = nature electrical)

declare(z,constant); 
declare(F,constant);   

rem : ψ  = potential
           z = charge
           F = constant of Faraday

1e) work from electrochemical cell
===========================

p4:wk = z*F.ψ;

2e) differentation of the work = wk
===========================

p4a:diff(p4);

3e) relation between work and G
==========================
action :because potential ( = ψ) deccrease.
when : T,P = constant

result : reversible isothermal reaction.
==============================

p4b :del(G) = - rhs(p4a);

4e) relation between work and potential
===============================

p4c1:subst(p3a,rhs(p2a2)) = rhs(p4b);

current ( = electrochemical process)

reason : Gibbs-Duhem equation
=========================

p4c2 : z*F*ψ  = - sum(μ[i]*n[i],i,1,n);

proof : 'p4c2'
------------------

same as , 'p4c1' ( show from ' p4c2 ')
============ 

declare(n,constant);

p5:diff(p4c2);

p6:p5*(-1);

from Gibbs-Duhem equation : del(μ_i).
------------------------------------------------------
see : part1b

p7:subst([del(μ[i]) = 0],p6);

p7a:intosum(p7);

check:  'p7a'  = 'p4c1' : ?  
=================

is(lhs(p7a) = rhs(p4c1));

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