kill(all)$

appendix : chemical equations,equation,version 1.0
peter.vlasschaert@gmail.com,15/02/2021

ref: appendix
===========

----------------------------------------------------------------------------------------------------------------------------------------------------
new: 07/02/2021: Appendix :How import chemical elements : Maxima (csv file),version 1.0
download  (Maxima,code)       :appendixchemicalequationshowimportcsvfilechemicalelementsversion1
download  (Maxima,png)         :appendixchemicalequationshowimportcsvfilechemicalelementsversion1outp
download  (sheet,csv)               :elementlist.csv
new: 08/02/2021: Appendix :chemical components : molecular mass ,version 1.0.
download  (Maxima,code)       :appendixmolecularmassfromchemicalelementdataversion1
download  (Maxima,png)         :appendixmolecularmassfromchemicalelementdataversion1outp
new: 09/02/2021: Appendix: chemical  components : oxidation state,version 1.0.
download  (Maxima,code)       :appendixchemicalcomponentoxidationstateversion1final
download  (Maxima,png)         :appendixchemicalcomponentoxidationstateversion1finaloutp
new: 13/02/2021: Appendix: chemical  components :sum,version 1.0.
download  (Maxima,code)       :maximachemicaleqstrdispsumpart4version12021
-----------------------------------------------------------------------------------------------------------------------------------------------------

load packages,options
==================

load(lrats)$ratprint:false$load(stringproc)$

producten before reaction : N products.(integer)
------------------------------------------------------------------

pba1:[Na,ascii(32),O,ascii(32),H];
pba2:[ascii(32),ascii(32),ascii(32),1,ascii(32),ascii(32),1,ascii(32),
      ascii(32),1];

disp(simplode(pba1),simplode(pba2))$

pba11:[H,ascii(32),S,ascii(32),O];
pba22:[ascii(32),ascii(32),2,ascii(32),ascii(32),1,ascii(32),
      ascii(32),4];

disp(simplode(pba11),simplode(pba22))$

producten after reaction : M products.(integer)
---------------------------------------------------------------

paa1:[Na,ascii(32),S,ascii(32),O];
paa2:[ascii(32),ascii(32),ascii(32),2,ascii(32),ascii(32),1,ascii(32),
      ascii(32),4];

disp(simplode(paa1),simplode(paa2))$

paa11:[H,ascii(32),O];
paa22:[ascii(32),ascii(32),2,ascii(32),ascii(32),1];

disp(simplode(paa11),simplode(paa22))$

→ before:
--------------

p2a1:simplode(flatten([pba1,"+",pba11]));

p2a11:simplode(flatten([pba2,pba22]));

p2a111:disp(p2a1,p2a11)$

→ after:
-----------

p2b1:simplode(flatten([paa1,"+",paa11]));

p2b11:simplode(flatten([paa2,paa22]));

p2b111:disp(p2b1,p2b11)$

combination : before = after
--------------------------------------

p3c1:simplode(flatten([pba1,"+",pba11,"=",paa1,"+",paa11]));

p3c2:simplode(flatten([ascii(32),ascii(32),ascii(32),ascii(32),[pba2,pba22],[paa2,paa22],ascii(32)]));

p3c2a:ssubst(ascii(32),"1",p3c2);

p3c3:disp(p3c1,p3c2a)$

p3c4:p3c1;
p3c5:p3c2a;

vb :[ascii(32),ascii(32),ascii(32),ascii(32),[pba2,pba22],ascii(32),[paa2,paa22],ascii(32)]
=====================================================================

modelling string :to do best display of the equation
-----------------------------------------------------------------------

===================================================
ascii(32) *k1 ,[pba2,pba22],ascii(32)*k2,[paa2,paa22],ascii(32)*k3
k1=3,k2=1,k3=1
===================================================
reason : remove ones ,change position of the numbers:"p3c2a"